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

Revision history [back]

click to hide/show revision 1
initial version

You can look at the pr2 description in the pr2_description package. They have some urdf and xacro files for describing cameras. You'd want to use the prosilica_gc2450 files for a single camera (the wge100 is for stereo I believe). My camera configuration looks like this:

 <gazebo reference="${name}_head">
    <sensor:camera name="${name}_sensor">
        <imageFormat>R8G8B8</imageFormat>
        <imageSize>704 480</imageSize>
        <hfov>45</hfov>
        <nearClip>0.1</nearClip>
        <farClip>100</farClip>
        <updateRate>20.0</updateRate>
        <controller:gazebo_ros_prosilica name="${name}_controller" plugin="libgazebo_ros_prosilica.so">
            <alwaysOn>true</alwaysOn>
            <updateRate>20.0</updateRate>
            <imageTopicName>/ptz/image_raw</imageTopicName>
            <cameraInfoTopicName>/ptz/camera_info</cameraInfoTopicName>
            <pollServiceName>/ptz/request_image</pollServiceName>
            <frameName>${name}_head</frameName>
            <CxPrime>1224.5</CxPrime>
            <Cx>1224.5</Cx>
            <Cy>1025.5</Cy>
            <focal_length>2955</focal_length>
            <distortion_k1>0.0</distortion_k1>
            <distortion_k2>0.0</distortion_k2>
            <distortion_k3>0.0</distortion_k3>
            <distortion_t1>0.0</distortion_t1>
            <distortion_t2>0.0</distortion_t2>
            <interface:camera name="${name}_iface" />
        </controller:gazebo_ros_prosilica>
    </sensor:camera>
</gazebo>

As far as making it move, that's a little more complicated. If you're just looking to make it pan/tilt in place, that's not so bad. But if you're looking to move it around on the robot, that's not going to be as easy.

If you want to make a pan/tile camera, you could model the camera much like the pr2's head, but with only a single camera. You can see how they set up two joint controllers using the pr2_controllers stack to manipulate them. I wrote a teleop program, modeled after the pr2's teleop node that publishes to my camera joint controllers. This enables me to quickly adjust the camera as I see fit.

If you're trying to make the camera change its position on the robot's frame, then you'd have to experiment with some slider joints and some more joint controllers.