ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm not sure this is your issue, but looking at , the comments on min_range, max_range and range seem to suggest that any value < min_range, or > max_range "should be discarded":

float32 range           # range data [m]
                        # (Note: values < range_min or > range_max
                        # should be discarded)
                        # Fixed distance rangers only output -Inf or +Inf.
                        # -Inf represents a detection within fixed distance.
                        # (Detection too close to the sensor to quantify)
                        # +Inf represents no detection within the fixed distance.
                        # (Object out of range)

The code in rviz/default_plugin/range_display.cpp seems to follow that recommendation:

  float displayed_range = 0.0;
  if(msg->min_range <= msg->range && msg->range <= msg->max_range)
  {
    displayed_range = msg->range;
  }
  else if(msg->min_range == msg->max_range)  // Fixed distance ranger
  {
    if(msg->range < 0 && !std::isfinite(msg->range))     // NaNs and +Inf return false here: both of those should have 0.0 as the range
    {
      displayed_range = msg->min_range; // -Inf, display the detectable range
    }
  }

The two messages you posted (range: 254.0 and range: 22.0) seem to fall outside both if clauses (not between min and max range, and also min == max), leaving displayed_range at 0.0.

I think there is a cone in your RViz, it just has 0 length.

I'm not sure this is your issue, but looking at the documentation of sensor_msgs/Range, the comments on min_range, max_range and range seem to suggest that any value < min_range, or > max_range "should be discarded":

float32 range           # range data [m]
                        # (Note: values < range_min or > range_max
                        # should be discarded)
                        # Fixed distance rangers only output -Inf or +Inf.
                        # -Inf represents a detection within fixed distance.
                        # (Detection too close to the sensor to quantify)
                        # +Inf represents no detection within the fixed distance.
                        # (Object out of range)

The code in rviz/default_plugin/range_display.cpp seems to follow that recommendation:recommendation (although not explicitly):

  float displayed_range = 0.0;
  if(msg->min_range <= msg->range && msg->range <= msg->max_range)
  {
    displayed_range = msg->range;
  }
  else if(msg->min_range == msg->max_range)  // Fixed distance ranger
  {
    if(msg->range < 0 && !std::isfinite(msg->range))     // NaNs and +Inf return false here: both of those should have 0.0 as the range
    {
      displayed_range = msg->min_range; // -Inf, display the detectable range
    }
  }

The two messages you posted (range: 254.0 and range: 22.0) seem to fall outside both if clauses (not between min and max range, and also min == max), leaving displayed_range at 0.0.

I think there is a cone in your RViz, it just has 0 length.

I'm not sure this is your issue, but looking at the documentation of sensor_msgs/Range, the comments on min_range, max_range and range seem to suggest that any value < min_range, or > max_range "should be discarded":

float32 range           # range data [m]
                        # (Note: values < range_min or > range_max
                        # should be discarded)
                        # Fixed distance rangers only output -Inf or +Inf.
                        # -Inf represents a detection within fixed distance.
                        # (Detection too close to the sensor to quantify)
                        # +Inf represents no detection within the fixed distance.
                        # (Object out of range)

The code in rviz/default_plugin/range_display.cpp seems to follow that recommendation (although not explicitly):

  float displayed_range = 0.0;
  if(msg->min_range <= msg->range && msg->range <= msg->max_range)
  {
    displayed_range = msg->range;
  }
  else if(msg->min_range == msg->max_range)  // Fixed distance ranger
  {
    if(msg->range < 0 && !std::isfinite(msg->range))     // NaNs and +Inf return false here: both of those should have 0.0 as the range
    {
      displayed_range = msg->min_range; // -Inf, display the detectable range
    }
  }

The two messages you posted (range: 254.0 and range: 22.0) seem to fall outside both if clauses (not between min and max range, and also min == != max), leaving displayed_range at 0.0.

I think there is a cone in your RViz, it just has 0 length.