[Documentation] [TitleIndex] [WordIndex

This page is intended to help users understand the changes of REP 117 on laserscans, rangers, and point clouds.

The use_rep_117 parameter was removed in Hydromedusa.

Please ensure your code can handle the special conditions.

What changes does REP 117 mean for users of drivers?

The most important thing to remember is that Infinities and NaNs can be output by the drivers. These numbers have special meanings according to the REP: -Inf means an object is too close to have an accurate measurement; NaN means invalid measurement; and +Inf means that there was no measurement within sensor range.

How do I get rid of the warning? What is the use_rep_117 parameter?

The warning is in place to remind you that the driver is currently operating in a legacy mode. In the next ROS release (Groovy), the default behavior will be to use the REP 117 values.

Once you are ready for your driver to switch to the new output, just set a parameter for use_rep_117 before you run or in your launch file.

    rosparam set use_rep_117 true

The use_rep_117 parameter will be used until the H-Turtle release, at which point the only behavior for drivers will be according to REP 117.

How do I know if my code can handle NaNs and Infs?

The following are example callbacks that will safely reject NaNs and Infs.

C++

    // Laserscans and Ranges
    for(size_t i = 0; i < msg.ranges.size(); i++){
      // NaNs and Infs will always return false on a comparison.
      if(msg.min_range <= msg.ranges[i] && msg.ranges[i] <= msg.max_range){
        // Accept this measurement
      }
    }

    // PCL Pointcloud (Pointcloud2)
    #include <math.h>

    for(size_t i = 0; i < msg.size(); i++){
      // PointClouds do not have min and max ranges, so we must specify a check
      if(!std::isnan(msg[i]) && !std::isinf(msg[i])){
        // Accept this measurement
      }
    }

Python

    # Laserscans and Ranges
    for range in msg.ranges:
      # NaNs and Infs will always return false on a comparison.
      if msg.min_range <= range and range <= msg.max_range:
        # Accept this measurement

2024-12-21 15:11