Objective
The goal of this lab is to perform a stunt with the robot using the techniques we've built so far.
The goal of this lab is to perform a stunt with the robot using the techniques we've built so far.
[UPDATED 4/12/25] For the flip, I used open-loop control. I sent a Bluetooth command to start the flip. I broke the flip up into several steps, and set "timers" for each:
To weigh the robot down, I taped a bundle of 3/16" endmills to the battery compartment. To make it easier to flip the robot, I wanted to keep its center of mass higher above the ground so I flipped the robot over. That's why I tell the robot to move backwards at first. In the above snippet I also initialized my ToF sensors wrong, so my "side" sensor is actually the one in front.
I tried implementing a Kalman filter in Arduino, but it doesn't work yet. I previously had a code snippet here, but I've since moved an updated version to the Lab 7 page. For this lab, I re-used my `extrapolate` function from Lab 5.
Below is a video of a successful flip. At the end my robot runs off because I set the delay time to 2 seconds.
Because I hard-coded the flip sequence with delay() statements, I was only able to get data for the initial step where the robot was driving towards the wall.
I was hoping to find a "quick and dirty" way to be able to collect data in the case statement. I started writing a bunch of sequential while loops, each for one step of the flip process (I essentially tried to replace the delay statement with a while loop that was tracking time). It didn't work, but I did get this video:
For the sake of staying on track, I will probably leave the stunt as is and move onto Lab 9. If I have time to come back to this, I will probably try to implement the flip in the main loop and use global flags to signal when to switch to the next sequence.
I looked at Bhadra Bejoy's website from spring 2023 to get an idea of what time values to use for each step of the flip sequence.