flexbe_states.subscriber_state module
SubscriberState.
- class flexbe_states.subscriber_state.SubscriberState(*args: Any, **kwargs: Any)
Bases:
EventState
Gets the latest message on the given topic and stores it to userdata.
– topic string The topic on which should be listened. – msg_type type The type of messages of this topic. – blocking bool Blocks until a message is received. – clear bool Drops last message on this topic on enter
in order to only handle message received since this state is active.
– qos QoSProfile A QoSProfile to apply to the subscription.
#> message object Latest message on the given topic of the respective type.
<= received Message has been received and stored in userdata or state is not blocking. <= unavailable The topic is not available when this state becomes actives.
- execute(userdata)
Execute and update user data with the last message received.
- on_enter(userdata)
Subscribe to topic if not connected, and clear old messages.
- on_stop()
Unsubscribe topic when behavior stops.