sr_bottle_example.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright 2019 Shadow Robot Company Ltd.
3 #
4 # This program is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the Free
6 # Software Foundation version 2 of the License.
7 #
8 # This program is distributed in the hope that it will be useful, but WITHOUT
9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 # more details.
12 #
13 # You should have received a copy of the GNU General Public License along
14 # with this program. If not, see <http://www.gnu.org/licenses/>.
15 
16 # Example to demonstrate moving to stored/names targets. Both arm and hand movements executed.
17 # Available named targets can be viewed in MoveIt, on the planning tab.
18 
19 import rospy
20 from sr_robot_commander.sr_arm_commander import SrArmCommander
21 from sr_robot_commander.sr_hand_commander import SrHandCommander
22 
23 
24 rospy.init_node("grab_bottle_example", anonymous=True)
25 
26 hand_commander = SrHandCommander()
27 arm_commander = SrArmCommander()
28 
29 print("Executing moves:")
30 
31 # start a bit higher
32 # arm_commander.move_to_named_target("gamma", True)
33 
34 # approach
35 print("Approach bottle")
36 hand_commander.move_to_named_target("open_bottle", False)
37 arm_commander.move_to_named_target("approach_bottle", True)
38 
39 # grab
40 print("Hold bottle")
41 arm_commander.move_to_named_target("hold_bottle", True)
42 hand_commander.move_to_named_target("hold_bottle", True)
43 
44 # pour
45 print("Pour")
46 arm_commander.move_to_named_target("pour_bottle", True)
47 
48 # release
49 print("Release bottle")
50 arm_commander.move_to_named_target("hold_bottle", True)
51 hand_commander.move_to_named_target("open_bottle", True)
52 
53 # and move back
54 print("Return")
55 arm_commander.move_to_named_target("approach_bottle", True)
56 
57 # victory
58 print("Peace")
59 arm_commander.move_to_named_target("victory")
60 hand_commander.move_to_named_target("victory")


sr_example
Author(s): Ugo Cupcic
autogenerated on Wed Oct 14 2020 04:05:12