check_obstacle()
  • 1 Minute to read

check_obstacle()


Article Summary

Check the presence of an obstacle into a specified range of angles and distances.

TODO!: Figure that shows the obstacle detection.

Reference

Arguments

ArgumentTypeDefault value
lower_anglefloatLower bound of the angles range.
upper_anglefloatUpper bound of the angles range.
lower_distancefloat0.0Lower bound of the distance range.
Upper_distancefloatfloat('inf')Upper bound of the distance range.
ang_unitenumANG_UNIT.DEGENUM to select the unit of the angle: (ANG_UNIT.DEG) degrees or (ANG_UNIT.RAD) radians
  • Both lower_angle and upper_angle must be into the range [angle_min, angle_max] from laser info (see LidarController.get_laser_info())
  • upper_angle must be higher than lower_angle.
  • At least one of both lower_distance or upper_distance must be speficied.
  • upper_distance must be higher than lower_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

ExceptionCondition
RayaLidarInvalidAngleUnit
RayaInvalidNumericRangeupper_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?

What's Next