Ignacio Romo's GitHub for ECE 4160.

Home
1
2
3
4
5
6

Lab 8: Stunts.

Straighten up and drive right, revisited

Retune the PID controller to decrease oscillations.

The results from the previous labs would be enough to prove that the robot and code are ready to perform the stunt. However, I wanted to eliminate the oscillations observed in the robot as it turned around.

Click here to be directed to a part of lab 6 showing the oscillation in the robot as it tries to move forward after a rotation.

I had originally reported that a negative integration constant "k_i" seemed to have reduced these oscillations. However, this improvement in performance proved to be temperamental. It was a modest correction at best, and at worst would add a permanent curve on the robot's track or cause the system to become unstable. Through further experimentation with the PID system, I discovered that a high derivative constant (k_d of 17.0) reduced oscillations significantly. A small, positive integration constant was reintroduced to allow for small corrections in the robot. This new PID tuning was tried with great results, as you'll see on the following run performed on carpet.

The run was taken at a reduced speed from full, to avoid crashing as seen below when speed was higher.

The floor of Phillips hall where the stunt will probably have less traction than carpet, but this was not observed to matter. This run was recorded just as a demo of the improved PID controller avoiding the wobbliness seen before.

Click here to be directed to a part of lab 6 showing this wobbliness.

With this marked improvement in orientation stability, I was confident that the turning part of the stunt was as fast as it could be, and I could continue on to speed improvements.

Gotta go fast

Working on increasing the speed of stunt execution.

To avoid hitting the wall, I programmed the robot to reduce it's speed as it approaches the wall. I created a function "scale" that returns a factor between 0 and 1 to determine what fraction of the base speed to output to the motors.

The function took in a distance value and outputted a scale factor. The function was designed to be a ramp function that ramps to 0.0 after the distance is at a certain point from the wall. As a measure to increase speed while returning, the factor was only relevant if the turn hadn't been completed. This was important to make sure that the robot didn't start turning prematurely. So basically, the robot had to go slower to let it go faster.

Adding this speed scaling behavior is the last thing to implement in the PID function covered in lab 6.

Click here for more on the Kalman filter implementation in lab 7.

In-N-Out

Execution of the stunt.

At last, the stunts were performed and recorded. When running I expected to have to tweak some values of the robot, such as the stopping distance or speed ramp formula, but the values I got from tuning for the carpet (an area I had easy access to compared to Phillips Hall) worked great on the floor and mat. The stunts were recorded and the video below has footage of them.

Data is available for lap 3, with the kalman-filtered distance, motor PWM values, and sensor readings.

Lap 3 Data

Motor PWM values during lap 3.

Distance measurements/estimates for lap 3.


I'm done.

Home