Linefollower speed-up project

The PID Linefollower code seems to work very well out of the box, but I wanted to speed up in straight sections of any linefollowing course. This video shows a low speed test where the max speed is set to a very sedate value, it is successfully detecting when it can ramp up the speed to more than double. The only problem it has is when it goes into a curve there is a braking effect and the robot tends to nosedive as it slows down. I might work on ramping down the speed to reduce that effect.

Or I could just set the speed up for a faster test as shown in this video, it speeds up even faster in the straight sections. It can’t double the speed in this case since that would drive the setting higher than 255 (the highest value that set_motors() expects to see); the value is limited to a “safe” value, ie, one that the robot can recover from when it has to slow down in some unknown curve ahead.

Obviously the 3pi gurus here will have no difficulty duplicating this effort, and might even integrate the concept into the curve handling code, ie, mild curves could ramp up or down to some mid level of increased speed. I will post a sanitized code sample soon, I don’t want to give all of my testing secrets away just in case someone from Las Vegas shows up at one of our robot club meetings and wants to do a Las Vegas style line follower competition. :slight_smile:

By the way, if anyone knows how to get a cool sound clip such as “Wipe Out”, “Radar Love” or “Living in the USA” into C code for the 3pi please pass it along!


Thanks for sharing. What is the radius of your tightest turn? We’re able to do 6" turns at full speed, so most of us don’t have any explicit “slow down” feature for curves.

- Jan

I’ll have to measure the radii, but I’ve never been able to run at a higher speed than about 185 in the linefollowing courses that I test on. Anything beyond that becomes a time bomb, ie, eventually it will not be able to recover from a turn. With this code I can run up to some higher value in the straights and still hang on in the curves.

Are you saying that the extreme linefollowing video bots were running with a max speed setting of 255? If so, was there some tweaking of the PID calculations to accomplish that?

Thanks for any info!

In my experience, the optimal PID values depend on the speed, so I definitely wouldn’t expect the PID parameters we provide for low-speed demos to work at full speed. The robots in the video all had different code, so I don’t know what exactly they were doing. I know mine was going full speed in the straightaways.

- Jan