publisher_string_state.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 
4 from flexbe_core import EventState, Logger
5 from flexbe_core.proxy import ProxyPublisher
6 from std_msgs.msg import String
7 
8 '''
9 Created on 9.11.2017
10 
11 @author: Alireza Hosseini
12 '''
13 
14 
15 class PublisherStringState(EventState):
16  '''
17  Publishes a string (std_msgs/String) message on a given topic name.
18 
19  -- topic string The topic on which should be published.
20 
21  >= value Value of string.
22 
23  <= done Done publishing.
24 
25  '''
26 
27  def __init__(self, topic):
28  '''
29  Constructor
30  '''
31  super(PublisherStringState, self).__init__(outcomes=['done'], input_keys=['value'])
32 
33  self._topic = topic
34  self._pub = ProxyPublisher({self._topic: String})
35 
36  def execute(self, userdata):
37  return 'done'
38 
39  def on_enter(self, userdata):
40  val = String()
41  val.data = userdata.value
42  self._pub.publish(self._topic, val)


flexbe_states
Author(s): Philipp Schillinger
autogenerated on Wed Jun 5 2019 21:52:08