betfsm_crospi.CrospiTask

Bases: Fallback

__init__(name, task_name, srv_name='/crospi_node', cb=default_parameter_setter, event_topic='crospi_node/events', timeout=Duration(seconds=1.0), node=None, eventqueue_size=10, max_age=0.1, event_check=True)

returns a subtree that starts an eTaSL task on a cROSpi node. The first two arguments are the most important, all the others have reasonable default settings. the event_check parameter is useful when you just want to startup the Crospi task and call CrospiDeactivate(...) yourself.

This tasks still starts by calling deactivate and cleanup on the crospy lifecycle. This takes care of Crospi being in the wrong state of its lifecycle due to a previous run of another application with an error.

Parameters:
  • name (str) –

    name of this state machine (i.e. task instance)

  • task_name (str) –

    name of the task to be executed (i.e. task type) Will be looked up in the blackboard.

  • srv_name (str, default: '/crospi_node' ) –

    name of the eTaSL node, by default /crospi_node

  • cb (Callable, default: default_parameter_setter ) –

    callback that sets the parameters, with signature def cb(blackboard) ->param where param is a Dict with the parameters of the task that will be used to update the default parameters.

  • event_topic (str, default: 'crospi_node/events' ) –

    topic where the events are read. Topic should be of type std_msgs/msg/string

  • timeout (Duration, default: Duration(seconds=1.0) ) –

    [optional] returns TIMEOUT if the communication timeout of any of the substeps is exceeded. Uses a duration of 1 second otherwise.

  • node (Node, default: None ) –

    [optional] ROS2 node to be used. Uses BeTFSMNode.get_instance() otherwise.

  • eventqeueu_size

    minimum size of the event queue that receives crospi events.

  • max_age (float, default: 0.1 ) –

    maximum age in seconds that is allowed to be received.

  • event_check (bool, default: True ) –

    when false, just starts the crospi task but do not check for e_finished event or deactivate/cleanup crospi otherwise wait while checking and deactivate/cleanup crospi afterwards.