HELP: adding logical_camera sensor to my robot causes strange effect!

asked 2017-12-05 07:52:33 -0600

federico.nardi gravatar image

updated 2017-12-06 03:50:39 -0600

Hi all,

I'm using gazebo 7 to simulate a differential drive robot. Following the ROS tutorials online, I created an urdf file to describe my robot:

If I launch an empty world:

roslaunch gazebo_ros empty_world.launch

and then I spawn the robot with this launch file:

everything goes fine.

image description

Now, I wrote a simple plugin for the logical_camera sensor:

and I try to mount it on the robot by adding these lines to the urdf:

  <!-- LOGICAL CAMERA -->
  <link name="logical_camera_link">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <box size="${camera_size} ${camera_size} ${camera_size}"/>
      </geometry>
    </collision>    
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <box size="${camera_size} ${camera_size} ${camera_size}"/>
      </geometry>
      <material name="red"/>
    </visual>

    <inertial>
      <mass value="1e-5" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
    </inertial>
  </link>


  <!-- LOGICAL CAMERA JOINT -->
  <joint name="logical_camera_joint" type="fixed">
    <axis xyz="0 1 0" />
    <origin xyz="0 0 1.0" rpy="0 0 0"/>
    <parent link="base_link"/>
    <child link="logical_camera_link"/>
  </joint>


  <!-- LOGICAL CAMERA SENSOR -->
  <gazebo reference="logical_camera_link">
      <sensor name="logical_camera" type="logical_camera">
        <plugin name="logical_camera_plugin" filename="liblogical_camera_plugin.so"/>

          <logical_camera>
            <near>0.02</near>
            <far>5.0</far>
            <horizontal_fov>${60.0*M_PI/180.0}</horizontal_fov>
            <aspect_ratio>1.778</aspect_ratio>
          </logical_camera>

          <visualize>true</visualize>
          <always_on>true</always_on>
          <update_rate>10</update_rate>
      </sensor>
  </gazebo>

If I now spawn the robot, this is what happens:

Basically, it seems that the ground plane gets shifted up of one meter.

Can please someone explain me what is happening?

Thanks.

edit retag flag offensive close merge delete

Comments

Woah! Does the ground plane pose change on the left panel? How about the model pose and the GUI camera pose? Interestingly the world origin visuals seem to move up, but the grid stays below.

chapulina gravatar imagechapulina ( 2017-12-07 15:41:28 -0600 )edit