panoptes.pocs.state package

Submodules

panoptes.pocs.state.machine module

class panoptes.pocs.state.machine.PanStateMachine(state_machine_table, **kwargs)[source]

Bases: transitions.core.Machine

A finite state machine for PANOPTES.

The state machine guides the overall action of the unit.

after_state(event_data)[source]

Called after each state.

Parameters:event_data (transitions.EventData) – Contains information about the event
before_state(event_data)[source]

Called before each state.

Parameters:event_data (transitions.EventData) – Contains information about the event
check_safety(event_data=None)[source]

Checks the safety flag of the system to determine if safe.

This will check the weather station as well as various other environmental aspects of the system in order to determine if conditions are safe for operation.

Note

This condition is called by the state machine during each transition

Parameters:
  • event_data (transitions.EventData) – carries information about the event if
  • from the state machine. (called) –
Returns:

Latest safety flag

Return type:

bool

goto_next_state()[source]

Make a transition to the next state.

Each state is responsible for setting the next_state property based off the logic that happens inside the state. This method will look up the transition method to reach the next state and call that method.

If no transition method is defined for whatever is set as next_state then the park method will be called.

Returns:If state was successfully changed.
Return type:bool
classmethod load_state_table(state_table_name='simple_state_table')[source]

Loads the state table

Parameters:state_table_name (str) – Name of state table. Corresponds to file name in $POCS/resources/state_table/ directory or to absolute path if starts with “/”. Default ‘simple_state_table’.
Returns:Dictionary with states and transitions keys.
Return type:dict
mount_is_initialized(event_data)[source]

Transitional check for mount.

This is used as a conditional check when transitioning between certain states.

mount_is_tracking(event_data)[source]

Transitional check for mount.

This is used as a conditional check when transitioning between certain states.

next_state
run(exit_when_done=False, run_once=False)[source]

Runs the state machine loop

This runs the state machine in a loop. Setting the machine property is_running to False will stop the loop.

Parameters:
  • exit_when_done (bool, optional) – If True, the loop will exit when do_states has become False, otherwise will wait (default)
  • run_once (bool, optional) – If the machine loop should only run one time, defaults to False to loop continuously.
stop_states()[source]

Stops the machine loop on the next iteration

Module contents