ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How do I control 2 PR2 robots in gazebo at the same time ?

asked 2016-06-10 00:15:45 -0600

Pikachu gravatar image

updated 2016-06-10 06:40:36 -0600

Orhan gravatar image

I can teleoperate on pr2 robot through roslaunch pr2_teleop_general pr2_teleop_general_keyboard.launch. I am also able to move pr2 robot by writing a C++ script. But I want to have 2 pr2 robots in my customised world and control move both of them. I am using ROS-Indigo with gazebo version 2.2.2 on Ubuntu 14.04.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2016-06-10 02:44:23 -0600

Orhan gravatar image

updated 2016-06-10 07:17:43 -0600

You need namespaces for launching multiple robots. And namespacing packages, frames, topics... are a really big work. Also namespacing PR2 is the biggest version of this problem because it has many many packages for namespacing. I'll write small tutorial for how to namespace robots and doing navigation with them later. But You can follow this sequence;

First look at urdf for tf. Joints, frames must be unic, secondly group your .launch files with <group ns="robot_name"></group> tag. Then look at the topics, which one is not connected? Which one is not published? rosrun rqt_graph rqt_graph is really helpful for this job. Look at rqt_graph for understanding it. Then Try to remap them.

I'm currently running navigation stack with multiple robots in gazebo wtihout editing sources. Also if you have custom packages, You may need to rename some frames etc.

And I suggest, please don't do this with PR2 :)

edit flag offensive delete link more


Hi, Thanks for answering. i will try with what you mentioned. Can I know how are you using navigation stack with multiple robots and what robots are you using? I also need to do something similar.

Pikachu gravatar image Pikachu  ( 2016-06-10 06:20:12 -0600 )edit

I'm running one common map_server and common /map topic. But amcl, move_base... nodes are in their robot's namespace: for ex: /robot1/amcl , /robot2/amcl. For doing this, You must enter robot special parameters in your launch file. For example; There is a parameter in global_costmap;

Orhan gravatar image Orhan  ( 2016-06-10 06:35:01 -0600 )edit

in move_base launch file, firstly I'm getting other parameters from yaml, but this one is robot specific:

<param name="global_costmap/obstacles_layer/scan/sensor_frame" value="$(arg robot_name)/base_laser_link" />
Orhan gravatar image Orhan  ( 2016-06-10 06:36:16 -0600 )edit

That robot_name is the namespace of robot and I'm passing this parameter in every recursive launch.

Orhan gravatar image Orhan  ( 2016-06-10 06:37:41 -0600 )edit

answered 2016-06-10 02:59:08 -0600

May you be following a wrong approach? Controlling a simulated robot and a real robot at the same time looks really weird...

May you be rather interested in using rviz? to "simulate or introspect" what is happening in the real world with a virtual representation?

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


Asked: 2016-06-10 00:15:45 -0600

Seen: 509 times

Last updated: Jun 10 '16