publisher_bool_state.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 
00004 from flexbe_core import EventState, Logger
00005 from flexbe_core.proxy import ProxyPublisher
00006 from std_msgs.msg import Bool
00007 
00008 '''
00009 Created on 31.01.2017
00010 
00011 @author: Alberto Romay
00012 '''
00013 
00014 
00015 class PublisherBoolState(EventState):
00016     '''
00017         Publishes an empty (std_msgs/Bool) message on a given topic name.
00018 
00019         -- topic        string          The topic on which should be published.
00020 
00021         >= value                                        Value of bool.
00022 
00023         <= done                                         Done publishing.
00024 
00025         '''
00026 
00027     def __init__(self, topic):
00028         '''
00029                 Constructor
00030                 '''
00031         super(PublisherBoolState, self).__init__(outcomes=['done'], input_keys=['value'])
00032 
00033         self._topic = topic
00034         self._pub = ProxyPublisher({self._topic: Bool})
00035 
00036     def execute(self, userdata):
00037         return 'done'
00038 
00039     def on_enter(self, userdata):
00040         val = Bool()
00041         val.data = userdata.value
00042         self._pub.publish(self._topic, val)


flexbe_states
Author(s): Philipp Schillinger
autogenerated on Thu Jun 6 2019 19:32:33