Vishnu Prasad P
Vishnu Prasad P

Reputation: 69

How run multiple move_group for different robots in single system

I am trying to simulate in Gazebo multiple robots(KUKA, UR5 and Franka Panda). In a URDF file included all the robot for simulation and using the Moveit made separate arm group of all three robots. Using the Moveit commander, I can control the robot, and it is working fine. Problem is when I am trying to control all the robot at the same time using the Moveit commander. If one robot is working, then another robot will not work even if I command to it. Is there any way I can work all three robots simultaneously.

Upvotes: 0

Views: 1433

Answers (2)

sniegs
sniegs

Reputation: 61

Hopefully this is still relevant to someone now, that I write this. I've been working with this issue for quite some time and I've managed to get two robots working simultaneously, but they are not separated in the TF tree and that is a really important part, as Vik mentioned, which I'm still struggling with.

But for the bare minimum of the robots working simultaneously, what you need is each robot to have a separate move_group and . In my case I do this in the launch file, where I have a version of the following code:

<group ns="robot_1">

  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
        
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
  
  <include file="$(find directory)/launch/move_group.launch" />
 
</group>

<group ns="robot_2">

  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
        
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
  
  <include file="$(find directory)/launch/move_group.launch" />
 
</group>

Then, when launching some C++ execution code, you need to launch in the robots namespace, for example in the terminal like so:

ROS_NAMESPACE=robot_1 rosrun movegroup_interface robot_one_move

or this can be don in a separate .launch file as well!

Good luck!

Upvotes: 0

Vik
Vik

Reputation: 730

I am not very familiar with MoveIt. However I do know that you need to be careful when running multiple systems on a single roscore. Here are some things to consider:

  1. You want to make sure that all the topics are separated out and that each node is subscribing to and publishing to appropriate topics.
  2. For the TF, all the messages are on one topic, here you need to make sure that there is only one valid tree going top down from the world frame to each robot. If the tree is not correct then it breaks down other unrelated stuff.
  3. From my experience you have two options, either separate out all the different robots into different roscores using multimaster. Once you do that, each can have their own TF's and you can share only the required messages across. Alternatively, you need to make sure that the TF tree is appropriately separated out for the nodes to function correctly.

Hope this helps...

Upvotes: 1

Related Questions