|
|
int | max_steer = 600; |
| | Creating an array of Point objects.
|
| |
|
bool | two_motors = True; |
| | Flag used during debugging.
|
| |
|
| motor_drive = Motor(Port.A); |
| | Initialize the drive motor.
|
| |
|
| sen_us = UltrasonicSensor(Port.S1); |
| | init Ultrasonic sensor.
|
| |
|
| sen_gyro = GyroSensor(Port.S2,Direction.CLOCKWISE); |
| | Init Gyro sensor.
|
| |
|
| emergency_button = TouchSensor(Port.S4); |
| | touchsensor is also the ESTOP button
|
| |
|
int | start_distance = 0; |
| | Variable used to store the start distance during object detection.
|
| |
|
int | end_distance = 0; |
| | Variable used to store the start distance during object detection.
|
| |
|
bool | run_flag = False; |
| | Flag used to see if the drive motor needs to be active.
|
| |
|
int | button_press_ctr = 0; |
| | ESTOP Button Press samples counter.
|
| |
|
int | center_button_ctr = 0; |
| | Center Button pressed samples counter.
|
| |
|
int | left_button_ctr = 0; |
| | Left button pressed samples counter.
|
| |
|
int | man = 0; |
| | Index for segments in path planning.
|
| |
|
int | detect_flag = 0; |
| | Flag used to detect the start first object.
|
| |
|
int | parking_spot_detected = 0; |
| | Flag to detect if the parking spot is successfully detected.
|
| |
|
int | detect_obj1_flag = 0; |
| | Flag to detect if first object was successfully detected.
|
| |
|
int | obj1_valid = 0; |
| | Flag to denote if first object is valid.
|
| |
|
int | obj1_last_distance = 0; |
| | Variable to store the last detected Ultrasonic Sensor Distance.
|
| |
|
int | start_distance_obj1 = 0; |
| | Start Distance variale to store the distance value when object 1 was detected which helps us to calculate the length of the object.
|
| |
|
int | obj1_distance = 0; |
| | Length of the object 1.
|
| |
|
int | parking_length_detected = 0; |
| | Flag to denote if a valid parking length for parallel parking manuevre was detected.
|
| |
|
int | park_distance = 0; |
| | Variable to store the current parking spot length to check if it valid.
|
| |
|
int | detect_obj2_flag = 0; |
| | Flag to detect if second object was successfully detected.
|
| |
|
int | obj2_valid = 0; |
| | Flag to denote if second object is valid.
|
| |
|
int | start_distance_obj2 = 0; |
| | Start Distance variale to store the distance value when object 2 was detected which helps us to calculate the length of the object.
|
| |
|
int | obj2_distance = 0; |
| | Length of the object 2.
|
| |
|
int | park_flag = 0; |
| | Flag used to wait for park confirmation.
|
| |
|
str | previous_state = 'init_0'; |
| | Variable to store previous state.
|
| |
WS23-24 Semi Autonomous Program.
Description
This is main file of the application, where the main thread runs. The main thread runs in the an infinite while loop and it has the following structure:
- Peripheral and Data Initialization
- Main thread
- Acquisation of User Inputs
- Run the Drive Module functions
- Acquisation of the Statemachine Events
- Run the StateMachine
- Run StateMachine Callbacks