demo_rs.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 #
4 # Copyright 2019 Shadow Robot Company Ltd.
5 #
6 # This program is free software: you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the Free
8 # Software Foundation, either version 2 of the License, or (at your option)
9 # any later version.
10 #
11 # This program is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 # more details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with this program. If not, see <http://www.gnu.org/licenses/>.
18 #
19 
20 # Script to move the right hand into store position.
21 
22 import rospy
23 from sr_robot_commander.sr_hand_commander import SrHandCommander
24 
25 rospy.init_node("store_right_hand", anonymous=True)
26 
27 hand_commander = SrHandCommander(name="right_hand")
28 
29 open_hand = {'rh_FFJ1': 0.0, 'rh_FFJ2': 0.0, 'rh_FFJ3': 0.0, 'rh_FFJ4': 0.0,
30  'rh_MFJ1': 0.0, 'rh_MFJ2': 0.0, 'rh_MFJ3': 0.0, 'rh_MFJ4': 0.0,
31  'rh_RFJ1': 0.0, 'rh_RFJ2': 0.0, 'rh_RFJ3': 0.0, 'rh_RFJ4': 0.0,
32  'rh_LFJ1': 0.0, 'rh_LFJ2': 0.0, 'rh_LFJ3': 0.0, 'rh_LFJ4': 0.0, 'rh_LFJ5': 0.0,
33  'rh_THJ1': 0.0, 'rh_THJ2': 0.0, 'rh_THJ3': 0.0, 'rh_THJ4': 0.0, 'rh_THJ5': 0.0,
34  'rh_WRJ1': 0.0, 'rh_WRJ2': 0.0}
35 
36 pack_hand_1 = {'rh_FFJ1': 1.5707, 'rh_FFJ2': 1.5707, 'rh_FFJ3': 1.5707, 'rh_FFJ4': 0.0,
37  'rh_MFJ1': 1.5707, 'rh_MFJ2': 1.5707, 'rh_MFJ3': 1.5707, 'rh_MFJ4': 0.0,
38  'rh_RFJ1': 1.5707, 'rh_RFJ2': 1.5707, 'rh_RFJ3': 1.5707, 'rh_RFJ4': 0.0,
39  'rh_LFJ1': 1.5707, 'rh_LFJ2': 1.5707, 'rh_LFJ3': 1.5707, 'rh_LFJ4': 0.0, 'rh_LFJ5': 0.0}
40 
41 pack_hand_2 = {'rh_THJ4': 1.2}
42 
43 pack_hand_3 = {'rh_THJ1': 0.52, 'rh_THJ2': 0.61, 'rh_THJ5': 0.43}
44 
45 
46 # Move hand to open position
47 joint_states = open_hand
48 rospy.loginfo("Moving hand to open position")
49 hand_commander.move_to_joint_value_target_unsafe(joint_states, 2.0, False)
50 rospy.sleep(2)
51 
52 # Move hand to closed position
53 joint_states = pack_hand_1
54 rospy.loginfo("Moving hand to pack position")
55 hand_commander.move_to_joint_value_target_unsafe(joint_states, 2.0, False)
56 rospy.sleep(2)
57 
58 joint_states = pack_hand_2
59 hand_commander.move_to_joint_value_target_unsafe(joint_states, 2.0, False)
60 rospy.sleep(2)
61 
62 joint_states = pack_hand_3
63 hand_commander.move_to_joint_value_target_unsafe(joint_states, 2.0, False)
64 rospy.sleep(2)


sr_ethercat_hand_config
Author(s): Ugo Cupcic, Toni Oliver
autogenerated on Wed Oct 14 2020 03:24:13