Main Page
Namespaces
Classes
Files
File List
scripts
save_mesh_server.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
import
rospy
4
from
jsk_recognition_msgs.msg
import
BoundingBox
5
from
jsk_recognition_msgs.srv
import
SaveMesh
6
from
jsk_recognition_msgs.srv
import
SaveMeshRequest
7
from
std_srvs.srv
import
Empty
8
from
std_srvs.srv
import
EmptyResponse
9
10
11
class
SaveMeshServer
(object):
12
13
def
__init__
(self):
14
self.
ground_frame_id
= rospy.get_param(
'~ground_frame_id'
,
''
)
15
self.
sub_bbox
= rospy.Subscriber(
'~input/bbox'
, BoundingBox, self.
_cb
)
16
self.
srv_client
= rospy.ServiceProxy(
'~save_mesh'
, SaveMesh)
17
self.
srv_server
= rospy.Service(
'~request'
, Empty, self.
_request_cb
)
18
self.
bbox_msg
=
None
19
20
def
_cb
(self, bbox_msg):
21
self.
bbox_msg
= bbox_msg
22
23
def
_request_cb
(self, req):
24
if
self.
bbox_msg
is
None
:
25
rospy.logerr(
'No bounding box is set, so ignoring the request.'
)
26
return
EmptyResponse()
27
28
req = SaveMeshRequest()
29
req.box = self.
bbox_msg
30
req.ground_frame_id = self.
ground_frame_id
31
self.srv_client.call(req)
32
return
EmptyResponse()
33
34
35
if
__name__ ==
'__main__'
:
36
rospy.init_node(
'save_mesh_server'
)
37
server =
SaveMeshServer
()
38
rospy.spin()
save_mesh_server.SaveMeshServer.sub_bbox
sub_bbox
Definition:
save_mesh_server.py:15
save_mesh_server.SaveMeshServer.srv_client
srv_client
Definition:
save_mesh_server.py:16
save_mesh_server.SaveMeshServer._request_cb
def _request_cb(self, req)
Definition:
save_mesh_server.py:23
save_mesh_server.SaveMeshServer.bbox_msg
bbox_msg
Definition:
save_mesh_server.py:18
save_mesh_server.SaveMeshServer
Definition:
save_mesh_server.py:11
save_mesh_server.SaveMeshServer.ground_frame_id
ground_frame_id
Definition:
save_mesh_server.py:14
save_mesh_server.SaveMeshServer.__init__
def __init__(self)
Definition:
save_mesh_server.py:13
save_mesh_server.SaveMeshServer.srv_server
srv_server
Definition:
save_mesh_server.py:17
save_mesh_server.SaveMeshServer._cb
def _cb(self, bbox_msg)
Definition:
save_mesh_server.py:20
jsk_recognition_msgs
Author(s):
autogenerated on Mon May 3 2021 03:02:56