I wrote a robot pick & place application with Hydro months ago, the code basically looks like this:
group.plan(plan);
group.execute(plan);
and it works fine, the motion plan takes the attached collision object into account, and I can see a green object moving together with my robot arm when visualize the plan in rviz.
However, after upgraded (my upgrade I mean re-install, you know that :P ) to Ubuntu 14.04, ROS indigo and moveit indigo recently, the same code won't take attached collision object into account while planning, and I can't see the green object in rviz when visualizing the plan.
So I modified my code like this:
group.plan(plan);
group.execute(plan);
group.attachObject(object_name);
group.plan(plan);
ROS_INTO_STREAM(plan.start_state_);
group.execute(plan);
And the attached_collision_objects[] vector is empty.
However, whenever the group.attachObject() is called, corresponding change happens in rviz : start_state(green) , goal_state(orange) as well as scene robot (purple) will all show the attached object with corresponding color. Although we can observe clear collision between the purple object in scene robot and other collision object (yellow) in the scene when executing my code, the moveit_rviz_plugin clearly took the collision object into account and when visualizing a plan (after I clicked "Plan" button), the attached object will show up in green during the animation.
Something else I noticed:
If I add group.plan() between group.attachObject() and group.detachObject() in the move_group_interface tutorial code, there will be no collision object attached to PR2.
However, if I ran the pick_and_place_tutorial, after group.place(object, loc) returns, rviz will show a planned path with the box attached to the tip of right hand of PR2.
I am not sure if it's only me or someone else have met this problem too, so I ask here before report it as a bug.
Best,
Hao
--