sr_mix_examples.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import rospy
00004 from sr_robot_commander.sr_arm_commander import SrArmCommander
00005 from sr_robot_commander.sr_hand_commander import SrHandCommander
00006 
00007 
00008 rospy.init_node("basic_arm_examples", anonymous=True)
00009 
00010 hand_commander = SrHandCommander()
00011 arm_commander = SrArmCommander()
00012 
00013 # Move hand
00014 named_target_1 = "open"
00015 print("Moving to hand named target " + named_target_1)
00016 hand_commander.move_to_named_target(named_target_1, False)
00017 
00018 
00019 joint_states_1 = {'ra_shoulder_pan_joint': 0.43221632746577665, 'ra_elbow_joint': 2.118891128999479,
00020                    'ra_wrist_1_joint': -1.711370650686752, 'ra_wrist_2_joint': 1.4834244535003318,
00021                    'ra_shoulder_lift_joint': -2.5813317754982474, 'ra_wrist_3_joint': 1.6175960918705412}
00022 
00023 joint_states_2 = {'ra_shoulder_pan_joint': 0.4225743596855942, 'ra_elbow_joint': 1.9732180863151747,
00024                    'ra_wrist_1_joint': -0.8874321427449576, 'ra_wrist_2_joint': -0.9214312892819567,
00025                    'ra_shoulder_lift_joint': -1.9299519748391978, 'ra_wrist_3_joint': 0.7143446787498702}
00026 
00027 # Move arm
00028 joint_states = joint_states_1
00029 print("Moving arm to joint states\n" + str(joint_states) + "\n")
00030 arm_commander.move_to_joint_value_target(joint_states)
00031 
00032 named_target_1 = "pack"
00033 print("Moving to hand named target " + named_target_1)
00034 hand_commander.move_to_named_target(named_target_1, True)
00035 
00036 
00037 
00038 hand_joint_states_1 = {'rh_FFJ1': 0.35, 'rh_FFJ2': 0.0, 'rh_FFJ3': 0.0, 'rh_FFJ4': 0.0,
00039                        'rh_MFJ1': 0.35, 'rh_MFJ2': 0.0, 'rh_MFJ3': 0.0, 'rh_MFJ4': 0.0,
00040                        'rh_RFJ1': 0.35, 'rh_RFJ2': 0.0, 'rh_RFJ3': 0.0, 'rh_RFJ4': 0.0,
00041                        'rh_LFJ1': 0.35, 'rh_LFJ2': 0.0, 'rh_LFJ3': 0.0, 'rh_LFJ4': 0.0,
00042                        'rh_THJ1': 0.35, 'rh_THJ2': 0.0, 'rh_THJ3': 0.0, 'rh_THJ4': 0.0, 'rh_THJ5': 0.0,
00043                        'rh_WRJ1': 0.0, 'rh_WRJ2': 0.0}
00044 hand_joint_states_2 = {'rh_FFJ1': 0.35, 'rh_FFJ2': 0.0, 'rh_FFJ3': 0.0}
00045 
00046 # Move hand
00047 joint_states = hand_joint_states_2
00048 print("Moving hand to joint states\n" + str(joint_states) + "\n")
00049 hand_commander.move_to_joint_value_target(joint_states, True)
00050 
00051 # Move arm
00052 joint_states = joint_states_2
00053 print("Moving arm to joint states\n" + str(joint_states) + "\n")
00054 arm_commander.move_to_joint_value_target(joint_states)
00055 
00056 
00057 #rospy.sleep(5.0)
00058 
00059 
00060 


sr_example
Author(s): Ugo Cupcic
autogenerated on Fri Aug 21 2015 12:25:43