Correct output for a fixed range sensor in sensor_msgs/msg/Range

asked 2022-06-06 00:53:34 -0600

PunitivePeak13 gravatar image

Hello,

I am trying to add a /Range message to my robot to use with RangeSensorLayer in nav2. For this, I am using a fixed range sensor which outputs a range of 1 or 0 (HIGH or LOW). Per http://docs.ros.org/en/api/sensor_msg... it seems such sensors can be used with the /Range message. But what I am confused with is the line "# Fixed distance rangers only output -Inf or +Inf.". Similarly, this is also mentioned in the nav2 range_sensor_layer.cpp: https://github.com/ros-planning/navig...

So, my question is, do I need to change the range from 1 and 0 to +Inf and -Inf or I could just leave it as is and the nav2 RangeSensorLayer should work fine still?

I also noticed how the "sensor_msgs/msg/Range" says "+Inf" while range_sensor_layer.cpp says "Inf". Even though both are pretty much positive, I am not sure if not having the sign makes any difference in this instance.

The following is the output of my /Range topic as of now. Hopefully it gives an idea of my current range publisher:

---
header:
  stamp:
    sec: 1654490483
    nanosec: 897000000
  frame_id: /base_link
radiation_type: 1
field_of_view: 0.25
min_range: 0.019999999552965164
max_range: 0.019999999552965164
range: 0.0
---
header:
  stamp:
    sec: 1654490483
    nanosec: 929000000
  frame_id: /base_link
radiation_type: 1
field_of_view: 0.25
min_range: 0.019999999552965164
max_range: 0.019999999552965164
range: 1.0
---

Thank you in advance!

Edited to add /Range topic output as code rather than link to 3rd party website.

edit retag flag offensive close merge delete