Please help Novice coach and SpEd team with line tracker code

My robotics team,made up of SpEd students, are using VEXCode V5 block programming language. I have never had formal VEX programming training of any sort.

My students and I have been trying to read everything thing we can and watching videos on how to get line trackers to work. We are able to see the trackers are operational via looking at the readings for 3wire devices on the brain screen) with 3% reflectivity for white tape surface, and 42-48% reflectivity for the gray mat. The problem is we can’t get the bot to react to anything when we try to run codes with using the sensors.

Right now we are just trying to get it to follow the lines, next we also need it to pick up the Jenga blocks on the lines.

Here is a sample of out code to try to get it just to follow the lines and a pic of our final objective. Are we close? How do we code for this?

Any pointers would be appreciated.Pics of code and field scenario

2 Likes

For line tracking, you want the robot to react immediately when it sees or doesn’t see a line. Don’t use “Drive forward for 5 inches” and “Turn right 90 degrees.” Those commands make the program wait until the robot is done driving the 5 inches or turning 90 degrees, at which point you are way off the line. Instead, use “Drive forward” and “Turn right.” These start the robot moving but continue to the next line of code immediately so it will go back up to your “if” and check the line tracker again.

Also, your code looks like you’re using a singe line tracker sensor. Is that right? If so, I think it’s going to be hard to do using a Drivetrain device. I would set up your devices with a Left Motor and a Right Motor so you can control them independently. (Be sure to reverse the Right Motor when you set it up). Then, your code can look something like “If it’s dark, spin the right motor forward and stop the left motor. Else, spin the left motor forward and stop the right motor.” That allows the robot to inch forward while turning back and forth, which I don’t think you can do with a Drivetrain device. If you have 2 or 3 line trackers side by side, there are more options for how to code it.

3 Likes