Backwards 3pi?

Hi there, i have just got my 3pi to run and really like it!

What i really want it to do is follow the line a little differently. I want to get the 3pi to go forward for a lets say 5 seconds and then go backward for 2-3 seconds, and then continue 5 seconds forward and then backward and so on. ( some kind of 2 steps forward 1 step backwards machine.)

if the 3pi cant go backwards, if i could get it to turn around and drive backwards then turn back again and go forward and so on.

if anyone has any experience with this that would be great.



I’m glad to hear that you’re enjoying your 3pi!

Something like that could definitely be done, though going backwards by turning around and following the line normally will be much easier than following the line while driving in reverse. Following a line in reverse is problematic for the 3pi because the sensors will be behind the wheels, which means you won’t see a turn until you’re already past it and mostly off the course.

One thing you could try is driving the backwards segments “blind”. If you store the past, say, 2 seconds worth of motor speeds as you drive forward, you can set the motors to the stored (but negative) speeds in reverse chronological order to approximately drive your previous forward course backward. This would be very cool to see, but given the generality of your post, I’m not sure this is the kind of thing you have the expertise do yourself. I also suspect that there could be inherent asymmetry that will cause this strategy to work very poorly. If you do get something like this working, please let us know!

I suggest you start with the PID-based line-following example we provide and get that working well driving around your course (forward) at the speed you desire. Once you have that done (and understand how it’s working), you can more easily modify it to do what you’re trying to do. For example, try modifying it so that the robot pauses every 5 seconds, and after that maybe try spinning a full 360° every five seconds instead of merely stopping, etc.

- Ben