Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Adding camera sensor on ROS

Hi people

I am a user of ROS fuerte and I was trying out this tutorial regarding adding camera sensor to a robot. I tried it on the erratic robot,but the camera did not work.

Using Rostopic info, I confirmed that the topic is established but there is no data published to it. Below is the extra code I added to the erratic.urdf.xacro. Please let me know where do I went wrong. Thank you.

<joint name="finger_tip_camera_joint" type="fixed">
  <origin xyz="0 0 0" rpy="0 0 0" />
  <parent link="base_link" />
  <child link="trial_camera_link"/>
</joint>
<link name="trial_camera_link">
  <inertial>
    <mass value="0.01" />
    <origin xyz="0 0 0" />
    <inertia ixx="0.001"  ixy="0.0"  ixz="0.0"
             iyy="0.001"  iyz="0.0"
             izz="0.001" />
  </inertial>
  <visual>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <geometry>
      <box size="0.001 0.001 0.001" />
    </geometry>
  </visual>
  <collision>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <geometry>
      <box size="0.001 0.001 0.001" />
    </geometry>
  </collision>
</link>

 <gazebo reference="trial_camera_link">
  <sensor:camera name="trial_camera_sensor">
    <imageSize>640 480</imageSize>
    <imageFormat>R8G8B8</imageFormat>
    <hfov>90</hfov>
    <nearClip>0.01</nearClip>
    <farClip>100</farClip>
    <updateRate>20.0</updateRate>
    <controller:gazebo_ros_camera name="finger_tip_camera_controller" plugin="libgazebo_ros_camera.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>20.0</updateRate>
      <imageTopicName>trial_cam/image</imageTopicName>
      <frameName>trial_camera_link</frameName>
      <interface:camera name="trial_camera_iface" />
    </controller:gazebo_ros_camera>
  </sensor:camera>
  <turnGravityOff>true</turnGravityOff>
  <material>PR2/Blue</material>
</gazebo>

<joint name="trial_optical_joint" type="fixed">
  <origin xyz="0 0 0" rpy="${-M_PI/2} 0.0 ${-M_PI/2}" />
  <parent link="trial_camera_link" />
  <child link="trial_optical_frame"/>
</joint>
<link name="trial_optical_frame">
  <inertial>
    <mass value="0.01" />
    <origin xyz="0 0 0" />
    <inertia ixx="0.001"  ixy="0.0"  ixz="0.0"
             iyy="0.001"  iyz="0.0"
             izz="0.001" />
  </inertial>
  <visual>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <geometry>
      <box size="0.001 0.001 0.001" />
    </geometry>
  </visual>
  <collision>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <geometry>
      <box size="0.001 0.001 0.001" />
    </geometry>
  </collision>
</link>

I am using Ubuntu 12.04 with ROS fuerte.