I chose to use my XBox-One Controller to use with my robot.
It is a XBox One S controller, so it can be used without any dongles. The thing is, in this case, there are certain kind of changes to the bluetooth configuration that have to be done.
The first time around I only looked for instructions online, and I overlooked the steps required to unable the Enhanced Re-Transmission Mode (ERTM) for short, a bluetooth feature that doesn’t allow the devices to sync. I had only tried:
echo 'options bluetooth disable_ertm=Y' | sudo tee -a /etc/modprobe.d/bluetooth.conf
And then proceeded with the rest of several tutorials guiding me to sync my controll with the Raspberry Pi. No success. When I arrived to the last steps, the controll connected in a very unstable way, giving messages of connected/disconnected like this:

Then, I had a videochat with Gaby, my coach, and she made me follow another different set of steps. In these, there was a much deeper explanation of how to unable the ERTM. The key was creating a file in /etc/modprobe.d/. For doing so, I had to go root. The file has just this one line:
options bluetooth disable_ertm=Y
After that, I reboothed the Raspberry Pi.
Then, I followed the nexts steps (from the Approximate Engineering site):
Just in case, it’s never too much to install the proper bluetooth stack (even if normally it’s already there):
sudo apt-get install bluetooth libbluetooth3 libusb-dev
sudo systemctl enable bluetooth.service
sudo usermod -G bluetooth -a pi
Then, I went straight to work in the bluetooth with this line, (no need to root):
bluetoothctl
Once there, every command I used was straightly directed to the bluetooth stack. So, first thing there, enabling the default agent:
#agent on
#default-agent
Once that done, the response was:
Default agent request successful
Up to here, everything was ok, so I kept following the steps, the next one being performing a bluetooth scan:
# scan on
When performing the scan, the response is:
Discovery started
And then:
[CHG] Device EC:83:50:C8:9C:B2 Discovering: yes
The sequence of 12 letters and numbers is the specific IP adress of my controller, as discovered by the Raspberry Pi.
Everything was working! So I kept following the steps. After the discovery was done, it was time for connecting. For that, I used:
connect EC:83:50:C8:9C:B2
Normally, after that the message would have been:
[CHG] Device EC:83:50:C8:9C:B2 Connected: yes
But I still had the connected/disconnected messages, and I couldn’t arrive to do the trust. I repeated the process several times, with no sucess. After trying to understand why, I remembered that I was using the same device adress that the scan had given me before downloading the stack, and before properly disabling the ERTM, so I erased the device using:
remove EC:83:50:C8:9C:B2
And then, I restarted the process since the discovery part.
This time, It worked. The connected message was stable, and so lastly I trusted the device using
trust EC:83:50:C8:9C:B2
This time, I had a very reasuring screen:

So, now it was time to test the connection. For that, I used:
sudo apt-get install joystick
sudo jstest /dev/input/js0
And then, it worked:

In the meanwhile, I had installed the Explorer Hat and so, I was eager to try and move my robot. The thing is, again I may be lacking a library, because it doesn’t work using the controller.
I get this screen:

But, nonetheless, I succeeded in moving my robot creating a Python File with these lines:
import explorerhat as eh
import time
eh.motor.one.forwards(100)
eh.motor.two.forwards(100)
time.sleep(20)
eh.motor.stop()
This gave me the time to unplug mouse, screen and finally keyboard to observe my robot spinning wildly for the first time.
So, today I’m going to try and fix the missing library problem to properly use the Explorer Hat with the controller and move in a less chaotic way my little Kaladin-bot.
Work in progress 😉
