Robotics StackExchange | Archived questions

instantiate two instances of moveit_commander

I am attempting to control two UR5 robots simultaneously but am running into an issue where I am able to create two move_group instances for each UR5 under different namespaces but the moveit_commander will only connect to the first move_group instance. Is it possible to either create an instance of moveit_commander for each robot or make the moveit_commander connect with both move_group instances?

Asked by shu on 2020-01-08 12:15:56 UTC

Comments

Answers

You could run your robots in multiple separate move_groups, but I recommend defining them as separate planning groups inside a single move_group.

I don't see a problem with creating multiple moveGroupCommander instances to connect to different planning groups. Connecting a single moveit_commander to multiple move_groups is not the intended usage.

Note that you can create a third planning group that contains the joints of both arms, and control it with yet another moveGroupCommander instance. That would not connect it to both planning groups, but it would control the same robots. This is also how you can plan simultaneous motions with both arms.

Asked by fvd on 2020-02-29 13:13:40 UTC

Comments

Thanks, I never tried making more than one moveit_commander instance, though I'm a little confused as to how to do so. In the move group tutorial for kinetic, the initialization for the moveit_commander is moveit_commander.roscpp_initialize(sys.argv). So would I be able to create two instances of the moveit_commander inside the same class or will I need two different classes?

Asked by shu on 2020-03-02 03:19:29 UTC

I clarified my answer, it was imprecise. I am actually not familiar with connecting to multiple move_group instances - what I recommend is to define your robots as planning groups inside a single move_group in the global namespace, and connect multiple moveGroupCommander objects to those planning groups. This works very well and ensures that each robot knows about the position of the other. If you have them in separate move groups, this is generally not the case.

This is not the prettiest example, but feel free to use it: https://github.com/o2as/ur-o2as/blob/master/catkin_ws/src/o2as_routines/src/o2as_routines/base.py

Asked by fvd on 2020-03-02 05:31:26 UTC