publisher_bool_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 Bool
5 
6 
7 class PublisherBoolState(EventState):
8  '''
9  Publishes an empty (std_msgs/Bool) message on a given topic name.
10 
11  -- topic string The topic on which should be published.
12 
13  >= value Value of bool.
14 
15  <= done Done publishing.
16  '''
17 
18  def __init__(self, topic):
19  super(PublisherBoolState, self).__init__(outcomes=['done'], input_keys=['value'])
20  self._topic = topic
21  self._pub = ProxyPublisher({self._topic: Bool})
22 
23  def execute(self, userdata):
24  return 'done'
25 
26  def on_enter(self, userdata):
27  val = Bool()
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