This package defines a "task" (any high-level action) server node, utilizing ROS Actionlib, that:
- Accepts task action requests
- Interfaces with a user's defined Task Handler that
- Checks the validity of the task and
- Constructs and returns an instance of a task that implements the base
AbstractTask
- Manages the life-cycle of your task, so creation, deletion, cancelation, abortion, failure, etc.
- Reports back failures and successes to the Action Client(s)
To use this package, you need to define a Python package called task_config with the following:
- A file called
task_configwhere you define aCommandHandlerandSafetyResponderclass.SafetyResponderis used if Safety is enabled and the system goes into a safety response state.
- These classes need to implement the interfaces laid out here and here
- Each of your tasks also need to implement the
AbstractTaskdefined here
- Action Server Name - Name of the action server to send requests to
- Safety Enabled - utilize the Iarc7 Safety Node Monitoring packages (see here for Iarc7 Safety)
- Update Rate - update rate of main state logic
- Startup Timeout - timeout on startup of node
- Force Cancel - if a task refuses to cancel, should the TaskManager force a cancel
- See the
actionfolder for the action message types used for the Action Server
- Tasks are not trusted, so every task interaction is wrapped for protection; this means, unless the node is in a fatal state, a troublesome task will not bring down the
TaskManagernode - Once a cancelation requests comes in, depending on the
Force Cancelparam, the behavior is the following:- If
True:- The task is canceled, regardless if it returned
Falseontask.cancel()
- The task is canceled, regardless if it returned
- If
False:- The current task is canceled if it returned
Trueon thetask.cancel()call; otherwise, it is allowed to continue running
- The current task is canceled if it returned
- If
- If a new action comes in while the current one is running, the behavior of the Actionlib is to make the server aware there is a new task available (and overwrite the pending action if a third action is requested before the first completes).
- However, the
TaskActionServerwill check that the new action request has thepreemptflag set toTrue - If so, the current task goes into a
Cancel Requestedstate - If not, the current task is allowed to continue running until it completes and then the new task takes over
- However, the
See here for an example Motion Task Config package setup.