Ask Your Question
1

turtlebot with namespace in gazebo and visualization in rviz

asked 2016-07-18 18:41:56 -0500

Rin gravatar image

Hi, I need to bring up multiple turtlebots in gazebo, so I gave each of them a namespace. The way I did this is just modify the turtlebot_world.launch file in turtlebot_gazebo pkg. If I just bring up one turtlebot without namespace, I can use roslaunch turtlebot_gazebo gmapping_demo.launch and roslaunch turtlebot_rviz_launchers view_navigation.launch to open rviz successfully. What I did is like these:

  1. bring up one turtlebot with namespace robot0,
  2. change the arg name,"scan_topic" from /scan to robot0/scan in gmapping.launch.xml,
  3. create a agent.rviz file by adding robot0/ before several topics in navigation.rviz. exp:from Topic: /mobile_base/sensors/bumper_pointcloud to Topic: robot0/mobile_base/sensors/bumper_pointcloud

But What I can achieve is only bringing up multiple turtlebots with different namespaces, but rviz can not find these turtlebots. I don't know what should I do to make things work.

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-08-31 19:14:34 -0500

spoluri gravatar image

I know this question is for ROS1 but for ROS2 you use the example contained in nav2_bringup/launch/rviz_launch.py. The function ReplaceString allows you to replace a template string in your rviz with your namespace. For the purpose of remapping transforms, when launching the rviz node you can pass the following:

 remappings = [('/tf', 'tf'),
    ('/tf_static', 'tf_static')]

description.append(Node(
    package='rviz2',
    executable='rviz2',
    name='rviz',
    remappings=remappings,
))
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-07-18 18:18:12 -0500

Seen: 161 times

Last updated: Aug 31 '21