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

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_not_god">
    <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>

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_not_god">
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>