line tracker

Trying to learn programming, this program seems rough runs straight for a little bit but when the right and left sensor hit the edge of the line it turns a 360. Using Easy C v2 with a PIC.
Have attached code
scan0002.jpg

Good job on beginning your programming adventure! The VEX Forums are a great place to find assistance.

You may want to try to changing your while loops into if/else if statements. Try to imagine how the robot will execute your code: First it starts in the first while loop, and loops a few zillion times until Middle_Sensor >= 100. Then it goes a few million more times around in the second loop until your Right_Sensor >= 100. It does the same thing for your Left_Sensor, and then your program is done, or it goes on to something else, and your motors are left spinning at the last power level you at which you told them to operate.

You may want to use 'if’s and 'else if’s in your code instead of those while loops.
In fact, depending on what you are trying to accomplish, you may be able to combine your Follow_line and velcontrol functions.
Also, it doesn’t appear that the code by your ‘go forward’ comment actually would make a robot go forward. ‘else // stop’ also makes it look like your code is setting the motors to go full power.
(You will still need a while loop, but I’ll leave that up to you to determine where you want to put it in your code)

I downloaded a trial version of robot c and used the sample code to get a 3 sensor line follower to follow a white line, albeit very rough. it doesn’t seem to correct in time or takes big arcs before it finds the white line again. How do I fine tune it.

Can you share where you found this code?

Here is Quazar’s ** EasyC V2 Line Tracker Code**.

Here is the Listings for those that don’t have EasyC 2.x Installed, ** Line Tracker Code - Printed**.

Quazar’s Code includes active corrections for when the Line is Lost…

I downloaded the 30 trial for RobotC and opened sample code called Triple Sensor Line Tracking. The only editing I did was to change it from following a black line to following a white line by changing the greater than to a less than in reference to the threshhold

What methods have good teams used in sack attack for autonomous skills? I figured that many of them used line followers, am I correct in this thinking? Do almost all of them use integrated encoders?

Line followers are great for the Programming Skills Challenge, but I’ve found that many teams forego line followers in the 15 second autonomous portion of actual matches. Since the 15 seconds are so short, it’s usually a better tradeoff not to use some sensors to gain some speed while still maintaining consistency.

We use quadrature encoders and have had absolutely no problems at all. They are simple to use and are very accurate even without a PID loop if you use them correctly.