0
$\begingroup$

Rosanswers logo

hi all.

i using ubuntu 12.04 with ros-fuerte

i trying to connect a camera sensor to a car urdf model that i created. i follow the example on http://ros.org/wiki/urdf/Tutorials/AddingSensorsToPR2.

this is the relevant part of my urdf (xacro) model :

<joint name="camera_joint" type="fixed">
  <origin xyz="${chassis_length/2} 0 ${chassis_hight/2}" rpy="0 0 0" />
  <parent link="base_link" />
  <child link="camera_link"/>
</joint>

<link name="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="dany_car_camera">
 <sensor:camera name="dany_car_camera">
    <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="camera_controller" plugin="libgazebo_ros_camera.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>20.0</updateRate>
      <imageTopicName>dany_car_camera/image</imageTopicName>
      <frameName>camera_link</frameName>
      <interface:camera name="dany_car_camera_iface"/>
    </controller:gazebo_ros_camera>
 </sensor:camera>
  <turnGravityOff>false</turnGravityOff>
  <material>Gazebo/Red</material>
</gazebo>

when i roslaunch empty_world.launch and my launch file

i get no errors about the camera. the simulation loads and runs correctly. but when i try to view the camera window by commanding

$ rosrun image_view image_view image:=dany_car_camera/image

i get an empty window.

pleas help me found my mistake. tanks.


Originally posted by dmeltz on ROS Answers with karma: 192 on 2012-08-11

Post score: 1


Original comments

Comment by SL Remy on 2012-08-12:
What is the result of a rostopic list btw?

Comment by joq on 2012-08-13:
Also, rostopic hz is useful to check whether anything is being published.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I found my mistake :

the reference field must be equal to the link name on which the sensor (in this case camera) is positioned. here the correct code :

<!-- CAMERA : joint , link , sensor  -->
  <joint name="yuval_camera_joint" type="fixed">
    <origin rpy="0 0 0" xyz="0.5 0 0.1"/>
    <parent link="base_link"/>
    <child link="camera_link"/>
  </joint> 
 <link name="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.1 0.1 0.1" />
        </geometry>
        <material name="red"/>
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <box size="0.1 0.1 0.1" />
        </geometry>
      </collision>
    </link>
 <gazebo reference="camera_link">
    <sensor:camera name="dany_car_camera_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="dany_car_CAMERA_controller" plugin="libgazebo_ros_prosilica.so">
            <cameraName>dany_car_camera_sensor</cameraName>
            <alwaysOn>true</alwaysOn>
            <updateRate>20.0</updateRate>
            <imageTopicName>/dany_car_sensors/camera/image_raw</imageTopicName>
            <cameraInfoTopicName>/dany_car_sensors/camera/camera_info</cameraInfoTopicName>
            <pollServiceName>/dany_car_sensors/camera/request_image</pollServiceName>
            <frameName>camera_link</frameName>
            <CxPrime>1224.5</CxPrime>
            <Cx>1224.5</Cx>
            <Cy>1025.5</Cy>    
            <focalLength>849.803363</focalLength>  <!--   focal_length = width_ / (2.0 * tan( HFOV/2.0 )) --> 
           <hackBaseline>0.0</hackBaseline>
           <distortionK1>0.0</distortionK1>
           <distortionK2>0.0</distortionK2>
           <distortionK3>0.0</distortionK3>
           <distortionT1>0.0</distortionT1>
           <distortionT2>0.0</distortionT2>
            <interface:camera name="dany_car_camera_iface" />
        </controller:gazebo_ros_prosilica>
    </sensor:camera>
    <turnGravityOff>false</turnGravityOff>
    <material>Gazebo/Red</material>
</gazebo>

Originally posted by dmeltz with karma: 192 on 2012-12-12

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.