Lab 12PATH PLANNING AND EXECUTION
Woo! The purpose of this lab is to combine everything that we have learned from the previous 11!! labs to be able navigate our robot through a maze while hitting the waypoints that were specified. The final lab!
Design Approach
The spots on the map (below) that have an orange tap on them are the spots that we needed to hit. I also worked with grace on this lab!
This is the planned trajectory that I had.
I decided to implement PID control to help the robot navigate through the maze. When planning out my code, I wanted break up the sections into discrete chunks to be able to incrementally test
To achieve this, I designed 3 main arduino functions - FORWARD, TURN_POS_90, and TURN_NEG_90. Diving into the implementation ->
FORWARD: This command will stop the car after reaching a set distance. This function takes in the KP value + target distance - so it can be adapted for multiple sections of the map and I would not have to re upload the code. The steps go as follows: 1. Receive KP + Target distance 2. Receive TOF sensor data 3. Calculate error and adjust movement scale in accordance 4. Move forwards/backwards according to PID I only used a P controller to avoid integrator windup and also less overshoot. The code for this command is seen below.
TURN_POS_90: This command turn the car CW a specific value by adapting the code from Lab 9. The car keeps track of its angular position by with the angular velocity found from the gyroscope. This function also takes in the KP value + target distance. 1. Receive KP + Target angle 2. Receive IMU gyroscope data 3. Calculate error and adjust movement scale in accordance 4. Move according to PID The code for this command is seen below.
TURN_NEG_90: This command turn the car CCW a specific value by adapting the code from Lab 9. The car keeps track of its angular position by with the angular velocity found from the gyroscope. This function also takes in the KP value + target distance. 1. Receive KP + Target angle 2. Receive IMU gyroscope data 3. Calculate error and adjust movement scale in accordance 4. Move according to PID The code for this command is seen below.
After initalizing all these commands and testing them on the side, I then moved to the map to begin to attack the pathway. On the python side, this required a lot of tuning due to environmental factors.
JUPYTER SIDE
These are the final commands that I ended up settling on after multiple hours of tuning!
CHALLENGES + TESTING
Tuning the Jupyter side was the hardest part. The Arduino side only required some manipulation of the setup to ensure there was no slowdown or noise from the sensors. Since I had paramterized the KP value + distance, each waypoint required precise tuning of the values to make sure that I had the expected path. I started off calculating the values for each waypoint individually, but after I had those tuned perfectly, I struggled with the integration. Since I only used PID control, the ending position of one waypoint was not necessarily the best starting point of the other waypoint. That led to me having to retune the parameters for each one. Then I decided to do the pathway in chunks - hoping that would allow for some easier integration. That ended up being the best strategy expect then both artemis + motor batteries starting glitching, I lost a TOF sensor (rip), and the lab slowly became more dense.
RESULTS
These are the results for the 3 sections that I worked on - as seen they are pretty accurate on their own which was really exciting for me.
As for a complete run, I was not able to get the perfect and ideal run I wanted because of the density and length of my fellow lab mates trials and also because of travel constraints. HOWEVER, all hope was not lost -> I ended up getting 2 pretty solid runs that I was happy with consdering the hardware issues I have been facing. These are seen below.
REFLECTION & ACKNOWLEDGEMENTS
Thank you so much to all the wonderful TA's for having so many lab hours and for all their help + Professor Petersen for the course + lectures. This was a really challenging course but I learned a lot about robotics and met some really cool people, so for that I will be forever grateful. Special thank you to Anya + Johnathan, my lab TAs, for explaining various concepts to me and being supportive and encouraging when my robot would fail. See ya next time!!! :)