grasp_saver_unsafe.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 from sys import argv
17 
18 import rospy
19 
20 from sr_robot_commander.sr_robot_state_saver import SrStateSaverUnsafe
21 
22 
23 """
24 ***DISCLAIMER***
25 
26 This script provides a command line interface to save the current pose of the robot (made of an arm and hand).
27 Poses can be composed of either hand joints/arm joints/all joints. This can be useful for making smooth
28 movements where the hand and arm should move synchronously. However, there are no safeties! In particular,
29 if a hand and arm aren't both present , its behaviour is undefined. Likewise if more than one hand/arm are
30 present. There is also no checking to prevent overwriting existing database entries/otherwise damaging the
31 robot_states database. It is included here as it is a useful tool, but it should be considered a work in
32 progress and used with care.
33 
34 You have been warned :)
35 
36 
37 To use this script:
38 
39 rosrun sr_robot_commander grasp_saver_unsafe.py NAME_TO_SAVE WHAT_TO_SAVE
40 
41 NAME_TO_SAVE is the name that will be used for the state in the database.
42 
43 N.B. IF A STATE ALREADY EXISTS WITH THAT NAME IT WILL BE OVERWRITTEN WITH NO WARNING!
44 
45 WHAT_TO_SAVE specifies which joints will be included. It can be "arm","hand" or "both".
46 
47 If WHAT_TO_SAVE is omitted, it defaults to "both".
48 """
49 
50 if "__main__" == __name__:
51  rospy.init_node("state_saver")
52 
53  name = rospy.get_param("~name")
54  which = rospy.get_param("~which", "all")
55  hand_h = rospy.get_param("~hand_h", False)
56  save_target = rospy.get_param("~save_target", False)
57 
58  if which == "all":
59  gs = SrStateSaverUnsafe(name + "_hand", "hand", hand_h=hand_h, save_target=save_target)
60  gs = SrStateSaverUnsafe(name + "_arm", "arm", hand_h=hand_h, save_target=save_target)
61  gs = SrStateSaverUnsafe(name + "_both", "both", hand_h=hand_h, save_target=save_target)
62  else:
63  gs = SrStateSaverUnsafe(name + "_" + which, which, hand_h=hand_h, save_target=save_target)


sr_robot_commander
Author(s): Andriy Petlovanyy
autogenerated on Wed Oct 14 2020 04:05:30