Main Page
Namespaces
Classes
Files
File List
nodes
triggerService.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
import
sys
3
4
import
rospy
5
from
std_srvs.srv
import
Trigger, TriggerResponse
6
7
confirm_msg =
"trigger received"
8
9
10
def
handle_msg
(rq):
11
print(
"Trigger Node got request"
)
12
return
TriggerResponse(success=
True
, message=confirm_msg)
13
14
15
def
trigger_server
():
16
args = rospy.myargv(argv=sys.argv)
17
node_name = args[1]
if
len(args) > 1
else
'trigger_node'
18
19
rospy.init_node(node_name)
20
rospy.set_param(
'/test/confirm_param'
, confirm_msg)
21
srv = rospy.Service(
'/test/trgsrv'
, Trigger, handle_msg)
22
rospy.spin()
23
if
rospy.has_param(
'/test/confirm_param'
):
24
rospy.delete_param(
'/test/confirm_param'
)
25
26
27
if
__name__ ==
'__main__'
:
28
trigger_server
()
triggerService.trigger_server
def trigger_server()
Definition:
triggerService.py:15
triggerService.handle_msg
def handle_msg(rq)
Definition:
triggerService.py:10
pyros_test
Author(s): AlexV
autogenerated on Mon Jun 10 2019 14:20:23