View Full Version : Line Tracking, Tips, Suggestions, Pictures
team222badbrad
01-04-2006, 17:06
Ok, so now that I have built a robot specifically for line tracking, I am wondering what your VEX line tracking robots look like?
I have not been successful in getting my robot to go all the way around the VEX line tracking map, but I have got it in semi working order.
The only problem I have is if all three line sensors lose contact with the black line it just goes straight because it's programmed to do so, sometimes it just stops also.
Also it stops and goes in a step like motion, why?
I have it programmed to line track when either button on channel 5 is pressed, could radio interference have anything to do with that?
Anyone have any tips on what to do if all three sensors lose contact with the line?
I have been involved with FIRST for years, but I am a newbie to programming.
Feel free to rip my code apart if I did something incorrectly.
I don't know if this would work better or not, but instead of using 3 line sensors and trying to keep the middle on the line, just use 2 sensors and always keep the line in between them. You can afford to be off a little bit more that way. I'm not entirely sure how well you can get a 3 line sensors system to work; my freshman year when I did autonomous for line tracking like this the best we ever got the robot to do was oscilate back and forth over the line while driving, though it never centered enough to drive straight.
What are you using to drive motors (command wise)? That could be the problem for twitching.
For the 3 sensors losing a signal, if the middle one loses the signal but the outer 2 have not been activated, then your line must be in between the middle and one of these 2 sensors, so you can continue straight. If one of the outer ones is activated and then loses it, I would continue to turn the way you were to fix it until the middle is activated again, indicating the line has been recentered. Otherwise you can't tell if you've lost the line outside of all the sensors or if it is in between the middle and outer ones.
In years past our FRC team tried line following and never really got it working as well as was needed for the competition. We ended up not trying to follow the line. We used the lines as way points. In other words, we went out by dead reckoning until our line sensors picked up the line and then executed a timed turn and then continued on. In the stack attack game we were able to use the semicircle line to actual control our turn. We went out until the first sensor hit the line and then turned until a second senor pick up the line and then went straight up the ramp. The robot could do this very fast compared to trying to follow the line. I don't know if the lines on the field for the vex game are in the correct position for way points, but it is a good technique to have mastered for the future.
The other technique for using a line sensor is to mount the sensor on a servo. The problem with a line follower is it only gives an on off binary sensing. By mounting the line follower on a servo you can get a large sample to feed into a control loop. Sweep the servo back and forth. After each change of position on the servo read the line sensor. You can then find the edges of the line and calculate the center. Use this value to plug into your control loop drive to. Remember, the servo can only change position every 17 ms. The main loop is much faster than this. The nice thing about Vex is you could have the sensor servo mounted and be testing in about 1/2 an hour. Easy - C 2.0 will make the programming easier because you can build functions. If your your using the 1.1 version in the box, the program gets long and hard to manage. Also the sonar sensor can be mounted on a servo too.
crazykid234
02-04-2006, 11:19
I have never gotten this to work perfectly, but you may want to look into it...
take the difference of the right and left sensors, calculate the difference, and use that to accelerate one side, and decelerate the other side.
example:
difference = right_sensor - left_sensor;
difference = difference / 6;//this value adjusts how hard your robot corrects.
right_motor = 140 + difference;
left_motor = 140 - difference;
if you can get this working, it acts sorta like a PID loop in that it should correct harder the farther away from the line it is.
Hope this helps, and good luck!
team222badbrad
02-04-2006, 23:26
Thanks
Anyone up for a challenge?
Who can get around the VEX line tracking map the fastest?
Hey anyone wanna send me a sample program that works for the vex line tracker, with 3 sensors, i cannot get my program to work.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.