GoPiGo3 Line Follower - Raspbian for robots

Hi,

I am running a GoPiGo3 on battery (with enough power). The GoPiGo3 is equipped with a line follower. I am able to calibrate the sensor (and I did it) and a have a basic test network. The GoPiGo3 is running Raspbian for robots.

I am trying to execute the example code in /home/pi/Dexter/DI_Sensors/Python/di_sensors/red_line_follower/line_follower/line_follow.py
but the robot is not moving. I had a look to the code and added some test print commands to see whether something really goes wrong. This seems to be not the case, at least commands like

gopigo.set_speed(85)
gopigo.right()
Are executed and those are not throwing errors. Actually I have no idea why this happens. The values are changing when the sensor gets covered.
My question is: Why is the robot not moving?

Moreover, there is code located in /home/pi/Dexter/GoPiGo3/Software/Python/Examples/Line_Sensor. While executing this code, I noticed that the sensor calibration is not affecting all scripts in this directory.
My question is: Why is the calibration not applied here?

Another question is: Why is there source code for the same purpose at two different locations?

Hi @mrX,

My question is: Why is the robot not moving?

That’s because you need to use another library, meant for the GoPiGo3 - the current one is for the GoPiGo2. Do it this way:

  1. Replace line 21 with from easygopigo3 import EasyGoPiGo3.

  2. Insert on line 23 gopigo = EasyGoPiGo3().

Then run the program again and see if it works.

This is just a temporary fix for you specifically and we’ll have something better down the line. Just to let you know about this, we haven’t documented the line follower just yet - but it’s on our backlog anyway.

My question is: Why is the calibration not applied here?

This is really an old script that needs to be updated - it was moved from the GoPiGo repo to this one because it seemed more appropriate, but we haven’t had the time yet to deal with the documentation and with making it more compliant to this library in general.

Another question is: Why is there source code for the same purpose at two different locations?

That’s funny, we noticed the same thing a couple of days ago - we are going to remove the version that resides in the GoPiGo3 - it has no place to be in there - or if it has, it needs to make references to the documentation/source code that’s (going to be) on DI-Sensors.


Thank you!

Thank you Robert.

Just changing that one line is not solving the problem. There are more code fragments, which probably belong to an older version of the API. However, I got it running and pushed a basic example on
GitHub - just in case.

Hi @mrX,

That’s really great. We’ll probably have to put both versions side by side and see what modifications you have added so that we can reciprocate.

Thank you!