PiCar-X with bluetooth game controller?

Hi, I have assembled my new Picar-X and am waiting for a new Raspberry Pi 5 to arrive.
Is there some description or (python) example how to use a XBox (compatible) bluetooth game controller to control the PiCar functions?

I wrote one for a ps4 controller and pidog a couple of years ago. I don’t remember if I shared it on this forum or not. I’m sure lots of people have probably done this as it’s an oft made request, and they may be able to share.

If not, when I get time, I’ll try to see if I still have a copy around anywhere, but I am prone to reusing my old sd cards and wiping any old code on them!

The basic development flow was…

Pair controller with rpi BT.

Press all the controller buttons and capture the BT responses in a file

Then write some python to send these same commands to a modified version of Sunfounders control software.

Memory coming back. I wrote this as a pair of coupled ROS nodes as part of a bigger ros project, so unnecessarily complex for a simple controller. I don’t think I ever did a standalone version.

Thanks, actually I am looking for a python example of the first part “pair and communicate with a BT/BLE joystick controller in python” to get a fast start for the second part.
I used to be a software developer for some time, retired now, but have no experience with bluetooth/ble programming.

Interesting: ROS sending a barking piDog to the backyard gate when someone enters :grinning_face:. Have followed an online ROS course (DelftX university in the Netherlands) a few years ago, but never got to use it. Though 2 cooperating lego cars might be a good idea, a loader and a dump truck and an AI camera.

I started from here ..

and here

Here’s a link to some other work and my scripts that I wrote to help another query to install and run ROS2 onto rpi platform

I used ROS2 to create a suitable environment in which to automate pidog via orbslam3. I’ve posted the final scripts and operating videos etc on this forum somewhere! But it was some time ago and they may have expired by now, not sure, not really developing stuff any more

Thanks, orbslam3 + ROS is very interesting, I will try it when my piCar and Lego cars can be controlled from my pc.
My rPi 5 has arrived, is blazingly fast with a NVMe base mounted SSD as drive (I hope the battery will not be drained too fast), yet to install the robotHat software.

For access to the game controller, I will try hid_gamepad or pyglet https://pyglet.org/ , https://github.com/pyglet/pyglet (pure python, using system openGL library)

Welcome to the retired engineers club :wink: