check_obstacle()
- 1 Minute to read
check_obstacle()
- 1 Minute to read
Article summary
Did you find this summary helpful?
Thank you for your feedback
Check the presence of an obstacle into a specified range of angles and distances.
TODO!: Figure that shows the obstacle detection.
Reference
Arguments
Argument | Type | Default value | |
---|---|---|---|
lower_angle | float | Lower bound of the angles range. | |
upper_angle | float | Upper bound of the angles range. | |
lower_distance | float | 0.0 | Lower bound of the distance range. |
Upper_distance | float | float('inf') | Upper bound of the distance range. |
ang_unit | enum | ANG_UNIT.DEG | ENUM to select the unit of the angle: (ANG_UNIT.DEG ) degrees or (ANG_UNIT.RAD ) radians |
- Both
lower_angle
andupper_angle
must be into the range[angle_min, angle_max]
from laser info (see LidarController.get_laser_info()) upper_angle
must be higher thanlower_angle
.- At least one of both
lower_distance
orupper_distance
must be speficied. upper_distance
must be higher thanlower_distance
.
Return
Boolean.
Returns True
if the lidar detects an obstacle between the angles lower_angle and upper_angle, at a distance between lower_distance and upper_distance from the robot.
Exceptions
Exception | Condition |
---|---|
RayaLidarInvalidAngleUnit | |
RayaInvalidNumericRange | upper_angle is lower than lower_angle or none of lower_distance and upper_distance are specified or upper_distance is lower than lower_distance. |
Examples
Check if obstacle in front of the robot (angle range: [-15.0°, 15.0°]
), at less than a meter and a half.
...
self.lidar = self.enable_controller('lidar')
...
detection = self.lidar.check_obstacle(
lower_angle=-15.0,
upper_angle=15.0,
lower_distance=1.5,
and_unit=ANG_UNIT.DEG)
...
Go back to the Lidar Controller page.
Was this article helpful?