During running, the
Step instances can signal unrecoverable errors by throwing an exception.
Pipeline can catch these exceptions and enter safe mode, if desired.
Recoverable failures should be handled using the state machine.
Do not use safe mode for safety critical functions!
The safe mode provided by the
Pipeline provides a way to handle exceptions in the code gracefully. However, it should not be used to implement safety critical functions! Your hardware (simulator, robot, etc.) is responsible for keeping all occupants and bystanders safe, even if the code running in the
Pipeline suddenly terminates, misbehaves, or communicates erroneous values.
The "guarded" option of the
Pipeline controls the behavior of the
Pipeline in response to exceptions.
Pipelinewill catch exceptions and enter safe mode.
false, neither the
MainActorwill catch the exception, and thus the
MainActor::Run()function will propagate the exception. The
Pipelineis now in an unrecoverable state and should not be used anymore.
The guarded option is set through the
Pipeline::Options::guarded boolean, or the
Pipeline.Guarded option in a configuration file.
In safe mode, the
SafeTick() methods of all
InOutput instances are called only.
That is, in safe mode, the
Pipeline will not call the
TaskCompleted() functions on
It will only call the
SafeTick() method on
SafeTick() method does not allow you to communicate to other
InOutput instances through a
In safe mode, each
InOutput should function autonomously and should not rely on information obtained from other
InOutput instances, because they might be the ones that threw the exception.
Be aware that safe mode should not be used to attempt to recover or continue operation. It is meant to gracefully shut down communication with other systems (such as a simulator or robot) as quickly as possible.