### Author Topic: Fixing Line Follower Oscilation  (Read 893 times)

0 Members and 1 Guest are viewing this topic.

#### piotr3332

• Beginner
• Posts: 3
• Helpful? 0
##### Fixing Line Follower Oscilation
« on: April 24, 2013, 10:32:41 AM »
Hi

I  having trouble with
the steering of my line follower.  The problem I'm having is getting the robot
to track a straight line at higher speeds. On a straight line
the robot corrects a bit to the left and overshoots
the line a tiny amount then it corrects to the right and
overshoots a bit more, then left, then right, etc. each time
with larger overshoot until it loses the line.
I expect the left right left right ... oscillation but I don't
understand why the overshoot is growing and growing.

I am using PID algorithm. and I am using 5 sensors. 2 on left, 2 on right and 1 in middle.
Any idea how I can decrease such oscillation ,I am tweaking PID constants but, with no effect at high speed.

Thanks

#### jkerns

• Robot Overlord
• Posts: 270
• Helpful? 12
##### Re: Fixing Line Follower Oscilation
« Reply #1 on: April 24, 2013, 12:36:44 PM »
5 sensors - I assume that the input to your controller are the integer values 1 2 3 4 5 - correct?

I further assume that you are trying to differential steer with the driving wheel speeds.

I further further assume that you do not have feedback on the actual wheel speeds.

If that's the case, the D term is probably worthless. It will only react for one loop when you cross the threshold from one value to the other (unless you are doing some kind of filtering) Eliminate it.

The I term will tend to be destabilizing so use it sparingly just to correct for any difference between the two motors at any given commanded duty cycle.

Start with P only.

You may need to gain schedule (turn the P gain down as a function of speed).
I get paid to play with robots - can't beat that with a stick.

http://www.ltu.edu/engineering/mechanical/bachelor-science-robotics-engineering.asp

#### jwatte

• Supreme Robot
• Posts: 1,345
• Helpful? 82
##### Re: Fixing Line Follower Oscilation
« Reply #2 on: April 24, 2013, 01:25:04 PM »
You should be able to control this by reducing your P gain, and increasing your D and I gains.

Another option would be to add encoders to the wheels, so you can "drive straight" by design.

Edit: D is not worthless. D is the term that avoids overshoot when you compensate because of the P value. Basically, it allows you to limit how much correction you will apply each step, which is super valuable when trying to avoid overshoot oscillation.
« Last Edit: April 24, 2013, 01:26:30 PM by jwatte »

#### jkerns

• Robot Overlord
• Posts: 270
• Helpful? 12
##### Re: Fixing Line Follower Oscilation
« Reply #3 on: April 24, 2013, 01:39:50 PM »
Edit: D is not worthless. D is the term that avoids overshoot when you compensate because of the P value. Basically, it allows you to limit how much correction you will apply each step, which is super valuable when trying to avoid overshoot oscillation.

Depends on how it is implemented.

If they are just putting the integer values into the D, you get a step that only lasts one control loop time and then goes away - actual effect on the control will be minimal. If they have some filtering on the input to the D, then it might work. Or, if they are processing the sensor inputs to give a more continuous range of the position then it will work better.
I get paid to play with robots - can't beat that with a stick.

http://www.ltu.edu/engineering/mechanical/bachelor-science-robotics-engineering.asp

#### jwatte

• Supreme Robot
• Posts: 1,345
• Helpful? 82
##### Re: Fixing Line Follower Oscilation
« Reply #4 on: April 25, 2013, 01:11:14 PM »
Quote
If they are just putting the integer values into the D, you get a step that only lasts one control loop time and then goes away - actual effect on the control will be minimal.

The previous steps' D value will go away, but the current steps' D value will instead be replaced. Basically, D will serve to limit the slew rate of any correction. If you are moving fast, D will dampen that, each step.

Get Your Ad Here

data_list