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

Adding thermal camera plugin to the robot description in another package

asked 2016-05-31 10:00:52 -0500

RSA_kustar gravatar image

I want to use the thermal camera in my robot. I have 3 pcks : the first package that has the launch file where I it looks from the second pkg for the robot discreption that uses the plugins or the sensor from the third packgae.

I did the following: In package 3: I downloaded the package hector_gazebo from this link https://github.com/tu-darmstadt-ros-p...

In package 2:

I have the file1.xacro file that has all the sensors that the robot has and I added the following sensor

 <robot xmlns:xacro="http://ros.org/wiki/xacro"> 

 <!-- here are all the plugins and the other sensors like the cameras, imu and the depth cameras and all other macros --> 
 <!-- thermal -->
<xacro:macro name="thermal_camera"
params="namespace parent_link camera_suffix frame_rate
  horizontal_fov image_width image_height image_format min_distance
  max_distance noise_mean noise_stddev enable_visual *geometry *origin">
<link name="${namespace}/camera_${camera_suffix}_link">
  <collision>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <geometry>
      <xacro:insert_block name="geometry" />
    </geometry>
  </collision>
  <xacro:if value="${enable_visual}">
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <xacro:insert_block name="geometry" />
      </geometry>
      <material name="red" />
    </visual>
  </xacro:if>
  <inertial>
    <mass value="1e-5" />
    <origin xyz="0 0 0" rpy="0 0 0" />
    <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
  </inertial>
</link>
<joint name="${namespace}/camera_${camera_suffix}_joint" type="fixed">
  <xacro:insert_block name="origin" />
  <parent link="${parent_link}" />
  <child link="${namespace}/camera_${camera_suffix}_link" />
</joint>
<gazebo reference="${namespace}/camera_${camera_suffix}_link">
  <sensor type="camera" name="${namespace}_camera_${camera_suffix}">
    <update_rate>${frame_rate}</update_rate>
    <camera name="head">
      <horizontal_fov>${horizontal_fov}</horizontal_fov>
      <image>
        <width>${image_width}</width>
        <height>${image_height}</height>
        <format>${image_format}</format>
      </image>
      <clip>
        <near>${min_distance}</near>
        <far>${max_distance}</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>${noise_mean}</mean>
        <stddev>${noise_stddev}</stddev>
      </noise>
    </camera>
    <plugin name="thermal_camera_controller" filename="libgazebo_ros_thermal_depth_camera.so">
      <robotNamespace>${namespace}</robotNamespace>
      <alwaysOn>true</alwaysOn>
      <updateRate>${frame_rate}</updateRate>
      <cameraName>camera_${camera_suffix}</cameraName>
      <imageTopicName>image_raw</imageTopicName>
      <cameraInfoTopicName>camera_info</cameraInfoTopicName>
      <frameName>camera_${camera_suffix}_link</frameName>
      <hackBaseline>0.0</hackBaseline>
      <distortionK1>0.0</distortionK1>
      <distortionK2>0.0</distortionK2>
      <distortionK3>0.0</distortionK3>
      <distortionT1>0.0</distortionT1>
      <distortionT2>0.0</distortionT2>
    </plugin>
  </sensor>
</gazebo>

</xacro:macro> </robot>

I run the following command: rosrun xacro xacro.py file1.xacro the output was the following: <-- <robot xmlns:xacro="http://ros.org/wiki/xacro"> </robot>

I edited the pkg.xml in package 2 file to be the following :

<package>
<name>robot_description</name>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>hector_gazebo_thermal_camera</build_depend>
<run_depend>hector_gazebo_thermal_camera</run_depend>
</package>

I also modified the Cmake.list file in package 2 like the following:

cmake_minimum_required(VERSION 2.8.3)
project(robot_description)
find_package(catkin REQUIRED COMPONENTS hector_gazebo_thermal_camera)
catkin_package() 
find_package(gazebo REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories(${GAZEBO_LIBRARY_DIRS})
## Find Boost
find_package(Boost REQUIRED COMPONENTS thread)
include_directories(${Boost_INCLUDE_DIRS})
install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY meshes DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY urdf DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})

then I added the following ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-06-01 01:25:03 -0500

You can find a comprehensive example of a robot equipped with the a simulated thermal camera here: tracker_default.urdf.xacro.

There, the flir_a35_camera macro is used.

You can install a complete working workspace with which allows spawning the robot in Gazebo as described in hector_tracker_install.

From this example you should be able to look up everything you're interested in. It looks like the error you're getting is related to your launch file setup, possibly in your spawn_robot.launch file.

edit flag offensive delete link more

Comments

Thank you it worked with me. I downloaded the package and added the required tags from the tracker_default.urdf.xacro file and it worked.

RSA_kustar gravatar image RSA_kustar  ( 2016-06-04 11:03:14 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-05-31 10:00:52 -0500

Seen: 856 times

Last updated: Jun 01 '16