[SOLVED] Distance Sensor Error :(

gopigo3
sensors

#1

Code:

import time
import easygopigo3 as easy

gpg = easy.EasyGoPiGo3()

my_distance_sensor = gpg.init_distance_sensor()

while True:
    print("Distance Sensor Reading (mm): " + str(my_distance_sensor.read_mm()))
Error:
>>> runfile('/home/pi/Vincent/test.py', wdir=r'/home/pi/Vincent')
UMD has deleted: di_sensors.VL53L0X, I2C_mutex, easygopigo3, gopigo3, di_sensors.distance_sensor, di_sensors, di_sensors.dexter_i2c
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 580, in runfile
    execfile(filename, namespace)
  File "/home/pi/Vincent/test.py", line 6, in <module>
    my_distance_sensor = gpg.init_distance_sensor()
  File "easygopigo3.py", line 839, in init_distance_sensor
    return DistanceSensor(port, self)
  File "easygopigo3.py", line 2624, in __init__
    _release_read()
  File "easygopigo3.py", line 79, in _release_read
    I2C_Mutex_Release()
  File "I2C_mutex.py", line 25, in I2C_Mutex_Release
    DexterLockI2C_handle.close()
AttributeError: 'bool' object has no attribute 'close'

#2

Hello @vincent.serpico

Does the code run if you start it with sudo?

(the need for sudo is something we’re addressing but it isn’t released yet)

Cleo


#3

I disassembled and reassembled the robot, and all is working now.


#4

LOL. Well, there’s one way around it .
Glad you got it working! I hope you have fun with it.

Cleo


#5

This topic was automatically closed after 24 hours. New replies are no longer allowed.