Gazebo as ROS node doesn't publish topics (odom, joint_states and tf) correctly
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
Asked by Robert on 2014-04-29 13:48:13 UTC
Answers
Hi,
According to this remapping of gazebo topics is not yet possible.
Note that /odom
, /joint_state
s 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>
Cheers!
Asked by peshala on 2014-04-30 02:16:52 UTC
Comments
Thanks a lot Peshala for your tips!! I will let you know the results
Asked by Robert on 2014-04-30 09:56:07 UTC
Comments