A problem with calibration picar-x with raspberry

Good evening, my name is Giulio, and I’ve encountered a problem with the PiCar X calibration.

If I run the command sudo python3 1.cali_servo_motor.py i had this problem

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/gpiozero/pins/pi.py”, line 411, in pin
pin = self.pins[info]
~~~~~~~~~^^^^^^
KeyError: PinInfo(number=18, name=‘GPIO24’, names=frozenset({‘24’, ‘BCM24’, ‘J8:18’, ‘WPI5’, ‘GPIO24’, 24, ‘BOARD18’}), pull=‘’, row=9, col=2, interfaces=frozenset({‘’, ‘spi’, ‘dpi’, ‘jtag’, ‘sdio’, ‘gpio’}))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/robottino/picar-x/example/1.cali_servo_motor.py”, line 20, in
px = Picarx()
^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/picarx/picarx.py”, line 65, in init
self.right_rear_dir_pin = Pin(motor_pins[1])
^^^^^^^^^^^^^^^^^^
File “/usr/local/lib/python3.11/dist-packages/robot_hat/pin.py”, line 96, in init
self.setup(mode, pull, active_state)
File “/usr/local/lib/python3.11/dist-packages/robot_hat/pin.py”, line 134, in setup
self.gpio = OutputDevice(self._pin_num)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/gpiozero/devices.py”, line 108, in call
self = super().call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/gpiozero/output_devices.py”, line 74, in init
super().init(pin, pin_factory=pin_factory)
File “/usr/lib/python3/dist-packages/gpiozero/mixins.py”, line 75, in init
super().init(*args, **kwargs)
File “/usr/lib/python3/dist-packages/gpiozero/devices.py”, line 553, in init
pin = self.pin_factory.pin(pin)
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/gpiozero/pins/pi.py”, line 413, in pin
pin = self.pin_class(self, info)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/gpiozero/pins/lgpio.py”, line 126, in init
lgpio.gpio_claim_input(
File “/usr/lib/python3/dist-packages/lgpio.py”, line 755, in gpio_claim_input
return _u2i(_lgpio._gpio_claim_input(handle&0xffff, lFlags, gpio))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/lgpio.py”, line 458, in _u2i
raise error(error_text(v))
lgpio.error: ‘GPIO busy’

how can I fix it?

thanks

Based on the error message “lgpio.error: ‘GPIO busy’” you encountered, the core issue is that the GPIO pins required by the program are currently occupied by another process, preventing the proper initialization of the Picar-X’s motor pins.

Here are the most common causes and our recommended solutions:

GPIO Pin Conflict: The mentioned pin (e.g., GPIO24) might be occupied by other hardware or software configuration (for instance, if you have other sensors or devices using the same GPIO pins).

Concurrent Program Execution: Are you running two example programs simultaneously? Please note that only one program can access the GPIO at a time. If you wish to run another program, you must first terminate the currently running one.

Recommended Troubleshooting Step: We suggest rebooting your system first. After the reboot, try running the 1.cali_servo_motor.py example again to check if it works properly.

Following these steps should resolve the issue. If the problem persists, please feel free to contact us with more details about your setup.