Random drift when driving forward

Has anyone encountered random drifting as the GoPiGo is moving forward? We are programming ours in Python and cannot consistently drive forward in a straight line. I found the article on setting the trim and have done so, but even then the GoPiGo drifts all over the place. And to make matters worse, it is not consistent.

At first we had thought the drift was speed related because it seemed slower speeds would drift one direction and faster speeds would drift the other with speeds around 100-110 staying pretty straight. Then as we started driving driving the robot longer distances (the goal is to program it to drive around a large table in the center of the classroom) it started displaying more erratic behavior. Sometimes it goes straight for 5-6 feet before veering off course. Other times it just drives in a nice, wide arc.

We are using the fwd() command, but after reading the documentation it is behaving as if we are using the motor_fwd() command. I had thought the encoders were on by default and helped the robot drive straight with the fwd() command. Is this not the case? Do I need to make sure they are on first?

Anyone have any words of wisdom?

@jswann5726: One of the reasons gopigo drifts sometimes for people is because the wheels slip when the GoPiGo is moving forward. We have seen two things which reduce the wheels slipping. One is using rubberbands on the wheels to increase the grip and the other is to put the battery pack on the top of the GoPiGo instead of the back.

Can you try this out and let me know how it goes for you.

I’m watching my students play with it now. Just typing some quick notes as I observe…

  • We have moved the battery pack to the top canopy.
  • Set speed to 110 in the code so the robot really isn’t going all that fast.
  • Trying to drive a large rectangle around the room. First leg of trip is 17’ forward.
  • When GPG is sent on first leg sometimes it goes fairly straight, though there is wabble.
  • Other times the GPG will veer way of course in a large arc.
  • Fitting rubber bands to wheels now.

Rubber bands have helped. We did have to double-wrap the particular rubber bands we had on hand. Still seeing inconsistent drift, even though much better.

Keep in mind my classroom has 12" floor tiles so we have a natural grid to drive on. Have taped a “T” on the floor at one joint to mark the starting point.

  • First trial run GPG went 17’ forward and drifter 2’ left.
  • Second trial run GPG went 17’ forward and drifter 18" right.
  • Third trial run GPG went the entire 17’ almost perfectly on the seem.

This is an example of what we see. Wondering if battery power affects this.

Great to hear that it’s working better for your class and thanks for the pointers. The battery power would affect this a bit mostly at the extremes, like when the batteries are fully charged and at 12V vs when they are at 9V. One of the things you can test out is how the trim behaves when the GoPiGo is at 12V vs when it is at 9V.

You can use the f command here to get the battery voltage (though you should only read it when the motors are not running because the voltage seems to fluctuate a bit when the motors are on).


Did you ever get this sorted out? we are having the same problem, almost always random drift, almost never straight. The wheels aren’t slipping and I’ve used the trim which helped but not with the random drift.

I think so. I was using the robot in a class I taught last semester. I am
teaching another subject in same period this semester and so I’m not
working with the robot right now.

Our robot was driving erratically enough to get a DUI. We tried everything.
Finally we replaced the motor. Our motor arrived just as Christmas break
began. I installed it and tested it and it drove much, much better. Not
perfect, but more like how I would expect it to drive. I was able to
program a course where it would drive a pattern, say around the classroom,
and come back to the staring point and it was able to get reasonably close
to where it started. It wasn’t capable of doing that before the new motor
at all.

I had some students to play with it during a maker faire last month. I was
busy running another exhibit, but they did not mention to me anything about
it running severely off course.

If I get a chance next week I’ll pull it out, run it around a bit, and
report back to you.

1 Like