panoptes.pocs.state package

Subpackages

Submodules

panoptes.pocs.state.machine module

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

Bases: 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

  • machine. (called from the state)

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='panoptes')[source]

Loads the state table :param state_table_name: Name of state table. Corresponds to filename in

$POCS/conf_files/state_table/ directory or to absolute path if starts with “/”. Default ‘panoptes.yaml’.

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.

property next_state
run(exit_when_done=False, run_once=False, park_when_done=True, initial_next_state='ready')[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)

  • park_when_done (bool, optional) – If True (the default), park the mount when loop completes (i.e. when keep_running is False).

  • run_once (bool, optional) – If the machine loop should only run one time, if False (the default) loop continuously.

  • initial_next_state (str, optional) – The first state the machine should move to from the sleeping state, default ready.

stop_states()[source]

Stops the machine loop on the next iteration by setting do_states=False

Module contents