Exemplo n.º 1
0
def initialize_state_machine():
    # create machine object of class StateMachine and add states
    machine = StateMachine(cubesat)
    machine.cubesat = cubesat

    # Initialize Transitions
    low_power_transition = LowPowerTransition("lowpower", MIN_VOLTAGE)
    high_power_transition = HighPowerTransition("idle", MIN_VOLTAGE)

    # Add States
    machine.add_state(IdleState([low_power_transition]))
    machine.add_state(LowPowerState([high_power_transition]))

    # start off the StateMachine object in idle
    machine.go_to_state("idle")
    return machine