Gazebo | Ignition | Community
Ask Your Question
0

Gazebo as ROS node doesn't publish topics (odom, joint_states and tf) correctly

asked 2014-04-29 13:48:13 -0600

Robert gravatar image

Hi Everyone, I am running two turtlebots from kobuki, gazebo1.9-hydroROS,(robot1 and robot2) and when I checked the rqtgraph (subscriber and publisher graph) I noticed that Gazebo as ROS node doesn’t publish or subscribe the /odom, /joinstates and / tf topics based on their correspondence namespaces (robot1/odom and robot2/odom). Gazebo node just publishes or subscribes using the global names, /odom, /join_states and /tf.
I remapped some nodes to work properly with their correspondence namespace but I couldn’t figure out where to go to remap this “Gazebo node” I installed the turtlebot from source and using Gazebo 1.9 with hydro ROS. Please, somebody can help me out with this issue. Thanks a lot

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2014-04-30 02:16:52 -0600

peshala gravatar image

updated 2014-04-30 02:18:23 -0600

Hi,

According to this remapping of gazebo topics is not yet possible.

Note that /odom, /joint_states and /tf are not published from gazebo. To publish /joint_states in your preferred namespace you can spawn the joint_state_controller from spawner node in controller_manager while changing the namespace as follows:

<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/robot1" args="joint_state_controller"
</node>

Also, remember to change the namespace in the plugin inside URDF/SDF file:

<gazebo>
  <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
   <robotNamespace>/robot1</robotNamespace>
  </plugin>
</gazebo>

To publish /tf you need the robot_state_publisher. Do remapping:

<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
respawn="false" output="screen">
  <remap from="/joint_states" to="/robot1/joint_states" />
</node>

So, for the multiple robots you may want to repeat the above again.

You can also wanna try

<group ns="robot1"> include robot1 stuff here </group>

check this, too

Cheers!

edit flag offensive delete link more

Comments

Thanks a lot Peshala for your tips!! I will let you know the results

Robert gravatar imageRobert ( 2014-04-30 09:56:07 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-04-29 13:48:13 -0600

Seen: 8,233 times

Last updated: Apr 30 '14