Skip to content

State Manager

State Manager

The TrackMan 3e navigates from one state to another using a Finite State Machine. The diagram below shows the FSM. The main job of the FSM is to try and keep the system out of error states, as auto-recovery kicks in every time the system enters an error state.

State Manager

States

Initializing

Upon normal startup (one short click on the power button), the device will enter this state.

Exit conditions:

  1. All goes well, go to Idle

  2. Initialization fails, go to InitializeFailed

InitializeFailed

When initialization fails, the device will try to auto-recover from the failure.

Exit conditions:

  1. The error that got it into this state is resolved, go to Initializing

Recovery

If the power button is held down for 4 seconds, the device will enter this state.

From here it is very limited what the device can do.

Exit conditions:

  1. If a firmware update is requested, go to FirmwareUpdate

FirmwareUpdate

If a firmware update is initiated, then state changes to FirmwareUpdate.

Exit conditions:

  1. On firmware update complete, reboot system

Idle

When the device enters idle, the webserver and camera is enabled. This is done to be able to get an image much faster when entering Active state.

Exit conditions:

  1. User logs in through HTTP POST. Go to Active

  2. An error occurs. Go to Error

Active

Here the device can be controlled, GPS and Leveling is enabled

Exit conditions:

  1. IsMeasuring is set to true. Go to Measuring

  2. An error occurs. Go to ActiveError

  3. An unrecoverable error occurs. Go to Error

ActiveError

An error occurred in Active.

Exit conditions:

  1. Could recover from error, go to Active

  2. Could not recover, go to Error

Measuring

Here measuring is enabled, and leveling is disabled.

Exit conditions:

  1. No activity (strokes hit or login tokens requested for xxx seconds)

MeasuringError

An error occurred in Measuring.

Exit conditions:

  1. Could recover from error, go to Measuring

  2. Could not recover, go to Error

Error

If the system cannot recover from ActiveError or MeasurementError or another state transitions to Error this is where the system ends up.

Exit conditions:

  1. If Recovered from error, go to Init

  2. Restart

How to handle error states

Whenever the systemstate changes to one of the errorstates, either a message or a warning graphics should be presented to the user.

ActiveError / MeasuringError

When this happens, the best thing would be to show a warning to the user and let it try to recover from the error for a period of time. If this is a success, continue to where the user left off.

Error

If the system continues into Error, it's advisable to reboot the TrackMan if it cannot get into Idle, and therefore also restart the app (or go to wherever communication with the TrackMan begins).