Giving the 3pi a memory


I have been working with the Pololu 3pi the past few days, and I’m on to the line following project. I’ve made a track to play with the robot on, and I’ve been using the basic algorithm. I was taking the suggestions given in the user manual, which has been working fine. I’ve gotten the motors up to 60% of max, but I don’t think I can get it any faster on my current track with just the simple algorithm due to the tight turns I’ve created on my track. I don’t want to move on to the more advanced code yet, I want to make this one as good as I can. I was wondering how I give my 3pi a memory to see if I can get it to go a bit faster that way. I’ve searched around the site and the forums, and I can’t seem to find an answer.

So my question is, what do I write in my program to have the 3pi remember the track. I’m using Arduino’s environment to program my robot.

Remembering the track typically requires a technique known as SLAM (Simultaneous Locating and Mapping) which requires more software power than the onboard microcontroller can do.

Also, to map the track to your memory, you’re going to know “where you are” which means you’re going to need wheel encoders, which I don’t think are available on the 3pi.

To solve your specific problem, try adding two sets of sensors, perhaps? One set further ahead of the other, to give “advance warning” of what’s coming up?

I find it strange that the manual would suggest such a thing on the first example project and not tell you additional hardware is required. Thank you anyway.


What example project are you referring to?

- Ryan

Hello Ryan, I am using the line following project in the 3pi user manual, linked in my opening post.


I think you are misunderstanding what the guide is suggesting. The idea is that you can make your program more versatile by having it track if it has been following the line well for a while (e.g. the position never gets too far from center) and automatically scale up the speed if so (or scale it down if it starts nearly losing the line).

Before trying to learn the layout of a track, you should use the more advance PID algorithm for line following. In that case, you can still attempt some rudimentary form of learning the track without any additional hardware by looking for patterns in the motor power difference, but that is going to be really complicated and might not work well (encoders would make it easier, but the 3pi isn’t intended for such a modification). It’s just something an ambitious user might want to try when they’ve run out of all other ideas for improving performance.

- Ben

Thank you Ben, this makes a lot more sense, and will be a lot less complicated than I thought it would be.