[SOLVED] GoPiGo3 code not working - robot not moving

My GoPigo connects to my computer and the demo works but when I go to use python and input the right code the robot doesn’t do move. What do you suggest to do?

Hello @gianmcosta

I’ve taken the liberty of erasing your other post, as they are the same issue.

In order to better help you out, can you let us know if you have a GoPiGo3, (red board on top) or a GoPiGo2 (green board on top)?

And can you post an example of the code you’re trying to run?

Last, are you using DexterOS or Raspbian for Robots?

Thank you for those extra details.


I’ve been having issues myself with my GoPiGo3. I couldn’t get the motors to turn. The issues seemed to fix itself though. However @cleoqc the hardware test didn’t work for me, but my GoPiGo3 is fully functionaly. Just throwing this info out hoping it will help.

The motors will not run if the batteries are not connected, or if they’re too low.

How did the hardware test fail? Was your firmware up to date?

I am having the same problem as OP. I have code written that works fine on the GoPiGo with RPi 2, but not on the latest RPi 3 model. Have there been changes to the class calls for making the motors go? My program compiles and runs just fine, and the terminal displays the correct output indictating the program is working as intended, it is just not communicating properly to the motors somehow.

I have also tried the test programs provided, and found them to work as intended. It is something in my code I suppose.

Hi @mahydraal,

I’m going to ask the same question Nicole asked: do you use DexterOS or are you running this on Raspbian For Robots?

Anyhow, can you show us the code you’re trying to run?

As far as I remember, there haven’t been significant changes to the class methods, but please, show us what you’re trying to run.


I am running DexterOS, as I believe it is the system that came with the flashdrive in the Base kit.

The code I am trying to run looks something like

It is long. I suppose the part specific to the go pi go would be the motor control function around line 4783.

Thanks @LynnMT
It looks like you are trying to use the library meant for the GoPiGo, and not the GoPiGo3. I’m assuming you do have a GoPiGo3 as you mention DexterOS and the base kit.

For use with a GoPiGo3, your import should look like one of these:
from easygopigo3 import *
from gopigo3 import *

We have detailed documentation for the easygopigo3 library here..

Great stuff thank you.

I will be sure to make some changes.

1 Like

The code you linked is 3 years old. It was written for our previous GoPiGo model. That’s the reason behind your issue.

Please let us know when you get it working!


Oi! I have corrected all the parts that have changed, fixed the imports and tried again.

Now I get this error

File" GoPiGoConnectome.py" , line 4876 in <module>
NameError: name 'set_speed' is not defined.


Looking through the documentation…

  def set_speed(self, in_speed):
        | This method sets the speed of the `GoPiGo3`_ specified by ``in_speed`` argument.
        | The speed is measured in *DPS = degrees per second* of the robot's wheel(s).

        :param int in_speed: The speed at which the robot is set to run - speed between **0-1000** DPS.

        .. warning::

             **0-1000** DPS are the *preferred* speeds for the `GoPiGo3`_ robot.
             The speed variable can be basically set to any positive value, but factors like *voltage*, *load*, *battery amp rating*, etc, will determine the effective speed of the motors.

             Experiments should be run by every user, as each case is unique.

            self.speed = int(in_speed)
            self.speed = self.DEFAULT_SPEED
        self.set_motor_limits(self.MOTOR_LEFT + self.MOTOR_RIGHT,

Clearly it is defined in the gopigo3 and easygopigo3 libraries. what gives?

Hi @LynnMT,

I suspect on line 4876 there’s just the set_speed(120) instruction. If that’s so, then you’re doing it wrong.
You have to instantiate an object of the EasyGoPiGo3 class and then call the method of it like so:

from easygopigo3 import EasyGoPiGo3

robot = EasyGoPiGo3()


# more code

Hope this solves your issue.

Thank you!

1 Like

I assume I will have to make the same instantiation for every call to the original motor control functions?



Hi @LynnMT,

You’re entirely correct. That’s objected-oriented programming.
Keep in mind that the object instantiation is done only once.

Thank you!

lol thank you for all the help. I know I am obtuse.

so to sum it up for people in a TLDR;

gopigo 1 and 2 models use outdated function libraries and need to have their import statements fixed to the latest gopigo3 and easygopigo imports.

All motor control functions relying on said imports need to be fixed from





after instantiating an object of the EasyGoPiGo class.


Thread Closed. Thanks again. Hope it helps future flounders.


This topic was automatically closed after 3 days. New replies are no longer allowed.