sr_right_hand_follow_named_trajectory.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 
17 # This example demonstrates how you can send a trajectory created from named poses.
18 
19 import rospy
20 
21 from sr_robot_commander.sr_hand_commander import SrHandCommander
22 from sr_utilities.hand_finder import HandFinder
23 rospy.init_node("named_traj_example", anonymous=True)
24 
25 hand_finder = HandFinder()
26 
27 hand_parameters = hand_finder.get_hand_parameters()
28 hand_serial = hand_parameters.mapping.keys()[0]
29 
30 hand_commander = SrHandCommander(hand_parameters=hand_parameters,
31  hand_serial=hand_serial)
32 
33 
34 # Define trajectory. Interpolate time (time to move to each point from previous posture)
35 # must be specified. Pause time is optional. Names are either the default poses defined
36 # in SRDF or are states stored in the warehouse.
37 
38 trajectory = [
39  {
40  'name': 'open',
41  'interpolate_time': 3.0
42  },
43  {
44  'name': 'pack',
45  'interpolate_time': 3.0,
46  'pause_time': 2
47  },
48  {
49  'name': 'open',
50  'interpolate_time': 3.0
51  },
52  {
53  'name': 'pack',
54  'interpolate_time': 3.0
55  }
56 ]
57 
58 
59 # Run trajectory via moveit
60 hand_commander.run_named_trajectory(trajectory)
61 
62 # Run trajectory by sending directly to controllers - faster but no collision checking.
63 hand_commander.run_named_trajectory_unsafe(trajectory, True)


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