We want to be able to control our XRPs via a gamepad. I understand that I can use Pestolink - which is great - but it seems as though I still need to have a computer to make the bluetooth connection to the XRP, i.e. the command chain is: xbox controller talks to the PC, which talks to the XRP. Is that right? Or, can I pair the xbox controller directly with the XRP - once I have uploaded suitable code to the XRP?
There are some gamepads that support the BLE HID specification. I would imagine that a driver could be written to support that directly. As far as I know no one has written a driver like that YET. Please keep us informed if you decide to write one.
Thanks for the clarification. I am going to pass the information on to some colleagues and I want to make sure I have this absolutely correct.
We are planning to run a Mountain Mayhem tournament in August. In order for the teams to compete they will need both a controller and a driver station for their bot, correct? Could the driver station be something like a raspberry pi? I.e. would that be enough to make the bluetooth connection to the bot? Actually, could they repurpose their existing FTC driver station unit? We want to make it as simple as possible for teams to get up and running at the event.
So all of the Xbox controllers from the Xbox one era on support Bluetooth low energy (so the Xbox one, elite series 2 and the Xbox series s/x controllers).
Pybricks, which is a form of micropython for the Lego hubs, uses ble and supports Xbox controllers. Might not be a terrible thing to take a look under the hood there and see how they do it. They even support the elite 2 including the rear paddles. Works pretty well with the various Lego hubs.
Thanks Dave, that’s a great suggestion. I will see if I can interest one of our students in doing this as a summer project. If I can, I will announce the fact here, just to avoid unnecessary duplication.
I just came across the aioble BLE package on the microphone site. (micropython-lib/micropython/bluetooth/aioble/README.md at master · micropython/micropython-lib · GitHub).
It seems to provide the basis of BLE connectivity. Before we dive into it I wanted to check if there is any obvious reason why it wouldn’t work on an XRP?
We use a different way of connecting. You can make aioble work with the XRP, but it wouldn’t be compatible with XRPCode or the way we do gamepad control.
Ah, in that case can you tell me more about how you connect? Basically, we need to get BLE controllers working directly with the XRPs. It would make it much easier for schools to get up and running if they didn’t need a laptop for each XRP.
Sorry, I wasn’t following as closely as I should have been. The BLE controllers use a specific protocol that is specific to the controllers. The trick is that both our ble code and the aioble code act as the bluetooth server (they advertise and the other devices connects to them). In the case of supporting a BLE controller the XRP will need to act as the client (scan for the controller and connect to it). You will be writing new code. But, there are probably examples out there. And if you plan to use an AI to help you, I find that Claude knows the most about Micropython.
Thanks Frank, that sounds encouraging. We will go and look into that. Thanks for your help