-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdemo_ro.py
More file actions
executable file
·44 lines (35 loc) · 1.76 KB
/
Copy pathdemo_ro.py
File metadata and controls
executable file
·44 lines (35 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
# Copyright 2019 Shadow Robot Company Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
# Script to move the right hand into open position.
from __future__ import absolute_import
import rospy
from sr_robot_commander.sr_hand_commander import SrHandCommander
rospy.init_node("open_right_hand", anonymous=True)
hand_commander = SrHandCommander(name="right_hand")
open_hand = {'rh_FFJ1': 0.0, 'rh_FFJ2': 0.0, 'rh_FFJ3': 0.0, 'rh_FFJ4': 0.0,
'rh_MFJ1': 0.0, 'rh_MFJ2': 0.0, 'rh_MFJ3': 0.0, 'rh_MFJ4': 0.0,
'rh_RFJ1': 0.0, 'rh_RFJ2': 0.0, 'rh_RFJ3': 0.0, 'rh_RFJ4': 0.0,
'rh_LFJ1': 0.0, 'rh_LFJ2': 0.0, 'rh_LFJ3': 0.0, 'rh_LFJ4': 0.0, 'rh_LFJ5': 0.0,
'rh_THJ1': 0.0, 'rh_THJ2': 0.0, 'rh_THJ3': 0.0, 'rh_THJ4': 0.0, 'rh_THJ5': 0.0,
'rh_WRJ1': 0.0, 'rh_WRJ2': 0.0}
open_thumb = {'rh_THJ1': 0.0, 'rh_THJ2': 0.0, 'rh_THJ3': 0.0, 'rh_THJ4': 1.2, 'rh_THJ5': 0.0}
# Open the thumb
rospy.loginfo("Moving thumb to open position")
hand_commander.move_to_joint_value_target_unsafe(open_thumb, 1.0, False)
rospy.sleep(1)
# Move hand to open position
rospy.loginfo("Moving hand to open position")
hand_commander.move_to_joint_value_target_unsafe(open_hand, 2.0, False)
rospy.sleep(2)