Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: PID Line Follower

  1. #11
    Join Date
    Sep 2009
    Location
    Minnesota
    Posts
    1,607

    Default Re: PID Line Follower

    Quote Originally Posted by Dean Hystad View Post
    I want fuzzy lines! I think we should start a petition.
    Too late. Fuzzy lines would have been appropriate for "Animal Allies". For "Hydro Dynamics", we'll get wavy lines...

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

    Default Re: PID Line Follower

    Quote Originally Posted by Dean Hystad View Post
    I want fuzzy lines! I think we should start a petition.
    I'm sure there'd be a way to encode a secret message in the fuzzy lines, and award bonus points for the robot autonomously decoding it.
    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"

  3. #13
    Join Date
    Aug 2010
    Location
    Chicago 'Burbs
    Posts
    198

    Default Re: PID Line Follower

    The integral term is very useful when the robot needs to provide a sharper correction when "lost" on one side of the edge or the other. If I'm in white, and the next cycle I'm still in white, I want to increase the degree of turn to find my way back (whereas the proportional term is already maxed out). Integral does this ... when properly tuned. Our team found that they needed to have a damped integral to prevent windup for their robot design. Note you also want to use derivative to prevent overshoot, and it's useful to zero the integral upon the line crossing, again to minimize overshot or out-of-control oscillation.
    A good proportional will stay on the (straight) line once there, and will align for small degrees of error coming to the line. Having the ID terms helps with a non-straight line, or aligning with a line that wasn't approached well. I do work with the kids to "not be lazy" and have them work out the multiple small "corrections" (e.g. overshoot line then swing to ensure better alignment) rather than rely on the PID to align itself. It's a few more steps of code, but ensures better success since they are solving a "known" position problem rather than letting the algorithm attempt a solve.
    Technical Coach of the Newton Busters
    Chicago 'Burbs, IL, USA, Planet Earth

  4. #14
    Join Date
    Sep 2013
    Posts
    154

    Default Re: PID Line Follower

    Quote Originally Posted by Dean Hystad View Post
    Line following is a different kind of beast. It has a built in integrator.
    That's a great insight! Also a good argument for why not to use a PID for line following. The typical line follower is not a linear process. A line follower doesn't act like a typical control process because the act of making a correction causes a continuing change in the signal. For a line follower to act like a typical process, the robot would need to slide left and right perpendicular to the angle it is traveling instead of turning. I can't simply add correction in one direction then return to straight, because the robot is no longer perpendicular to the line. Temperature chambers I work with will alternate between heating and cooling to maintain a temperature, but that's not usually necessary. If it's above room temp it adds heat or doesn't add heat. The line follower adds some positive feedback that would be like if adding heat caused it to keep heating even after the heat was turned off. Cooling would always be necessary, which would cause it to keep cooling by itself, which would need heat again.

    I built a robot with a color sensor directly in the middle of the robot between the axles, and it liked following lines. I'm guessing this configuration minimizes the problem mentioned above, but doesn't eliminate it. A skid-steer robot can't correct a line position problem without creating a heading problem.


    Quote Originally Posted by Dean Hystad View Post
    I think the problem I have using integral and derivative is caused by the nature of the feedback.
    Yup, that's why I think fuzzy lines would be great! As you said, I think a proportional line follower spends a lot of time railed dark or light and doesn't spend much time in a nice linear range. I'll have to find some time to play with this before I'm forced to take down the table until August.

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

    Default Re: PID Line Follower

    Quote Originally Posted by gof View Post
    The integral term is very useful when the robot needs to provide a sharper correction when "lost" on one side of the edge or the other. If I'm in white, and the next cycle I'm still in white, I want to increase the degree of turn to find my way back (whereas the proportional term is already maxed out). Integral does this ... when properly tuned. Our team found that they needed to have a damped integral to prevent windup for their robot design. Note you also want to use derivative to prevent overshoot, and it's useful to zero the integral upon the line crossing, again to minimize overshot or out-of-control oscillation.
    A good proportional will stay on the (straight) line once there, and will align for small degrees of error coming to the line. Having the ID terms helps with a non-straight line, or aligning with a line that wasn't approached well. I do work with the kids to "not be lazy" and have them work out the multiple small "corrections" (e.g. overshoot line then swing to ensure better alignment) rather than rely on the PID to align itself. It's a few more steps of code, but ensures better success since they are solving a "known" position problem rather than letting the algorithm attempt a solve.
    Sounds like the trick to getting integrator to work for line following is using decay and a reset to unwind the integrator. I've tried just using decay and it didn't help much. I've tried clipping and it didn't help much either. I've never tried resetting the integrator sum when the error crosses zero. You are already going to get a ton of overshoot, but resetting the sum lets you forget your earlier transgressions.
    Last edited by Dean Hystad; 03-15-2017 at 08:05 PM.

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

    Default Re: PID Line Follower

    The best line following LEGO robot I've ever built had a single steerable front wheel. The light sensor was mounted on a spar in front of the wheel and you could "tune" the line following by moving the sensor closer or further from the wheel. Even with a dumb "bang-bang" controller on the RCX it followed lines better than anything I've seen since. Geometry is far more important than algorithm and most FLL robots have lousy line following geometry. Mounting the light sensor along the centerline is helpful. If you can't mount the sensor in the center you can compensate by using different scaling for left and right corrections.

  7. #17
    Join Date
    Sep 2014
    Location
    Central New York
    Posts
    59

    Default Re: PID Line Follower

    Quote Originally Posted by Dean Hystad View Post
    The best line following LEGO robot I've ever built had a single steerable front wheel. The light sensor was mounted on a spar in front of the wheel and you could "tune" the line following by moving the sensor closer or further from the wheel.
    We had a line following competition locally in the off season last year, and the winner did exactly that. I had a 4wd ackerman steering robot (thanks, Sariel's book!) that couldn't even approach the speed.
    Coach, FLL Team 3146 Peace By Piece 2013 - 2016; Team 29410 The Dragon Bots 2016
    Judge, FTC 2014-2015; Field Technical Advisor, FTC 2016

  8. #18
    Join Date
    May 2014
    Posts
    204

    Default Re: PID Line Follower

    Do you have any videos or pictures of it? I am trying to picture in my mind how something like this would work, but coming up short.
    Regards,
    Skip Morrow

    2016 Animal Allies
    2015 Trash Trek
    2014 World Class Learning

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

    Default Re: PID Line Follower

    Imagine a tricycle with a broom handle attached to the handle bars, parallel to the front wheel. When you steer the wheel the sensor sweeps side to side very quickly, even if the robot isn't moving forward.

  10. #20
    Join Date
    Sep 2014
    Location
    Central New York
    Posts
    59

    Default Re: PID Line Follower

    A good example (if out of focus) on Youtube: https://youtu.be/14PswDr0otE
    So instead of the usual two separately powered wheels and a unpowered caster wheel, the caster wheel steers and both of the other wheels drive with one motor (Ideally through a differential, but a locked axle works for demonstration). The control program swivels the caster so the forward placed light sensor is on the line, the rest of the robot follows.
    Coach, FLL Team 3146 Peace By Piece 2013 - 2016; Team 29410 The Dragon Bots 2016
    Judge, FTC 2014-2015; Field Technical Advisor, FTC 2016

Page 2 of 3 FirstFirst 123 LastLast

Thread Information

Users Browsing this Thread

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

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
  •