
=================== File purpose ===============================

(1) Drivers: 

steering_motor.c/h -> driver for servo/steering motor

regulrar_motor.c/h -> driver for regular motor

ultrasonic_sensor.c/h -> driver for ultrasonic sensors

driver_functions.c/h -> helper functions for all peripherals above.

socfpga.dts/dtsi -> device tree


(2) Main program:

parking_robot.c/h -> user interface for command input. It’s also responsible dispatching the following thread:
(a) Data collecting thread -> used to collect the four ultrasonic sensors’ data
(b) Auto parking thread -> the main functionality of this thread is to let the car drive along the wall and keep a certain distance (trace adjustment). A requirement for making the mechanism work correctly is that the car need to be within 30 cm from the wall when starting the thread. If you choose auto_parking -> parallel_parking in the user interface, it will drive along the wall, and will start parallel_parking when finding an enough parking space. Note that the parallel parking function it calls is in parallel_parking.c, not parallel_parking_independent.c

parallel_parking.c/h -> the parallel parking procedure that is able to collaborate with trace adjustment mechanism. This is modified from parallel_parking_independent.c

parallel_parking_independent.c/h -> this is the parallel parking procedure that can run itself without the help from auto parking thread (trace adjustment). However there’s a possibility that it will go out of trace and then failed to park. Note that when running this function, you’re not able to do other things since it’s running on main thread.

garage_parking.c ->  this is the garage parking procedure that can run itself without the help from auto parking thread (trace adjustment). However there’s a possibility that it will go out of trace and then failed to park. Note that when running this function, you’re not able to do other things since it’s running on main thread.


========================= RUN =======================

To compile the drivers, please run:
make

To compile our program, please run:
gcc -pthread -o parking_robot parking_robot.c parallel_parking.c garage_parking.c driver_functions.c parking_robot_independent.c -lm


