Simulates a elevator moving between Floor 1 and Floor 2. More...
Functions | |
def | elevator_fsm.motor_cmd (cmd) |
Commands the motor to move up, down or stop. More... | |
def | elevator_fsm.button1_cmd () |
Commands the button 1 to be pushed. More... | |
def | elevator_fsm.button2_cmd () |
Commands the button 2 to be pushed. More... | |
def | elevator_fsm.floor1_sensor () |
Senses if elevator is on floor 1. More... | |
def | elevator_fsm.floor2_sensor () |
Senses if elevator is on floor 2. More... | |
Variables | |
int | elevator_fsm.state = 0 |
initial state is the init state | |
Simulates a elevator moving between Floor 1 and Floor 2.
Implements a finite state machine, shown below, to simulate the behavior of an elevator transtioning between floor 1 and floor floor 2. A randomizer is used for button selection to indicate whether the elevator will go to a different floor or stay put. The link to the code can be found here: https://bitbucket.org/mzaman01/me305_labs/src/master/hw%202/elevator_fsm.py
def elevator_fsm.button1_cmd | ( | ) |
Commands the button 1 to be pushed.
def elevator_fsm.button2_cmd | ( | ) |
Commands the button 2 to be pushed.
def elevator_fsm.floor1_sensor | ( | ) |
Senses if elevator is on floor 1.
def elevator_fsm.floor2_sensor | ( | ) |
Senses if elevator is on floor 2.
def elevator_fsm.motor_cmd | ( | cmd | ) |
Commands the motor to move up, down or stop.
cmd | the command to give the motor |