Closed mugginsjm closed 1 year ago
This suggests the virtualenvs has a python2 interpreter instead of a python3 (forced as python). I think something went wrong during the installation. if you type python3 it will work: (.virtualenvs) pi@rubicPI:~/cubotino_micro/src $ python3 Cubotino_m_servos.py --set 0 This is a workarround, not the solution. You might want to repeat the installation, perhaps on a second microSD if you'd like to keep going with the robot...
Strange because I downloaded the most recent RPI legacy file. Anyway thanks, I'll start again. I've printed all the parts and have now got most of the hardware. Exciting !!
I'm not sufficiently expert to suggest a correction. Once activated the virtualenv, type python to check which version is loaded
(.virtualenvs) pi@cubotino:~/cubotino_micro/src $ python
Python 3.7.3 (default, Oct 31 2022, 14:04:00)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
it should be a 3.7.
yes just as you said.. but don't know why. pi@rubicPI:~ $ cd /home/pi/cubotino_micro/src pi@rubicPI:~/cubotino_micro/src $ source .virtualenvs/bin/activate (.virtualenvs) pi@rubicPI:~/cubotino_micro/src $ python Python 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.
I'm afraid I don't know either. Last saturday I have repeated the full process from scratch, to test a little change on the setup.sh file, and it went smooth. At the setup end, before entering "Y" to reboot, you might want to select the complete printout and save it to a text file for a later check; To do this, one single click at the start and keep hoovering with mouse til the end. Once all text is selected DO NOT RIGHT CLICK, just open a text file and paste (the highlighted text is already memorized) As reference you could compare the printout at https://github.com/AndreaFavero71/CUBOTino_micro/blob/main/doc/Installation_printout.pdf
BTW, you might kep the current installation as is, and use python3 instead of python. On a later moment, or on a second microSD card, you might try for a clean installation. If you'll proceed in this way:
Using RPI installer and loading RPI (legacy) and before loading any of your firmware I get pi@rubicPI:~ $ python Python 2.7.16 (default, Oct 10 2019, 22:02:15) [GCC 8.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.
Is it because my Zero is quite old V1.1 ?
From the same shell type python3 to check the python3 version.
The OS is delivered with both python2 and python3; if you don't specify python3 then python2 interpreter is loaded when you type python. Things change when you make a virtual environment by specifying the intention to use python3; In that case python3 will be loaded when you type python.
pi@rubicPI:~ $ python3 Python 3.7.3 (default, Oct 31 2022, 14:04:00) [GCC 8.3.0] on linux
OK I can proceed now.
I get
(.virtualenvs) pi@rubicPI:~/cubotino_micro/src $ python3 Cubotino_m_servos.py --set 0
Traceback (most recent call last):
File "Cubotino_m_servos.py", line 34, in
if you 'pip3 list' you'll get the installed libraries list, ordered by names, and based on above error the ST7789 is not installed. It's still failing during the installation.....Have you checked if errors/warnings during the installation? Also saved the printout? In case you can send it to andreaDOTfavero71ATgmailDOT com
This should be how it looks like the installation of that library:
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting st7789==0.0.4
Downloading https://files.pythonhosted.org/packages/39/b5/99dd0f9b8bbee0c42f94388216da30502718a971fbfa2c26987020f5fa18/ST7789-0.0.4-py3-none-any.whl
Installing collected packages: st7789
Successfully installed st7789-0.0.4
you can install it manually, on the activated venv: pip3 install st7789==0.0.4
I have the feeling that if that library didn't initially install, probably also other didn't. Below the list of libraries to install manually, one command at the time: pip3 install numpy==1.21.4 pip3 install "picamera[array]" pip3 install st7789==0.0.4 pip3 install RubikTwoPhase==1.1.1 pip3 install getmac==0.8.3 pip3 install https://www.piwheels.org/simple/opencv-contrib-python/opencv_contrib_python-4.1.0.25-cp37-cp37m-linux_armv6l.whl
I don't know where the problem lies. I assume you're following the chapter 12 of the instructions. In case you have a second microSD, I'll consider to give it a try.....
I did a fresh install and then did a git clone then "edit the Cubotino_m_bash.sh file and add the suffix "3" to python." then sudo ./install/setup.sh
Now I have python 3 and no errors in running "python Cubotino_m_servos.py --set 0" except for the fact that the servos do not move. I'll investigate further. I'll send you the install results anyway. thanks for your patience. Great project and very well documented.
if servos were delivered to their mid position then it is correct if don't rotate. try differen targets, i.e. -1 or 1: python Cubotino_m_servos.py --set 1
btw, if 'python Cubotino_m_servos.py --set 0' do not return errors (by using python and not python3), then you can remove the suffix 3 from the bash file
OK
pi@rubicPI:~ $ cd /home/pi/cubotino_micro/src pi@rubicPI:~/cubotino_micro/src $ source .virtualenvs/bin/activate (.virtualenvs) pi@rubicPI:~/cubotino_micro/src $ python Cubotino_m_servos.py --set 0 File "Cubotino_m_servos.py", line 876 print(f'servo_angle out of range at string pos:{i}') # info are printed ^ SyntaxError: invalid syntax (.virtualenvs) pi@rubicPI:~/cubotino_micro/src $