How to attach an object for collision check in motion planning
Hi, I'm trying to use MoveIt! for planning motion avoiding collisions between robot links and collision object attached to the end effector of the robot manually and finding usages by simply calling several ROS services instead of using any interface (e.g. MoveGroupInterface) for the simplicity of codes.
It looks there are at least two ways to tell a planner about attached objects to robot links. My question is which API is better to use, from the perspective of function, difficulty and support.
Use of
/apply_planning_scene
service, then/plan_kinematic_path
serviceFirstly, call
/apply_planning_scene
which takesmoveit_msgs/ApplyPlanningScene
, where we can define attached collision objects by setting them inApplyPlanningSceneRequest.scene.robot_state.attached_collision_objects
. After receiving its result with a booleansuccess
set totrue
, then call/plan_kinematic_path
for getting the result of motion planning.I tried this method, but I doubt a planner actually consider attached collision objects on motion planning, because it sometimes produces trajectory which contains collision in the middle of it.
Use of
/plan_kinematic_path
service onlyThe service
/plan_kinematic_path
takesmoveit_msgs/GetMotionPlan
service, which also has a field for describing collision objects atGetMotionPlanRequest.motion_plan_request.start_state.attached_collision_objects
. Is it enough to set the field with initial robot joint state and the target one?I tried the method too and also got trajectory which contains points in collision.
Or is there any other proper way to use planning service for getting planned motion avoiding collisions between attached objects and robots?
Any suggestion or comment are very welcome! Thank you very much in advance!
You do need to attach collision objects to the robot for it to be considered in collision checking, but the
/plan_kinematic_path
service uses theattached_collision_objects
provided in the message (including if you don't supply any). Could you provide examples of trajectories that contain collisions?@fvd Thank you for the comment and sorry for the late reply. Unfortunately, I cannot make the test case public right now, but found how to use planning with attached collision objects correctly (which I "answered"). Anyway, thank you for your advice!