ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

IR Range sensor Rviz Issue

asked 2015-09-07 15:38:24 -0600

russellc gravatar image

updated 2015-09-08 07:25:12 -0600

I am having difficulty displaying the range visualization plugin inside of rviz.

I have followed this tutorial:

Furthermore, I have sensor output on the "range_data/range" topic from the arduino with Indigo.

Rviz has a plugin for Range topics listed.

However it appears that when I add the range topic into rviz I encounter an error for the header_frame not matching the fixed_frame. I resolved this by adding a static transform between my fixed frame[map] and my header frame[ir_ranger]; this remedies the plugin error message within rviz however no ir range sensors are shown visually inside rviz. I can not see the IR sensors(cones?) on my map.

Range topic output:

Without any objects:
  seq: 456
    secs: 1441714744
    nsecs: 397090908
  frame_id: /ir_ranger
radiation_type: 1
field_of_view: 0.00999999977648
min_range: 0.0299999993294
max_range: 0.40000000596
range: 254.0
With object:
  seq: 537
    secs: 1441714962
    nsecs: 24221998
  frame_id: /ir_ranger
radiation_type: 1
field_of_view: 0.00999999977648
min_range: 0.0299999993294
max_range: 0.40000000596
range: 22.0
edit retag flag offensive close merge delete


Can you paste a rostopic echo of your sensor output?

Humpelstilzchen gravatar image Humpelstilzchen  ( 2015-09-08 02:33:35 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-09-08 10:08:19 -0600

gvdhoorn gravatar image

updated 2015-09-08 10:16:46 -0600

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.

edit flag offensive delete link more


Thanks gvdhoorn, it was my issue. I modified my range values and it now shows up, albeit not as a 3D cone but as a 2d line emitter(view setting?)...none the less, solved!

russellc gravatar image russellc  ( 2015-09-08 21:23:41 -0600 )edit

Well cone width if based on displayed_range and field_of_view (here), so there might be something not entirely correct with your publisher.

gvdhoorn gravatar image gvdhoorn  ( 2015-09-09 05:36:05 -0600 )edit

Yes, I ended up adjusting my field_of_view setting to compensate for the new values and now I have the cone object emitter. Thanks.

russellc gravatar image russellc  ( 2015-09-09 15:07:43 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-09-07 15:38:24 -0600

Seen: 1,261 times

Last updated: Sep 08 '15