Robotics StackExchange | Archived questions

How to publish ROS tf transforamtions by using a plugin in a SDF file

Hi

Is there a simple way to publish a tf based on a joint defined in a SDF file. e.g.: I like to get the location of the hokuyo relative to the robot's chassis and I don't want to use a static publisher node. Greetings:

<?xml version='1.0'?>
<sdf version='1.4'>
  <model name="pioneer2dx_v4r">
    <include>
      <uri>model://pioneer2dx_ros</uri>
      <pose>0 0 0 0 0 0</pose>
    </include>
    <include>
      <uri>model://hokuyo_ros</uri>
      <pose>0.25 0 0.1 0 0 0</pose>
    </include>
    <joint name="hokuyo_joint" type="revolute">
      <child>hokuyo::link</child>
      <parent>pioneer2dx::chassis</parent>
      <axis>
        <xyz>0 0 1</xyz>
        <limit>
          <upper>0</upper>
          <lower>0</lower>
        </limit>
      </axis>
    </joint>
  </model>
</sdf>

Asked by Markus Bader on 2013-09-13 07:58:47 UTC

Comments

Answers

You could write a Gazebo plugin for your hokuyo that publishes tf messages. Make a ModelPlugin that updates every iteration. That plugin can get the pose of the model, and then publish it.

Here is an example ModelPlugin: https://bitbucket.org/osrf/gazebo/src/90e970a82d2944491430a0061d8aaa10a3ab20d7/plugins/VehiclePlugin.hh?at=default

Here is an example plugin that connects to ROS: https://bitbucket.org/osrf/drcsim/src/1bd6dd0488ccda910866b13c544bfa31eaede523/ros/atlas_msgs/VRCPlugin.cpp?at=default

Asked by nkoenig on 2013-09-14 20:15:38 UTC

Comments