Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: PID Line Follower

  1. #1
    Join Date
    Jul 2015
    Location
    Brazil
    Posts
    2

    Talking PID Line Follower

    Hey guys! My team did a video tutorial about PID Line Follower. In recent days, we decided to put subtitles to reach more people in the world and so receive a greater feedback.

    We hope that the video help you somehow! We are open to any kind of feedback! Thank you!

    Video link: https://www.youtube.com/watch?v=tn6vj7AjEaU&t=2s




    Thunderboticos Robotic Team (Brazil)

  2. #2
    Join Date
    May 2015
    Posts
    277

    Default Re: PID Line Follower

    Thanks Thunder! Its really nice how you explain why the parts are necessary. My team wrote their PID line follower 3 years ago and some of those team members are aging out. During the off season I wanted the younger team members to follow down the same exploratory path to come up with their own line follower and I think the first half of the video (before the code) sets the discussion up nicely. Thanks for the translation!

  3. #3
    Join Date
    Sep 2008
    Location
    Eden Prairie, Minnesota
    Posts
    4,170

    Default Re: PID Line Follower

    I've never seen any benefit from integral and derivative. I've written several PID line followers starting on the RCX and as recently as a few weeks ago. Integrator just wants to make the the robot spin out of control and derivative just makes it jumpy, I never get any damping. Has anyone else seen benefits from using PID over just proportional.

  4. #4
    Join Date
    Sep 2013
    Posts
    154

    Default Re: PID Line Follower

    I made a PID gyro follower that would let me spin a robot 180 degrees by hitting it with my hand and it would turn back around, overshoot, and come back to essentially the same path it had been on. The integral term was important to pulling it back on the original path vs. just pointing in the same direction based on my observation. This isn't an FLL use case, however.

    I did not find much benefit for line following. I think this is because the input to the light sensor is not a nice slow-moving process like the temperature in a furnace. The distance over which the reflected light signal goes from rail to rail is relatively tiny (1/4" maybe?). I think a line follower tends to spend a lot of time closer to the rails vs. the target due to this small distance (unless it moves really slowly). That would throw off the integral term and tend to cause it to go out of control. Integral term is helpful for fixing small deltas from the target (i.e., a line follower sitting at 52 for a long time might stay at 52 with just the proportional term, the integral would wind up a stronger correction over time to pull it back toward 50).

    I think a PID might be more useful for line following if the lines were a wide gradient vs. a sharp edge. However, I think the bigger question is if a more complicated follower matters for FLL. A proportional follower can be pretty smooth, and it's hard (for me anyway) to come up with a need for anything better.

  5. #5
    Join Date
    Apr 2014
    Posts
    170

    Default Re: PID Line Follower

    Quote Originally Posted by Dean Hystad View Post
    I've never seen any benefit from integral and derivative. I've written several PID line followers starting on the RCX and as recently as a few weeks ago. Integrator just wants to make the the robot spin out of control and derivative just makes it jumpy, I never get any damping. Has anyone else seen benefits from using PID over just proportional.
    I suspected that a derivative term would be needed to follow the line around the milker, but it wasn't true for my team's robot/program. Far more useful to spend the finite time budget on better solutions, or more testing, or project research (or almost anything else).

    I've always put a lot of effort into reminding my teams to think about time. There's only so many weeks in the season, only so many hours in any meeting, only 2.5 minutes in the robot game. I don't know if it sticks, but I feel remiss if I don't remind them.

  6. #6
    Join Date
    Dec 2011
    Location
    Oregon, USA
    Posts
    2,020

    Default Re: PID Line Follower

    Proportional-only seems to work adequately for LEGO League-related tasks (can't call it "FLL" any more...).
    FIRST Tech Challenge Judge: 2010, Referee: 2017
    FIRST LEGO League Mentor, Instructor, and/or Referee/Head Referee since 2011
    FIRST Robotics Competition judge (Chairman's Award): 2014
    Dean says I'm an "Oompa Loompa of Science"

  7. #7
    Join Date
    Jul 2015
    Location
    Brazil
    Posts
    2

    Default Re: PID Line Follower

    Indeed, in terms of efficiency, a proportional line follower is enough to follow the line in an FLL competition. We used the P algorithm for several seasons and had no problem. However, as of the Trash Trek season, we were encouraged by our coach to delve into the line followers, thus gaining more learning (after all, what we discover is more important than what we win ). Honestly, by performing a performance analysis between the P and PID line followers, we have identified some improvements. And understanding PID logic has encouraged us to learn more and more about other things. Thanks for the feedback guys!

  8. #8
    Join Date
    Sep 2008
    Location
    Eden Prairie, Minnesota
    Posts
    4,170

    Default Re: PID Line Follower

    Quote Originally Posted by mkirkwood View Post
    I made a PID gyro follower that would let me spin a robot 180 degrees by hitting it with my hand and it would turn back around, overshoot, and come back to essentially the same path it had been on. The integral term was important to pulling it back on the original path vs. just pointing in the same direction based on my observation. This isn't an FLL use case, however.

    I did not find much benefit for line following. I think this is because the input to the light sensor is not a nice slow-moving process like the temperature in a furnace. The distance over which the reflected light signal goes from rail to rail is relatively tiny (1/4" maybe?). I think a line follower tends to spend a lot of time closer to the rails vs. the target due to this small distance (unless it moves really slowly). That would throw off the integral term and tend to cause it to go out of control. Integral term is helpful for fixing small deltas from the target (i.e., a line follower sitting at 52 for a long time might stay at 52 with just the proportional term, the integral would wind up a stronger correction over time to pull it back toward 50).

    I think a PID might be more useful for line following if the lines were a wide gradient vs. a sharp edge. However, I think the bigger question is if a more complicated follower matters for FLL. A proportional follower can be pretty smooth, and it's hard (for me anyway) to come up with a need for anything better.
    Integral is important when you have a continuous or DC type error that cannot be removed using proportional alone. I can see where that would be the case trying to control to some gyro heading. When you stop steering the heading quits changing, and really small errors will hang around because the steering correction drops to zero when the heading error is small.

    Line following is a different kind of beast. It has a built in integrator. Let's say I have a straight line and my robot is slightly to the right of the edge of the line but otherwise perfectly aligned with the line (robot heading and line are parallel). I make a slight steering turn to the left which is followed by driving perfectly straight. Even though my steering correction is zero, the robot continues to move closer and closer to the line as it drives forward. Driving forward "integrates" the previous correction. If I put the steering correction in a loop, computing a new steer based on the difference between the light sensor intensity and some threshold, the steering correction will decrease as the sensor gets closer and closer to centered over the edge. However, the heading change between the robot and the line continues to increase. Eventually the light sensor will be centered over the line, but when it gets there the heading will be way off and the robot will overshoot.

    Your example of the line follower having a small delta that remains constant is not realistic. The only way it could happen is if the robot heading and line are perfectly parallel and the robot is nearly centered on the line. This could drive perfectly straight with a tiny line following error, but it is nearly impossible for such a condition to exist. And in this case, adding an integrator would only induce a wobble. Once the robot and line are out of alignment they can never again become aligned. All you can hope for is an ever decreasing oscillation.

    I can see how derivative could be useful. As the sensor crosses the edge, and the error becomes smaller and smaller, derivative will start the robot turning the opposite direction. In other words, if the robot is to the right of the line the proportional gain will tell the robot to turn left. While the robot is crossing the line from the right the derivative gain will tell the robot to turn right. The proportional term fixes the displacement error, and the derivative term fixes the heading error. In practice I am not seeing this. My experiments with derivative gain show almost no damping until the derivative goes out of control and introduces a high frequency oscillation.

    I think the problem I have using integral and derivative is caused by the nature of the feedback. Much of the time you are trying to follow the edge of the line you are not seeing the edge. The area the sensor "sees" is very small, and much of the time that area is either completely black or completely white. In this state you no longer have a proportional line follower and the correction is saturated; The proportional gain is turning is fast as it can, the integrator winds up, and derivative goes to zero because old error equals new error. When the sensing area sweeps over the edge of the line the steering has over-corrected and the robot is pointing the wrong direction to follow the edge. Soon the sensor sweeps past the edge and you are blind again, only knowing you are left or right. PID works much better when I use a continuous feedback like the gyro angle or ultrasonic sensor distance.
    Last edited by Dean Hystad; 03-03-2017 at 11:57 AM.

  9. #9
    Join Date
    Sep 2008
    Location
    Eden Prairie, Minnesota
    Posts
    4,170

    Default Re: PID Line Follower

    Quote Originally Posted by tjhawkey View Post
    I suspected that a derivative term would be needed to follow the line around the milker, but it wasn't true for my team's robot/program. Far more useful to spend the finite time budget on better solutions, or more testing, or project research (or almost anything else).

    I've always put a lot of effort into reminding my teams to think about time. There's only so many weeks in the season, only so many hours in any meeting, only 2.5 minutes in the robot game. I don't know if it sticks, but I feel remiss if I don't remind them.
    A circular path like the line around the milking machine might benefit from an integrator. Unlike a straight line, corrections made in the past don't get us closer to the line because the line is curving away. However the integrator would have to be perfectly tuned for the curvature of the line. Derivative would work (or not work) the same way it does for straight lines.

    I was surprised to see only one team that realized they could "wall follow" on the milking machine instead of trying to track the line. I was also surprised by the large number of teams that used the gyro sensor to decide when to stop. The milking machine is a case where dead reckoning using the rotation sensors gives much better results.

  10. #10
    Join Date
    Sep 2008
    Location
    Eden Prairie, Minnesota
    Posts
    4,170

    Default Re: PID Line Follower

    Quote Originally Posted by mkirkwood View Post
    I think a PID might be more useful for line following if the lines were a wide gradient vs. a sharp edge.
    I want fuzzy lines! I think we should start a petition.

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (1 members and 1 guests)

  1. Dean Hystad

Similar Threads

  1. EV3 Line follower fail
    By winklestork in forum Programming
    Replies: 18
    Last Post: 10-29-2015, 12:44 PM
  2. Color Sensor Line Follower
    By ggears2012 in forum Programming
    Replies: 5
    Last Post: 12-16-2012, 07:59 AM
  3. ISO: YouTube tutorial for line follower
    By UlrikeDG in forum Programming
    Replies: 7
    Last Post: 11-28-2012, 12:53 PM
  4. Line Follower Help
    By andrewS in forum Programming
    Replies: 8
    Last Post: 11-09-2012, 05:13 PM
  5. Line Follower My Block
    By ssamos in forum Programming
    Replies: 7
    Last Post: 10-03-2012, 03:03 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •