Skip to content
Onboard Safetycrouch

Onboard Safetycrouch

Andi Lamprecht Andi Lamprecht ·· 2 min read· Accepted
ADR-0098 · Author: Sybil Melton · Date: 2025-02-07 · Products: uncrew
Originally ADR-0098-OnBoard-SafetyCrouch (v3) · Source on Confluence ↗

Safety Crouch

JIRA Ticket

https://droneup.atlassian.net/browse/UNCREW-1310

Context

During the course of a mission, it is possible that an event would require the UAV to immediately hold its position and drop to a predetermined safe altitude.

Performing a Safety Crouch will pause the current mission and the mission will remain paused until the UAV can reattain its previous mission altitude, at which point it is possible to resume the mission.

Decision

  • In order to implement this feature, a Finite State Machine will be used to represent the different states and transitions. This will ensure that the sequencing is enforced as well as allowing for the state of the crouch to be easily readable.
  • The available actions within a safety crouch at each state are limited. Performing any illegal action (manual goto commands for example) will abort the safety crouch sequence and the mission it is associated with - as it would require replanning the path.
  • Any error notification will lead to a generic Error state, which will require logic specific to the error to decide how to respond (user input, retry, etc.).

Scenarios

Note: “Paused” relates to the state of the mission. “Hold” relates to the state of the UAV.

1e6dd434a445b5aa3ab787630d7eb024-safety-crouch.png

Alternatives Considered

C++ coroutines are a somewhat new tool which handles sequences of actions very well, as an alternative to multiple states and transitions. However, it does not inherently handle communication of its current place in the sequence or how to respond to errors or other branching logic. It might be possible to combine coroutines and FSM’s, but this would take the code away from established FSM frameworks and require additional development time for potentially little gain.

In lieu of a FSM, enumerations could exist to represent state easily, or it could be derived by conglomerations of data points. This is prone to issues where the enumerated state is not properly updated to represent the system in corner cases however. This approach is also harder to communicate to stake holders. A FSM provides a set of rules such that the current state encapsulates behaviors and the defined transitions to other states; this makes it more organized and easier to learn and debug than sequences of commands with guards for branching behavior.

Consequences

The states and transitions of states for the Safety Crouch are formally communicated and the behavior is well defined.

Last updated on