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

Changing tf_prefix for a gazebo plugin?

asked 2016-02-18 17:26:30 -0600

nbeyers gravatar image

Hello all,

I'm working on a gazebo simulation for multiple husky robots and I'm running into some problems with my tf tree. To set up the simulation, I'm launching each robot in a unique namespace with a matching tf prefix. This works great for separating out ROS topics and most of the transforms, however, I'm having issues with the plugins for my odometry and IMU. The issues I'm having seem to be because the frame_id of the plugins called from the .xacro file do not inherit the tf_prefix of the launch file that called them.

Here's an example: For the default simulation with one robot, the topic imu/data is broadcast and has the frame_id: base_link. When wrapped in the namespace and tf_prefix, I can edit the <robotnamespace> parameter to make the topic huksy1/imu/data. But I can't seem to change the frame id to be frame_id: husky1/base_link.

Does anyone have an idea on how this could be done?

Thanks all!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-02-18 19:34:44 -0600

nbeyers gravatar image

I think I've figured this one out. A lot of plugins accept a parameter for the tf frame. All I had to do was add the frameId tag. Like this:

<gazebo>
  <plugin name="imu_controller" filename="libhector_gazebo_ros_imu.so">
    <robotNamespace>/husky1</robotNamespace>
    <updateRate>50.0</updateRate>
    <bodyName>base_link</bodyName>
    <frameId>husky1/base_link</frameId>
    <topicName>imu/data</topicName>
    <accelDrift>0.005 0.005 0.005</accelDrift>
    <accelGaussianNoise>0.005 0.005 0.005</accelGaussianNoise>
    <rateDrift>0.005 0.005 0.005 </rateDrift>
    <rateGaussianNoise>0.005 0.005 0.005 </rateGaussianNoise>
    <headingDrift>0.005</headingDrift>
    <headingGaussianNoise>0.005</headingGaussianNoise>
  </plugin>
</gazebo>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-02-18 17:26:30 -0600

Seen: 2,925 times

Last updated: Feb 18 '16