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


flexbe_states
Author(s): Philipp Schillinger
autogenerated on Sun Dec 13 2020 04:01:46