Have you ever felt cravings for something sweet but realized that they're hidden behind some impossible-to-traverse obstacles. Only one machine is fit for the task... the Cookie Soldier.
The Cookie Soldier is based on Professor Dan Block's segbot, a project done for ME461 (Computer Control of Mechanical Systems) at the University of Illinois at Urbana-Champaign. By replacing one of the front buttons, originally used to control the on-board LED's, I attached a bump switch. The bump switch essentially functions as a larger button. I attached a rod to the bump switch to have slightly more sensitive feeling capabilities. I soldered the bump switch's ends to the cut wire of the button and adhered it to the front of the bot.
Getting the bot to turn was quite a challenge. Base turning code was provided from ME461, but a right turn consists of keeping the left motor in place and reversing the right motor, while a left turn is rotating the right motor forward, but the left motor moves slightly back. This means the radius of turns is slightly different between the two, so I needed to calibrate the turning radius to make sure they're about the same.
Furthermore, consecutive left or right turns aren't the same distance as they were for the first time. This only occurs when there are 2 or more of the same direction turn after another. Again, to offset this, calibration had to be made to allow for turning to occur correctly.
When the bot's bump switch gets activated, it stops in place and then reverses. To determine how far back it needs to go, it saves the position of the motors at the instance of the bump triggering, sets the velocity to go backward, and subtracts the current motor's position from the previous, stopping once the difference exceeds the encoder value. This encoder value distance is calculated by finding the circumference of the wheels. Multipliers are added to the threshold for calibration purposes.
By analyzing the course, you can set the robot to follow a certain set of directions by utilizing the bump switch. Just by setting the robot to move forward, and by keeping track of the bump count, easy function calls can be made to direct the robot to follow a certain path. This was done in the software interrupt section.
Once the bot reaches its prize, it triggers the final bump count value function and displays the message 'COOKIES!!!' on the LED's. The top left and bottom right led GPIO's were used for different purposes, and thus don't display. This is particularly evident on the 'K' character for the LED's.
There were, however, a few fixes needing to be made. First, the code enters the software interrupt earlier than expected, so an initial bumpCheck variable needed to be added to see if that occurs. Next, there was the calibration of the consecutive turns, which was difficult to calibrate as some of the distance changes would seem almost random. Furthermore, the backup distance is relative to whether a right turn or a left turn will be made, as the radius of curvature is different for both. Therefore, I made both a half back up function and a full back up one, there the bot will move backward at a different distance.
This project was certainly fun, and quite a learning experience as well. Overall, it was great to work on and I will continue to tinker with the segbot going forward. I plan to add functionality for the path to be displayed on the LED's as it moves, and also have the bot play a song using the piezo once it reaches the end.
Thank you to Professor Dan Block for the assistance this semester, and thank you to TI for supplying the F28379D Launchpad Board, it's been a pleasure to work on.
For any additional questions regarding the project, please message me here or email Professor Dan Block at d-block\at\illinois.edu
Comments
Please log in or sign up to comment.