Hello.
I tried control of picar-4wd with ubuntu on raspi4.
“picar-4wd test motor” shows following error:
error: [Errno 2] No such file or directory: ‘/home/pi/.picar-4wd/config’
error: [Errno 2] No such file or directory: ‘/home/pi/.picar-4wd/config’
error: [Errno 2] No such file or directory: ‘/home/pi/.picar-4wd/config’
error: [Errno 2] No such file or directory: ‘/home/pi/.picar-4wd/config’
error: [Errno 2] No such file or directory: ‘/home/pi/.picar-4wd/config’
Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/picar_4wd-0.0.1-py3.8.egg/picar_4wd/i2c.py”, line 17, in wrapper
return func(*args, **kw)
File “/usr/local/lib/python3.8/dist-packages/picar_4wd-0.0.1-py3.8.egg/picar_4wd/i2c.py”, line 37, in _i2c_write_word_data
return self._smbus.write_word_data(addr, reg, data)
OSError: [Errno 121] Remote I/O error
Yes, the default user name on our tutorial is pi, so the path is also the default pi.
If your username is not pi, just change the path, for example:
cd /home/pi/picar-4wd/ #default username: pi
Modify it to
cd /home/ubuntu/picar-4wd/ #username: ubuntu
That’s it!
Due to the long test time, you can also use an external power supply to power the Raspberry Pi at the same time. However, 4WD-Hat can only be powered by battery, you cannot use external power directly without battery, otherwise the following error will occur when running the command: picar-4wd test motor.
---- picar-4wd test motor return OSError: [Errno 121] Remote I/O error ----
a.Please make sure you connect the battery to robot hat.
b. Is the battery level sufficient.
Execute picar-4wd power-read to get the power voltage.
c.Execute picar-4wd soft-reset command to reset the controller.
I changed pi to ubuntu in setup.py. And I executed the setup.py.
4WD-Hat gets power from 18650 batteries. And a power switch on the hat was ON.
Then, I tried to execute a program /home/ubuntu/picar-4wd/examples/keyboard_control.py
However, I got following error in import statement of picar-4wd.
Could I please ask for advice.
Traceback (most recent call last):
File “/usr/local/lib/python3.8/dist-packages/picar_4wd-0.0.1-py3.8.egg/picar_4wd/i2c.py”, line 17, in wrapper
return func(*args, **kw)
File “/usr/local/lib/python3.8/dist-packages/picar_4wd-0.0.1-py3.8.egg/picar_4wd/i2c.py”, line 37, in _i2c_write_word_data
return self._smbus.write_word_data(addr, reg, data)
OSError: [Errno 121] Remote I/O error
You execute sudo raspi-config ,check whether i2c service is enabled or not, if not, please enable it.
If it is enabled or it still reports an error, please execute i2cdetect -y 1 to see if the i2c service port signal is recognized. (Please provide screenshot)
If you have a spare Raspberry Pi, please replace the Raspberry Pi and go to execute the code again to see if the same error will occur.
If the above methods are tried more than once, still the i2c error will appear, maybe the robot hat is damaged, you need to replace the robot hat with a new one.