LAB 8 - Stunts

Mar 24th, 2022

Controlled Stunts

Task A: Don’t Hit the Wall!

dis dc

In this part, I first measured the distance from the required flip point to the wall which is 800mm, and set it to be the set_point of PID control.
Then I implemented the PID control only via ToF readings, which made the car rush towards the set_point and braked hard after crossing the line (See LAB 6). Due to the high ground friction, the car flipped due to inertia.
After the car flipped over, the ToF reading is incorrect due to the position of the ToF Sensor being too close to the ground (Ground shadows and ambient lighting interfere with tof readings). As can be seen from the graphs above, the ToF readings were always less than the set_point (800mm) after flipping, making the car get a negative duty cycle which dramatically made the car moving back to the starting line.
If the TOF reading is correct, it should read a larger value than set_point, which make the car to get a positive duty cycle and keep moving forward until it hits the wall.

Open Loop

Repeatable Stunts: Standing Up

In this part, I designed a stunt called "Standing Up" which means the car stands up like a dog.

I use readings of gyroscope in the IMU sensor to calculate the pitch angle of the car in real time to control its standing via PID (See LAB6).
I set the error in the original PID control as (pitch - set_point) and make the set_point to be 0. So the car will always try to keep the pitch to be 0 which is what it looks like when it initially starts up.
Then I helped the car to a vertical attitude and start the PID control. After letting go, the car will continuously adjust the positive and negative of duty cycle through PID control to keep the pitch angle unchanged, which makes it stand up. The absolute value of duty cycle is fixed at 100% so that the car can get the maximum power to adjust its posture.
Thanks to the high sampling frequency of the IMU, the car can adjust its posture at a relatively high frequency and maintain the balance for a short period of time.
Due to the low friction on the ground, when the car falls to one side, it will not be able to restore its equilibrium position through motors. I believe it will perform much better on surfaces with high friction.

Below are some more demo videos for repeatability:

Bloopers

I didn't limit the car's moving range at first, making it keep sprinting (trying to stand up) after falling to one side until it hit something. Eventually I found a wire soldered to the ToF's xshut was broken so I need to re-solder it later.