Main Page
Namespaces
Classes
Files
File List
src
sr_fast_grasp
grasp_saver.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
from
sys
import
argv
4
5
import
rospy
6
from
moveit_msgs.srv
import
SaveRobotStateToWarehouse
as
SaveState
7
from
sensor_msgs.msg
import
JointState
8
from
moveit_msgs.msg
import
RobotState
9
10
11
class
GraspSaver
:
12
def
__init__
(self, name):
13
self.
__group_name
=
"right_hand"
14
self.
__save
= rospy.ServiceProxy(
15
'/moveit_warehouse_services/save_robot_state'
, SaveState)
16
self.
__js_subscriber
= rospy.Subscriber(
"joint_states"
,
17
JointState,
18
self.
__js_cb
)
19
self.
__js
=
None
20
self.
__done
=
False
21
self.
__name
= name
22
23
def
__js_cb
(self, js):
24
self.
__js
= js
25
26
def
__save_out
(self):
27
rs = RobotState()
28
rs.joint_state = self.
__js
29
self.
__save
(self.
__name
,
""
, rs)
30
31
def
spin
(self):
32
while
not
self.
__done
and
not
rospy.is_shutdown():
33
if
self.
__js
is
not
None
:
34
self.
__save_out
()
35
self.
__done
=
True
36
else
:
37
rospy.sleep(.1)
38
39
if
"__main__"
== __name__:
40
rospy.init_node(
"grasp_saver"
)
41
if
len(argv) <= 1
or
""
== argv[1]:
42
rospy.logerr(
"You didn't enter a name."
)
43
exit(-1)
44
gs =
GraspSaver
(argv[1])
45
gs.spin()
grasp_saver.GraspSaver.__save_out
def __save_out(self)
Definition:
grasp_saver.py:26
grasp_saver.GraspSaver.__name
__name
Definition:
grasp_saver.py:21
grasp_saver.GraspSaver.__done
__done
Definition:
grasp_saver.py:20
grasp_saver.GraspSaver.__init__
def __init__(self, name)
Definition:
grasp_saver.py:12
grasp_saver.GraspSaver.__js
__js
Definition:
grasp_saver.py:19
grasp_saver.GraspSaver
Definition:
grasp_saver.py:11
grasp_saver.GraspSaver.__save
__save
Definition:
grasp_saver.py:14
grasp_saver.GraspSaver.__group_name
__group_name
Definition:
grasp_saver.py:13
grasp_saver.GraspSaver.__js_cb
def __js_cb(self, js)
Definition:
grasp_saver.py:23
grasp_saver.GraspSaver.__js_subscriber
__js_subscriber
Definition:
grasp_saver.py:16
grasp_saver.GraspSaver.spin
def spin(self)
Definition:
grasp_saver.py:31
sr_grasp_fast_planner
Author(s):
autogenerated on Tue Oct 13 2020 03:50:44