Skip to content

tuto using part3

GuiHome edited this page Jul 12, 2015 · 6 revisions

Tutorial 2 : Using the planning environment

Prerequisite

It is not necessary to follow tutorial 2 part 1 and 2 as a prerequisite, since a new application is given, containing most of the result of the two first parts. However the additional packages for tutorial 2 should be installed as described in the home page

The application package is called regrasping_app. It sets up the environment and arm and hand groups for planning. It loads the required grasps and provides some helper methods.

The application will move the arm to the end of the pick pose with the pen in the hand (see previous part for more details)

Part 3 : Regrasping with obstacle avoidance

Objective

  • Planning finger motions with an object in hand.

Planning finger motions with an object in hand.

Starting from the two-finger grasp of the pen, the objective is to regrasp the pen with a four-finger grasp. To this end, the ring and little fingers must be moved to the four finger grasp pose without colliding with the pen.

Hence, the ring and little fingers must be planned separately while the other fingers remain in their grasp posture.

  1. In the given regrasping_app.py code, after the pick task, instantiate the ring and little finger groups
ring_finger = MoveGroupCommander("ring_finger")
little_finger = MoveGroupCommander("little_finger")
rospy.sleep(1)
  1. Set both groups to use RRTstarkConfigDefault planner and start from the current state
ring_finger.set_planner_id("RRTstarkConfigDefault") 
ring_finger.set_start_state_to_current_state()
little_finger.set_planner_id("RRTstarkConfigDefault") 
little_finger.set_start_state_to_current_state()

The pen must be considered for planning, and be an obstacle for the fingers. Detach the pen from the arm group

arm.detach_object("pen")

The target posture (four-finger grasp) is stored for the hand, but cannot be set for the individual fingers with set_named_target(). One must use the command set_joint_value_target with a dictionary of joint_names and values that concern only the ring (resp. little) finger.

The given method subgroup_posture_target reads the Grasp.msg of the full hand and provides the dictionary of joint_names and values relative to the selected finger group.

  1. Extract the ring posture for a four-finger grasp
ring_target_posture = subgroup_posture_target(four_finger_grasp,ring_finger)
  1. Set the target posture for the ring finger
ring_finger.set_joint_value_target(ring_target_posture)
  1. Plan and execute this movement
ring_finger.go()
rospy.sleep(2)
  1. Test your program
roslaunch shadow_ur10_moveit_config demo.launch
rosrun regrasping_app regrasping_app.py 

You should see the ring finger nicely expanding without hitting the pen and approaching the final position near the pen.

Redo the same operation for the little finger and test it.