moveit / moveit

:robot: The MoveIt motion planning framework
http://moveit.ros.org
BSD 3-Clause "New" or "Revised" License
1.67k stars 947 forks source link

Some question happened in my dual arm motion planning project #3284

Closed zzzbbs closed 1 year ago

zzzbbs commented 1 year ago

Description

I treat left arm ,right arm,head_joint as a whole_body group,but when I only excute right_arm to the named home, it seems that the left arm and head joint which I don't want to actuate begin to move.

Your environment

Steps to reproduce

I set the left_arm, right_arm and head_joint as whole_body group. After excuting right_arm to the target, I try to reset the right_arm using the whole_body group. The following video is the problem of what I met. Code: cur_joint = self.whole_body_group.get_current_joint_values() print(cur_joint) #LSP -> LWR , RSP -> RWR self.whole_body_group.set_named_target("whole_home") plan_success,traj,planning_time,error_code = self.whole_body_group.plan()

https://user-images.githubusercontent.com/81844650/204484756-3e2595e9-fcfb-49d6-8820-2aeca6f6a8eb.mp4

Expected behaviour

While using the whole body group to reset whole body, the right arm which is away from the robot body should be actuated, and the head arm and the left arm which is now at the named home should not be actuated.

Backtrace or Console output

Use gist.github.com to copy-paste the console output or segfault backtrace using gdb.

welcome[bot] commented 1 year ago

Thanks for reporting an issue. Because we're a volunteer community, providing a pull request with suggested changes is always welcomed.

rhaschke commented 1 year ago

If you want to restrict motion (and planning) to a specific group of joints, you need to define and use a JointModelGroup (JMG) for them. Planning with MoveIt/OMPL is sampling-based, i.e. random. It considers=samples all joints that are part of the selected JMG.

zzzbbs commented 1 year ago

If you want to restrict motion (and planning) to a specific group of joints, you need to define and use a JointModelGroup (JMG) for them. Planning with MoveIt/OMPL is sampling-based, i.e. random. It considers=samples all joints that are part of the selected JMG.

Thank you very much for your reply. Do you mean that I should devide these joints into different move groups?

rhaschke commented 1 year ago

Yes, define JMGs for each set of joints you want to plan for separately.

zzzbbs commented 1 year ago

Thank you, I get it. What I want to achieve is that both arm and head can move together to their own "home position" without affecting each other. So I composite them into "whole_body" group. If I devided into three move_group , it will be executed serially rather than in parallel. E.g, left_arm -> right_arm -> head. Could you offer me some suggestions about how to use only one move_group to make these motion planning or excuting in parallel?

rhaschke commented 1 year ago

MTC's Merger provides the desired functionality. MoveIt itself doesn't: https://github.com/ros-planning/moveit/issues/705

simonschmeisser commented 1 year ago

See also #3243 for ongoing work to support parallel independent execution.

zzzbbs commented 1 year ago

MTC's Merger provides the desired functionality. MoveIt itself doesn't: #705

Thank for your suggestion. I see MTC in the tutorial, but it did not give a example of how to make parallel plan.
Is the following code the core code of parallel programming? And could the result from task.plan() while using three moveit_group directly actuate "whole_body" group?
/scripts/merger.py

zzzbbs commented 1 year ago

See also #3243 for ongoing work to support parallel independent execution.

Thank you for your suggestion! I will have a look.

rhaschke commented 1 year ago

Yes, the merger.py script illustrates the use of the Merger. You still need to use separate JMGs for left/right arm and head. However, trajectories for those separate groups are merged into a single trajectory eventually.