Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of range become nan instead of inf. #61

Closed
TeerapongPoom opened this issue Mar 25, 2022 · 2 comments · May be fixed by #67
Closed

Out of range become nan instead of inf. #61

TeerapongPoom opened this issue Mar 25, 2022 · 2 comments · May be fixed by #67

Comments

@TeerapongPoom
Copy link

I read in the wiki https://wiki.ros.org/depthimage_to_laserscan and it says ranges less than range_min will be output as -Inf and +Inf for range_max.
When I try with range_min=0.3 and range_max=4.0, all values not in range become nan. Here is message from rostopic echo https://drive.google.com/file/d/1YSh61ATBp4Xuy6y_YcDfNicW1LBbvW1E/view?usp=sharing

But this is the result after I increase range_max to range_max=10.0
https://drive.google.com/file/d/1Vnczgholi2ksoAOVkHGeTYrr4JSMgLlA/view?usp=sharing

My sensor is realsense d455 and depth image encoding is 16UC1.
ROS distro in noetic. This is how i call node in launch file.

<node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="depthimage_to_laserscan">
  <remap from="image"       to="/camera/depth/image_rect_raw"/>
  <remap from="camera_info" to="/camera/depth/camera_info"/>
  <remap from="scan"        to="/depth_scan"/>
  <param name="range_max" type="double" value="4.0"/>
  <param name="range_min" type="double" value="0.3"/>
  <param name="output_frame_id" type="string" value="camera_link"/>
</node>
@TeerapongPoom
Copy link
Author

nvm. I just add

if(r > scan_msg->range_max){
  scan_msg->ranges[index] = std::numeric_limits<float>::infinity();
}

to line 208 in DepthImageToLaserScan.h and it works now.

@nakai-omer
Copy link

@TeerapongPoom This is an important bug, that breaks costmaps in nav2. I think it should be reopened so it will be fixed for everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants