Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

Thermal Camera Plugin not defined in SDF error

I'm trying to use the hector_gazebo_thermal_camera in a simulation for my graduation project. It returns the error:

Warning [parser.cc:778] XML Element[sensor:camera], child of element[link] not defined in SDF. Ignoring[sensor:camera]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.

I've made a simple code only with the camera and the plugin in order to validate the plugin:

This is the urdf.xacro file:

<?xml version="1.0" ?>
<robot name="robo_teste" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:property name="M_PI" value="3.141592" />
<xacro:include filename="$(find teste_thermal_cam)/urdf/model_test.gazebo.xacro" />
 <link name="my_box">
<inertial>
  <origin xyz="2 0 0" rpy = " ${-M_PI/2} 0 0"/>
  <mass value="1.0" />
  <inertia  ixx="1.0" ixy="0.0"  ixz="0.0"  iyy="100.0"  iyz="0.0"  izz="1.0" />
</inertial>
<visual>
  <origin xyz="0 0 0"/>
  <geometry>
    <box size=".1 .1 .2" />
  </geometry>
</visual>
<collision>
  <origin xyz="2 0 1"/>
  <geometry>
    <box size=".1 .1 .2" />
  </geometry>
</collision>
</link>
<gazebo reference="my_box">
<material>Gazebo/Blue</material>
</gazebo>

<link name="flir_camera">
<visual>
    <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
            <mesh filename="package://mybot_description/meshes/LeptonBreakoutBoardWithLepton3.stl" scale="0.001 0.001 0.001"/>
        </geometry>
        <material name="light_grey">
            <color rgba="0.8 0.8 0.8 0.8"/>
        </material>
    </visual>
</link>
<joint name="flir_camera_joint" type="fixed">
    <parent link="my_box"/>
    <child link="flir_camera"/>
<origin rpy="0 ${-M_PI/2} 0" xyz="-0.05 0.0 0.00"/>
</joint>
</robot>

and this is the .gazebo.xacro file that contains the plugin:

<?xml version="1.0" ?>
  <robot name="test_robot" xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
   xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
   xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
   xmlns:xacro="http://playerstage.sourceforge.net/gazebo/xmlschema/#xacro">

  <xacro:macro name="thermal_camera_gazebo_v0" params="name camera_name image_format image_topic_name camera_info_topic_name hfov update_rate focal_length frame_id hack_baseline image_width image_height">
<gazebo reference="my_box">
  <sensor:camera name="${name}_sensor">
    <imageSize>${image_width} ${image_height}</imageSize>
    <imageFormat>${image_format}</imageFormat>
    <hfov>${hfov}</hfov>
    <!--<nearClip>0.1</nearClip>-->
    <nearClip>0.01</nearClip>
    <farClip>100</farClip>
    <updateRate>${update_rate}</updateRate>
    <controller:gazebo_ros_thermal_camera name="${name}_controller" plugin="libgazebo_ros_thermal_depth_camera.so">
      <alwaysOn>true</alwaysOn>
      <updateRate>${update_rate}</updateRate>
      <cameraName>${camera_name}</cameraName>
      <imageTopicName>${image_topic_name}</imageTopicName>
      <cameraInfoTopicName>${camera_info_topic_name}</cameraInfoTopicName>
      <frameName>${frame_id}</frameName>
      <hackBaseline>${hack_baseline}</hackBaseline>
      <CxPrime>${(image_width+1)/2}</CxPrime>
      <Cx>${(image_width+1)/2}</Cx>
      <Cy>${(image_height+1)/2}</Cy>
      <!-- image_width / (2*tan(hfov_radian /2)) -->
      <!-- 320 for wide and 772.55 for narrow stereo camera -->
      <focalLength>${focal_length}</focalLength>
      <distortionK1>0.00000001</distortionK1>
      <distortionK2>0.00000001</distortionK2>
      <distortionK3>0.00000001</distortionK3>
      <distortionT1>0.00000001</distortionT1>
      <distortionT2>0.00000001</distortionT2>
      <interface:camera name="${name}_iface" />
    </controller:gazebo_ros_thermal_camera>
  </sensor:camera>
  <turnGravityOff>true</turnGravityOff>
  <material>Gazebo/Blue</material>
</gazebo>
</xacro:macro>
<xacro:thermal_camera_gazebo_v0 name="flir_camera" camera_name="flir_camera" image_format='R8G8B8' image_topic_name="thermal" camera_info_topic_name='detection/flir' hfov='90' update_rate='30' focal_length='320' frame_id='thermal_cam_optical_frame' hack_baseline='0' image_width ='640' image_height='480'/>

</robot>

I'm using ros Kinetic and Gazebo 7 , i've found on github some projects that uses this thermal camera, and I took them as base , the race_pr2 but they are only on ros indigo. And i don't use aditional paramaters to my launch file:

<param name="robot_description" command="$(find xacro)/xacro --check-order $(find teste_thermal_cam)/urdf/model_test.urdf.xacro " />

I already know that some arguments changed in the sdf definitions, and have already used another plugins like stereo camera and the hector sonar plugins.