Robotics StackExchange | Archived questions

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

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.

Asked by federico.nardi on 2017-12-05 08:52:33 UTC

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.

Asked by chapulina on 2017-12-07 16:41:28 UTC

Any update? I'm trying to do the same, copied your code and got the same weird error.

Asked by felcjo on 2020-04-21 21:10:48 UTC

On first glance, it appears my robot lidar and the grid are reduced for how high the logical_camera joint is raised. Setting the joint's pose to "0 0 0" remove this issue .. I tried making the logical_camera's parent my robot's camera (z=~1), but that caused the same error. The suboptimal solution for me is to keep the logical_camera attached to the base_link

Asked by felcjo on 2020-04-21 21:29:51 UTC

I have a very similar problem when trying to mount a logical camera on a robotic arm. It seems that when you turn off the logical_camera visualization, i.e., false, the problem vanishes.

Asked by vidacs on 2020-12-02 11:34:08 UTC

Answers