Python Build Hat for Ubuntu 22
Closed this issue · 8 comments
Is there a port of the Python Build Hat libraries for Ubuntu 22?
According to the Ubuntu package-search, it's only available (as a pre-built package) for mantic
and noble
https://packages.ubuntu.com/mantic/python3-build-hat
( https://wiki.ubuntu.com/DevelopmentCodeNames says Mantic Minotaur is 23.10 )
Ubuntu 22 is the Long Term Support version, supported until 2032. ROS 2 is available only on Ubuntu 22. Since I am building a project based on robotics, I need this infrastructure. Not having Build Hat for Ubuntu 22, dictates that I must move to a different motor control environment.
ran the sample twice, waited two minutes for response. Each time it hung on line 5 "motor = Motor('A')" traceback follows
Traceback (most recent call last):
File "/usr/src/car/build-hat-test.py", line 5, in
motor = Motor('A')
File "/home/pi/.local/lib/python3.10/site-packages/buildhat/motors.py", line 108, in init
super().init(port)
File "/home/pi/.local/lib/python3.10/site-packages/buildhat/devices.py", line 58, in init
Device._setup()
File "/home/pi/.local/lib/python3.10/site-packages/buildhat/devices.py", line 82, in _setup
Device._instance = BuildHAT(firm, sig, v, **kwargs)
File "/home/pi/.local/lib/python3.10/site-packages/buildhat/serinterface.py", line 118, in init
self.write(b"version\r")
File "/home/pi/.local/lib/python3.10/site-packages/buildhat/serinterface.py", line 257, in write
self.ser.write(data)
File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 640, in write
abort, ready, _ = select.select([self.pipe_abort_write_r], [self.fd], [], None)
also my gpio driver for the servo no longer works.
Your code is getting hung on the serial port code. I would try communicating directly with BuildHAT with a terminal emulator to determine if you have the serial port set up properly. If it is working, you may need to pass the device to use into the HAT constructor if it is not the default that the library expects.
have the serial port set up properly
Here's how you'd do that in Raspberry Pi OS, but I've not used Ubuntu on Pi so I dunno what steps would be needed for that
https://www.raspberrypi.com/documentation/accessories/build-hat.html#setting-up-your-raspberry-pi
Many thanks. The serial port was the issue.
I edited cmdline.txt in /boot/firmware to remove 'console=serial0,115200'
config.txt already had the uart enabled.
I rebooted and my various devices began working. No need to switch my motors!!!