go away spammer

Author Topic: Help with PID line follower  (Read 2599 times)

0 Members and 1 Guest are viewing this topic.

Offline CyclonedTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 1
Help with PID line follower
« on: February 16, 2015, 11:59:09 AM »
Hey everyone. I have a line following competition this weekend and I have prepared a simple robot for it. My robot is tracing lines pretty well, the only issue is that when it comes to the end of a line, it rotates in one place. I want to change it so that it continues to go forward after the line finishes because the competition track has several gaps in the line. Since I am very new to Arduino, I must admit that I have copied the program from online, and have only experimented with the values to get the line tracing to work. I have an understanding of the way the code works but I do not have enough time to go in depth into it and recode things myself. I will however be making my own program after the competition.

Could someone help me out with how I can accomplish this?


Offline bdeuell

  • Robot Overlord
  • ****
  • Posts: 189
  • Helpful? 15
Re: Help with PID line follower
« Reply #1 on: February 16, 2015, 04:56:13 PM »
basically you need to add a condition (if statement) in your code that tells the robot to go straight if it does not detect a line otherwise (else) follow the line using PID or any other algorithm. Im not sure how you have your sensors wired to the robot but the theory is, if none of the sensors detect a line assume there is no line and drive straight until it appears again.

Make an attempt to figure out how to implement this "condition" into the code, if you are struggling with this post back with specific questions about what part you are having trouble with. If you plan to use this copied code you will really need to read through it and understand how it works so you can add these modifications.

BTW it looks like the code you are using is actually a PD control loop.


Get Your Ad Here