Main Page
Namespaces
Classes
Files
File List
src
flexbe_states
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.publisher_string_state.PublisherStringState._topic
_topic
Definition:
publisher_string_state.py:33
flexbe_states.publisher_string_state.PublisherStringState
Definition:
publisher_string_state.py:15
flexbe_states.publisher_string_state.PublisherStringState.__init__
def __init__(self, topic)
Definition:
publisher_string_state.py:27
flexbe_states.publisher_string_state.PublisherStringState.on_enter
def on_enter(self, userdata)
Definition:
publisher_string_state.py:39
flexbe_core::proxy
flexbe_states.publisher_string_state.PublisherStringState._pub
_pub
Definition:
publisher_string_state.py:34
flexbe_states.publisher_string_state.PublisherStringState.execute
def execute(self, userdata)
Definition:
publisher_string_state.py:36
flexbe_states
Author(s): Philipp Schillinger
autogenerated on Wed Jun 5 2019 21:52:08