Handle Nan values from depthimag_to_laser

asked 2020-03-21 10:37:01 -0500

q8wwe gravatar image

updated 2020-03-23 08:53:55 -0500

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_las... ?

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 ...
(more)
edit retag flag offensive close merge delete

Comments

Is there is a way to get -inf when robot too close to obstacles or +inf when robot too far in place of Nan,

the wiki page you link appears to suggest you can get this behaviour by providing proper values for the range_min and range_max private parameters.

gvdhoorn gravatar image gvdhoorn  ( 2020-03-23 05:22:11 -0500 )edit

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 ?

q8wwe gravatar image q8wwe  ( 2020-03-23 08:11:34 -0500 )edit

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 NaNs already.

gvdhoorn gravatar image gvdhoorn  ( 2020-03-23 08:29:39 -0500 )edit

I added my camera URDF file and depth to lase launch file .

q8wwe gravatar image q8wwe  ( 2020-03-23 08:54:31 -0500 )edit