Tuesday, March 29, 2016

Proportional Control

Last time we used Bang Bang Control this time we are doing the same thing but with Proportional Control!\
So what's the  difference?
Bang bang: Turns the on or off
Proportional: The farther you are from the goal the more you correct, the closer you are to the goal the less you correct so for proportional control power is proportional to error, and error=goal-reality.     Power=error x Kp where Kp = constant of proportionality or gain
The thing to keep in mind when using proportional is that is gain is too high it can overshoot the goal and if gain is too low it will never reach the goal.

Drive straighter
For our first code we found that nothing really helped make the SciBorg go straighter, so we tested the motors again and found that motor 1 is faster. So we switched the code to make (motor1-motor2)+rpms2 and lowered motor1's speed. Then we tried other Kp  values starting from -.01 which started pretty straight but eventually curved a lot until we got the right constant for us, which was
Kp =-1.

Different Surface Trials:
"Normal" (lab floor): goes straight
"High Friction" (Carpet): turns a little. Hypothesis: the added friction makes the car turn a little because any natural difference between power of the motors is hieghtened and also the ball has a harder time rolling onthe surface
"High Friction/Low Friction" (One wheel on carpet one wheel on flat sticker): it turns when the naturally faster motor is on high friction but not when the faster motor is on low friction. Hypothesis: high fric/low fric is basically a correction so with our added correction in the code it does not run straight.

Go 10 feet
We found the total position for 10 ft to be 12650 and then tried different Kp  values until we got the right one which was: .01
We found that this is not very accurate, as it would often stop around 3 inches away from the finish line. This is due to the "under shoot/overshoot" problem cause by the nature of proportional control and introducing gain.


Nudge: This function is used to make the "Drive 10 ft" more accurate by adding a little nudge when the Sciborg starts to slow to a halt. We did this by finding the position of the SciBorg when it slows to a halt with our laptop and adding another proportional control in "else" to make it nudge. Using this we got the SciBorg to land right on top of the line!

Ultrasonic Sensor:
This task was pretty straightforward, because following another object is something proportional control is naturally good at doing, due to it's ability to gauge how much it needs to correct based off distance.

Follow the Line:
The biggest difficultly we had here was finding the perfect Kp for the SciBorg to move at the right angle.
We found that proportional control was far more smoother and faster at following the line, which makes sense because Bang Bang was always on or off so it was very choppy.

No comments:

Post a Comment