ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to use libgazebo_ros_camera.so in gazebo (urdf)

asked 2013-04-28 10:36:29 -0500

davinci gravatar image

updated 2013-04-28 10:48:25 -0500

I was using a .model file in gazebo with a libgazebo_ros_camera.so camera. But for the PR2 controllers I needed to switch to urdf file. I am now using the libgazebo_ros_prosilica.so camera. But the performance of the tracking of markers using ar_pose seems worse. Therefore I want to try the libgazebo one again. But I cannot get a good urdf description of it. How can I convert this model code to urdf syntax?

 <sensor name='camera' type='camera' always_on='1' update_rate='30' visualize='true'>
        <camera>
          <horizontal_fov angle='1.57079633'/>
          <image width='640' height='480' format='R8G8B8'/>
          <clip near='0.1' far='100'/>
        </camera>
        <plugin name="camera_plugin" filename="libgazebo_ros_camera.so">
            <alwaysOn>true</alwaysOn>
            <imageTopicName>image_raw</imageTopicName>
            <cameraInfoTopicName>camera_info</cameraInfoTopicName>
            <updateRate>30.0</updateRate>
            <cameraName>usb_cam</cameraName>
            <frameName>/robot_camera_link</frameName>
            <CxPrime>320.5</CxPrime>
            <Cx>320.5</Cx>
            <Cy>240.5</Cy>
            <hackBaseline>0</hackBaseline>
            <focalLength>320.000101</focalLength>
            <distortionK1>0.0</distortionK1>
            <distortionK2>0.0</distortionK2>
            <distortionK3>0.0</distortionK3>
            <distortionT1>0.0</distortionT1>
            <distortionT2>0.0</distortionT2>
        </plugin>
      </sensor>
edit retag flag offensive close merge delete

Comments

hey. Did you solve your issue? I am looking for a camera plugin that could publish pointcloud2, and I used the depth_camera plugin instead. Please update on your problem; which might be solve my problem.Thank you

Gazer gravatar image Gazer  ( 2013-07-03 08:37:45 -0500 )edit

I use the description like the one below with libgazebo_ros_prosilica.so instead of libgazebo_ros_camera. But it is not a depth camera.

davinci gravatar image davinci  ( 2013-07-03 10:16:18 -0500 )edit

could I ask you, what is that <CxPrime> means?

Gazer gravatar image Gazer  ( 2013-07-03 14:21:43 -0500 )edit

CxPrime is an intrisic parameter of the camera. Not sure what it stands for, cx is the distance to the optical center.

davinci gravatar image davinci  ( 2013-07-03 22:40:52 -0500 )edit

3 Answers

Sort by » oldest newest most voted
2

answered 2013-04-29 23:12:25 -0500

I can't find any reference to the gazebo_ros_camera plugin in more recent URDFs; however, there are some old ones around like this one, where the camera block looks like this:

<gazebo reference="wide_stereo_gazebo_l_stereo_camera_frame">
  <sensor:camera name="wide_stereo_gazebo_l_stereo_camera_sensor">
    <imageSize>640 480</imageSize>
    <imageFormat>BAYER_BGGR8</imageFormat>
    <hfov>90</hfov>
    <nearClip>0.1</nearClip>
    <farClip>100</farClip>
    <updateRate>25.0</updateRate>
    <controller:gazebo_ros_camera name="wide_stereo_gazebo_l_stereo_camera_controller" plugin="libgazebo_ros_camera.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>25.0</updateRate>
      <imageTopicName>wide_stereo/left/image_raw</imageTopicName>
      <cameraInfoTopicName>wide_stereo/left/camera_info</cameraInfoTopicName>
      <frameName>wide_stereo_optical_frame</frameName>
      <hackBaseline>0</hackBaseline>
      <CxPrime>320.5</CxPrime>
      <Cx>320.5</Cx>
      <Cy>240.5</Cy>
      <!-- image_width / (2*tan(hfov_radian /2)) -->
      <!-- 320 for wide and 772.55 for narrow stereo camera -->
      <focal_length>320</focal_length>
      <distortion_k1>0.00000001</distortion_k1>
      <distortion_k2>0.00000001</distortion_k2>
      <distortion_k3>0.00000001</distortion_k3>
      <distortion_t1>0.00000001</distortion_t1>
      <distortion_t2>0.00000001</distortion_t2>
      <interface:camera name="wide_stereo_gazebo_l_stereo_camera_iface"/>
    </controller:gazebo_ros_camera>
  </sensor:camera>
  <turnGravityOff>true</turnGravityOff>
  <material>PR2/Blue</material>
</gazebo>
edit flag offensive delete link more

Comments

Thanks for your response! I tried this but there are no images published unfortunately. Do you know other camera implementations than the proscilla and this?

davinci gravatar image davinci  ( 2013-04-30 10:51:55 -0500 )edit

Sorry, I don't know of any other implementations. Seems like the gazebo_ros_camera plugin is outdated. Maybe someone else knows a better alternative?

Martin Günther gravatar image Martin Günther  ( 2013-05-02 04:49:48 -0500 )edit

hey. What is that CxPrime means. Also, does this plugin publishes pointcloud 2?

Gazer gravatar image Gazer  ( 2013-07-03 08:36:36 -0500 )edit
2

answered 2013-09-06 00:00:30 -0500

micpalmia gravatar image

updated 2013-09-06 00:03:29 -0500

There is an extensive tutorial article on the Gazebo wiki about a lot of different sensors plugins, including libgazebo_ros_camera.so, you might want to give a look there. Sorry for the broken link but there seems to be a rule about needing 'karma' to post links. Didn't help enough old ladies crossing the strees lately.

gazebosim.org/wiki/Tutorials/1.9/ROS_Motor_and_Sensor_Plugins

Here is the use for the camera plugin proposed there

 <!-- camera -->
  <gazebo reference="camera_link">
    <sensor type="camera" name="camera1">
      <update_rate>30.0</update_rate>
      <camera name="head">
        <horizontal_fov>1.3962634</horizontal_fov>
        <image>
          <width>800</width>
          <height>800</height>
          <format>R8G8B8</format>
        </image>
        <clip>
          <near>0.02</near>
          <far>300</far>
        </clip>
        <noise>
          <type>gaussian</type>
          <!-- Noise is sampled independently per pixel on each frame.  
               That pixel's noise value is added to each of its color
               channels, which at that point lie in the range [0,1]. -->
          <mean>0.0</mean>
          <stddev>0.007</stddev>
        </noise>
      </camera>
      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>0.0</updateRate>
        <cameraName>rrbot/camera1</cameraName>
        <imageTopicName>image_raw</imageTopicName>
        <cameraInfoTopicName>camera_info</cameraInfoTopicName>
        <frameName>camera_link</frameName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>
edit flag offensive delete link more
1

answered 2013-07-10 05:23:17 -0500

agonzamart gravatar image

updated 2013-07-10 12:30:12 -0500

I am using libDepthCameraPlugin.so and libgazebo_ros_openni_kinect.so and I am able to publish images from this camera. My .sdf looks like this:

< sensor type="depth" name="camera1">

   <always_on>1</always_on>
   <visualize>true</visualize>
    <update_rate>30.0</update_rate>
    <topic>camera</topic>
    <camera name="depth_cam">
         <horizontal_fov>1.3962634</horizontal_fov>
        <image>
            <width>800</width>
             <height>800</height>
            <format>R8G8B8</format>
         </image>
        <clip>
            <near>0.02</near>
            <far>300</far>
        </clip>
        <noise>
             <type>gaussian</type>
                <!-- Noise is sampled independently per pixel on each frame.  
                That pixel's noise value is added to each of its color
                channels, which at that point lie in the range [0,1]. -->
            <mean>0.0</mean>
            <stddev>0.007</stddev>
         </noise>
        <save enabled=true>  <!-- Nose que es esto -->
            <path>Gazebo_camera</path>
        </save>
  </camera>
  <plugin name="camera_controller" filename="libDepthCameraPlugin.so">
    <CxPrime>0</CxPrime>
    <updateRate>10.0</updateRate>
    <cameraName>depth_cam1</cameraName>
    <frameName>/base_link</frameName>
    <hackBaseline>0.07</hackBaseline>
    <distortionK1>1.0</distortionK1>
    <distortionK2>1.0</distortionK2>
    <distortionK3>1.0</distortionK3>
    <distortionT1>1.0</distortionT1>
    <distortionT2>1.0</distortionT2>
  </plugin>
 <plugin name="kinect" filename="libgazebo_ros_openni_kinect.so">
    <CxPrime>0</CxPrime>
    <updateRate>10.0</updateRate>
    <imageTopicName>image_raw</imageTopicName>
    <pointCloudTopicName>points</pointCloudTopicName>
    <depthImageTopicName>image_depth</depthImageTopicName>
    <depthImageCameraInfoTopicName>depth_camera_info</depthImageCameraInfoTopicName>
    <pointCloudCutoff>0.001</pointCloudCutoff>
    <cameraName>kinect</cameraName>
    <frameName>/base_link</frameName>
    <distortionK1>0.00000001</distortionK1>
    <distortionK2>0.00000001</distortionK2>
    <distortionK3>0.00000001</distortionK3>
    <distortionT1>0.00000001</distortionT1>
    <distortionT2>0.00000001</distortionT2>
  </plugin>
</sensor>
</link>

Hope this helps! But I have a problem with the frames time stamp and I can not do much with this camera image right know, I am looking for the solution: http://answers.ros.org/question/66800/tf-transformation-for-simulated-kinect-gazebo/

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-04-28 10:36:29 -0500

Seen: 13,243 times

Last updated: Sep 06 '13