Handle Nan values from depthimag_to_laser
Ros: kinetic
I'm using depthimage_to laser package and facing problem with obstacles too close to the robot or too far as I only get Nan values .
how can I handle nan values ? is there is a way to get -inf when robot too close to obstacles or +inf when robot too far in place of Nan, as it mentioned in the link http://wiki.ros.org/depthimage_to_laserscan ?
Nan values creating problem in the logic of my code.
I tried different Ranges for Min And max range but I always get Nan of course in case I'm too far or too close . I want to get -/+ inf in case I'm too far or too close
Camera URDF:-
<link name="camera_link"> <visual> <origin xyz="0.0 0.0 0.004" rpy="0 0 0"/> <geometry> <mesh filename="package://evarobotmodel_description/meshes/kinect.dae" scale="0.9 0.9 0.9"/> </geometry> </visual> <collision> <origin xyz="0.0 0.0 0.0" rpy="0 0 0" /> <geometry> <box size="0.0730 0.2760 0.0720"/> </geometry> </collision> <inertial> <mass value="0.170" /> <origin xyz="0 0 0" /> <inertia ixx="0.001152600" ixy="0.0" ixz="0.0" iyy="0.000148934" iyz="0.0" izz="0.001154654" /> </inertial> </link> <joint name="camera_rgb_joint" type="fixed"> <origin xyz="0.0 -0.02 0.0" rpy="0.0 0.0 0.0"/> <parent link="camera_link"/> <child link="camera_rgb_frame" /> </joint> <gazebo reference="camera_link"> <material>Gazebo/FlatBlack</material> </gazebo> <link name="camera_rgb_frame"/> <joint name="camera_rgb_optical_joint" type="fixed"> <origin xyz="0 0 0" rpy="-1.57079632679 0 -1.57079632679" /> <parent link="camera_rgb_frame" /> <child link="camera_rgb_optical_frame" /> </joint> <link name="camera_rgb_optical_frame"/> <joint name="camera_joint" type="fixed"> <origin xyz="0.17 0.0 0.1913" rpy="0.0 0.0 0.0"/> <parent link="base_link"/> <child link="camera_link"/> </joint> <joint name="camera_depth_joint" type="fixed"> <origin xyz="0 -0.045 0" rpy="0 0 0" /> <parent link="camera_link" /> <child link="camera_depth_frame" /> </joint> <link name="camera_depth_frame"/> <joint name="camera_depth_optical_joint" type="fixed"> <origin xyz="0 0 0" rpy="-1.57079632679 0 -1.57079632679" /> <parent link="camera_depth_frame" /> <child link="camera_depth_optical_frame" /> </joint> <link name="camera_depth_optical_frame"/> <!-- Asus mount --> <joint name="mount_asus_xtion_pro_joint" type="fixed"> <origin xyz="0.1685 -0.0050 0.1563" rpy="1.57079632679 0 -1.57079632679"/> <parent link="base_link"/> <child link="mount_asus_xtion_pro_link"/> </joint> <link name="mount_asus_xtion_pro_link"> <!-- <visual> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <mesh filename="package://evarobotmodel_description/meshes/asus_base.dae"/> </geometry> <material name="Black"/> </visual> --> <collision> <origin xyz="0.0 0.0 0.0" rpy="0 0 0" /> <geometry> <box size="0.2760 0.0330 0.0120"/> </geometry> </collision> <inertial> <mass value="0.170" /> <origin xyz="0 0 0" /> <inertia ixx="0.001152600" ixy="0.0" ixz="0.0" iyy="0.000148934" iyz="0.0" izz="0.001154654" /> </inertial> </link> <gazebo reference="mount_asus_xtion_pro_link"> <material>Gazebo/FlatBlack</material> </gazebo> <gazebo reference="camera_link"> <sensor type="depth" name="camera"> <visualize>true</visualize> <always_on>true</always_on> <update_rate>20.0</update_rate> <camera> <horizontal_fov>1.0471975512</horizontal_fov> <image> <format>R8G8B8</format> <width>640</width> <height>480</height> </image> <clip> <near>0.05</near> <far>8.0</far> </clip> </camera> <plugin name="kinect_camera_controller" filename="libgazebo_ros_openni_kinect.so"> <visualize>true</visualize> <robotNamespace>/</robotNamespace> <cameraName>camera</cameraName> <alwaysOn>true</alwaysOn> <updateRate>10</updateRate> <imageTopicName>rgb/image_raw</imageTopicName> <depthImageTopicName>depth/image_raw</depthImageTopicName> <pointCloudTopicName>depth/points</pointCloudTopicName> <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName> <depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName> <frameName>camera_depth_optical_frame</frameName> <baseline>0.1</baseline> <pointCloudCutoff>0.4</pointCloudCutoff> <distortionK1>0.00000001</distortionK1> <distortionK2>0.00000001</distortionK2> <distortionK3>0.00000001</distortionK3> <distortionT1>0.00000001</distortionT1> <distortionT2>0.00000001</distortionT2> <CxPrime>0</CxPrime> <Cx>0</Cx> <Cy>0</Cy> <focalLength>0</focalLength> <hackBaseline>0</hackBaseline> </plugin> </sensor> </gazebo>
depth to laser launch file :-
<?xml version="1.0"?>
<node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="depthimage_to_laserscan">
<param name="scan_height" value="3"/>
<param name="range_min" value="0.45"/>
<param name="range_max" value="8.0"/>
<param name="output_frame_id" value="base_link"/>
<remap from="image" to="/camera/depth/image_raw"/>
<remap from="scan" to="depth_scan"/>
<remap from="camera_info" to="/camera/depth/camera_info"/>
</node>
</launch>
Asked by q8wwe on 2020-03-21 10:37:01 UTC
Comments
the wiki page you link appears to suggest you can get this behaviour by providing proper values for the
range_min
andrange_max
private parameters.Asked by gvdhoorn on 2020-03-23 05:22:11 UTC
I tried to change the values for range_min and range_mix but i always get Nan values .
did you ever get -/+inf when working with depthiamge_to_laser ?
Asked by q8wwe on 2020-03-23 08:11:34 UTC
Just making sure: those are private parameters. Have you configured them correctly?
Please show a launch file or set of commands you've used.
And we're assuming the input image doesn't contain those
NaN
s already.Asked by gvdhoorn on 2020-03-23 08:29:39 UTC
I added my camera URDF file and depth to lase launch file .
Asked by q8wwe on 2020-03-23 08:54:31 UTC