Taking a crack at the Pi-5 (Unicorn Warning!)

Now that I have a Pi-5 AND a robot to experiment with, I’d like to take a crack at building a GoPiGo OS version that will run on the Pi-5, since it’s a lead-pipe cinch that people are going to want to go there.

Aside from questions about my sanity, :wink:, I am interested in a concise statement of what is necessary to install the GoPiGo libraries on a Pi-4, including any special tweaks, tricks and “gotchas” that might be useful to know.

Thanks!

(Sound bite:  They’re coming to take me away hee hee, has haa, ho ho!  Those nice young men in their clean white coats. . . .)

2 Likes

Concise:

  • Setup the Bookworm OS
  • Install GoPiGo3 software - it will fail
  • Remove GoPiGo3 software I2C (depends on wiringpi not avail on bookworm)
  • Run individual setup.py to build the GoPiGo3 Python3 dist eggs
  • Update distance_sensor and easy_distance_sensor code to default to hardware I2C
  • Run basic GoPiGo3 tests

All the “setup.py” files and source changes needed are here.

Since I installed Bullseye and upgraded to Bookworm before installing the GoPiGo3 software, this is the relevant part of the process from my setup log:

===Install GoPiGo3 software

  $ git clone http://www.github.com/DexterInd/GoPiGo3.git /home/pi/Dexter/GoPiGo3 
  $ sudo curl -kL dexterindustries.com/update_tools | bash -s -- --system-wide --use-python3-exe-too --install-deb-debs --install-python-package
  $ sudo apt install -y --no-install-recommends python3-curtsies
  $ git clone https://github.com/DexterInd/DI_Sensors.git /home/pi/Dexter/DI_Sensors

=== pigpiod

wget https://github.com/joan2937/pigpio/archive/master.zip
unzip master.zip
cd pigpio-master
make
sudo make install
cd ..
rm master.zip

mkdir config
cd config
wget https://raw.githubusercontent.com/slowrunner/ROS2-GoPiGo3/main/utils/pigpiod.service
sudo cp pigpiod.service /etc/systemd/system
sudo systemctl enable pigpiod.service
sudo systemctl start pigpiod.service
systemctl status pigpiod.service

wget https://raw.githubusercontent.com/slowrunner/ROS2-GoPiGo3/main/utils/99-com.rules

=== setup RFR_Tools

sudo git clone https://github.com/DexterInd/RFR_Tools.git /home/pi/Dexter/lib/Dexter/RFR_Tools
sudo apt  install -y libffi-dev

cd /home/pi/Dexter/lib/Dexter//RFR_Tools/miscellaneous/

sudo nano di_i2c.py  -> comment out all RPI_1SW, wiringpi, class DI_I2C_RPI_SW

sudo python3 setup.py install

The GoPiGo3 depends on wiringpi , which has not been updated for the RP1 I/O controller of the Raspberry Pi 5 (and Bookworm). This is the major hurdle

== Details ==
I got Dexter_AutoDetection_and_I2C_Mutex-1.3.2-py3.11.egg built and installed.

GoPiGo3 depends on wiringpi which fails build/install:

Running wiringpi-2.60.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-qxc_o8le/wiringpi-2.60.1/egg-dist-tmp-9w9i89c3
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
.
.
File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 17, in finalize_options
    self.set_undefined_options('install',('install_layout','install_layout'))
  File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 296, in set_undefined_options
    setattr(self, dst_option, getattr(src_cmd_obj, src_option))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
    raise AttributeError(attr)
AttributeError: install_layout. Did you mean: 'install_platlib'?

=== also depends on smbus-cffi

pip install smbus-cffi --break-system-packages

sudo nano setup.py  

        install_requires=[ 'pyserial', 'python-periphery'],
)

#       install_requires=['smbus-cffi', 'pyserial', 'python-periphery', 'wiringpi'],

==== GPG3_POWER SERVICE ===

cd ~
sudo cp /home/pi/Dexter/GoPiGo3/Install/gpg3_power.service /etc/systemd/system
sudo chmod 644 /etc/systemd/system/gpg3_power.service
sudo systemctl daemon-reload
sudo systemctl enable gpg3_power.service
sudo systemctl start gpg3_power.service
systemctl status gpg3_power.service

==== SETUP GoPiGo3 and DI_Sensors Python3 eggs

pip install spidev --break-system-packages



cd /home/pi/Dexter/GoPiGo3/Software/Python

nano setup.py
    install_requires = ['pigpio']
)
#    install_requires = ['spidev', 'pigpio']


sudo python3 setup.py install


cd /home/pi/Dexter/DI_Sensors/Python

sudo nano di_sensors/easy_distance_sensor.py

    #def __init__(self, port="I2C", use_mutex=False):
    # use hardware i2c for bookworm
    def __init__(self, port="RPI_1", use_mutex=False):

sudo nano di_sensors/distance_sensor.py

    #def __init__(self, bus = "RPI_1SW"):
    # Use hardware i2c for bookworm
    def __init__(self, bus = "RPI_1"):
        """
        Constructor for initializing a :py:class:`~di_sensors.distance_sensor.DistanceSensor` class.

        #:param str bus = "RPI_1SW": The bus to which the distance sensor is connected to. By default, it's set to bus ``"RPI_1SW"``. Check the :ref:`hardware specs <hardware-interface-section>` >
        # use RPI_1 hardware i2c for bookworm
        :param str bus = "RPI_1": The bus to which the distance sensor is connected to. By default, it's set to bus ``"RPI_1"``. Check the :ref:`hardware specs <hardware-interface-section>` for m>


sudo python3 setup.py install

==== Setup non-root access rules ====

sudo cp /home/pi/config/99-com.rules /etc/udev/rules.d

cp /home/pi/Dexter/GoPiGo3/Install/list_of_serial_numbers.pkl /home/pi/Dexter/.list_of_serial_numbers.pkl

=== ESPEAK-NG

sudo apt install -y espeak-ng
pip3 install py-espeak-ng --break-system-packages
espeak-ng "Am I alive? Can you hear me?"

# Install ffmpeg to allow ffplay to play tts from espeak-ng -w file 
# already installed:  sudo apt install -y ffmpeg



  $ sudo reboot
  (Note green pwr LED will be solid after this indicating gpg3_power.service is running)
  (Note red/green "yellow" WiFi LED means connected to WiFi)

Test GoPiGo3 Software Installation

  $ cd Dexter/GoPiGo3/Software/Examples
  $ ./Read_Info.py

pi@64BitPiOS:~/Dexter/GoPiGo3/Software/Python/Examples $ ./Read_Info.py 
Traceback (most recent call last):
  File "/home/pi/Dexter/GoPiGo3/Software/Python/Examples/./Read_Info.py", line 17, in <module>
    import gopigo3 # import the GoPiGo3 drivers
ModuleNotFoundError: No module named 'gopigo3'




python3 /home/pi/Dexter/GoPiGo3/Software/Python/Examples/LED.py  <<---- Works
python3 /home/pi/Dexter/GoPiGo3/Software/Python/Examples/Servo.py    <<---- WORKS!
python3 /home/pi/Dexter/GoPiGo3/Software/Python/Examples/Motor_Turn.py  <<--- WORKS oh wow...
python3 /home/pi/Dexter/GoPiGo3/Software/Python/Examples/easy_Distance_Sensor.py
python ~/Dexter/GoPiGo3/Software/Python/Examples/Grove_US2.py


  • check gpg3_config.json for ticks
  $ more ~/Dexter/gpg3_config.json
    * "Old GoPiGo3":
{"wheel-diameter": 66.5, "wheel-base-width": 117, "ticks": 6, "motor_gear_ratio": 120}
    * "New GoPiGo3":
{"wheel-diameter": 66.5, "wheel-base-width": 117, "ticks": 16, "motor_gear_ratio": 120}
  • Continue with test effectors and sensors
  $ ./Motors.py
  $ ./Servo.py
  $ ./Grove_US2.py  (with Grove Ultrasonic Ranger in AD1 for time being)
  $ ./easy_Distance_Sensor.py 
  $ python3 ~/Dexter/DI_sensors/Python/Examples/IMUSensor.py 
  (Put IMU in AD1, move Grove US ranger to AD2 and 
    change Grove_US.py GPG.GROVE_1 to GPG.GROVE_2 two places)
1 Like