Solved!Error for project "Build a Self Driving Car With the GoPiGo3"

facing a error

pi@dex:~/Desktop/chetuk $ sudo python test.py
Traceback (most recent call last):
File “test.py”, line 5, in
my_Distance_portI2C = easy.DistanceSensor(‘I2C’, gpg, use_mutex=True)
NameError: name ‘gpg’ is not defined
pi@dex:~/Desktop/chetuk $

1 Like

hello @chetuk,

the gpg variable is never instantiated. Try adding
gpg = easy.EasyGoPiGo3()
on line 4

added the variable new error
im using raspbian OS any solution
using the code
https://dexter-media-live.s3.amazonaws.com/cwist/picturesteps/fb/3f/Python_Self_Driving_Car-Drive_from_John_to_Nicoles.py

Traceback (most recent call last):
  File "test.py", line 5, in <module>
    my_Distance_portI2C = easy.DistanceSensor('I2C', gpg, use_mutex=True)
  File "build/bdist.linux-armv7l/egg/easygopigo3.py", line 1194, in DistanceSensor
  File "build/bdist.linux-armv7l/egg/easygopigo3.py", line 1096, in old_instantiation
ValueError: Invalid use of mutex: the GoPiGo3 does not use mutex protection and the distance sensor does.
pi@dex:~/Desktop/chetuk $

Change this to
my_Distance_portI2C = easy.DistanceSensor('I2C', gpg)

We’ll make the changes to the website too. Thank you for reporting those!

@cleoqc not sure but the website seems not update with the changes.
please help to fix the code on website appreciate as working project!

It will take a couple of days before we can get the changes on the website.
In the meantime, can you use these files:
Python_Self_Driving_Car-Drive_From_John-to-matt-to-school-to-nicole-to-robert-to-ice-skating-to-theater.py (1.6 KB)
Python_Self_Driving_Car-Drive_from_John_to_Nicoles-2.py (1.4 KB)

Thanks for the script but not working as expected .
Doesnt seems the sensor are working with the above code.

/Chetan S.

What errors or behaviours are you getting?

Cleo

Capture

@cleoqc the attached script worked thanks!! :grinning:

My mistake

I update the OS (sudo apt-get update & upgrade)
So again re imaged raspbian OS
Switched connection on the I2C port for the line & distance sensors

/Chetuk

2 Likes

Yeah! Great you figured it out!
Stuff like that is hard to debug from a distance, so thank you!

1 Like