rcute_cozmars.sonar

class rcute_cozmars.sonar.Sonar(robot)

Sonar, namely ultrasonic distance sensor

when_in_range = None

Callback function, defalts to None. Called when the distance to detected obstacle is less than threshold_distance.

The callback function accepts one parameter, which is the distance to detected object, in meters

distance

Distance to detect obstacles ahead (m)

When the distance exceeds max_distance, it will read max_distance

distance_threshold

Threshold distance (m), default is 0.1

max_distance

The farthest measurable distance (meters), the default is 0.5

when_out_of_range = None

Callback function, default to None. Called when the distance to the detected obstacle is greater than threshold_distance.

The callback function accepts one parameter, which is the distance to detected object, in meters