Xbox One controller - wireless

Post any suggestions that you have for new features and enhancements for the Buildbotics Controller here.
Post Reply
tmadrms
Posts: 19
Joined: Mon Dec 23, 2019 10:16 pm

Xbox One controller - wireless

Post by tmadrms » Wed Feb 05, 2020 9:24 pm

I've been able to connect the Xbox One bluetooth controller via a USB bluetooth connection and the X/Y moves and face buttons behave same as logitech gamepad, but the A/Z stick doesn't move the Z. Any ideas on how to map those? I used this guide as the basics on getting it connected. I did not mod for mouse as I'm not interested in that so I stopped short of that set of instructions. https://pimylifeup.com/xbox-controllers-raspberry-pi/ Again, everything seems to be working minus the A/Z movement.

I suspect it is here: https://github.com/buildbotics/bbctrl-f ... trl/Jog.py
However, I'm not sure how to find the new values (if this is even the right path).

User avatar
Joe
Site Admin
Posts: 4
Joined: Fri Feb 02, 2018 2:00 pm
Location: Petaluma, CA
Contact:

Re: Xbox One controller - wireless

Post by Joe » Sat Feb 08, 2020 12:51 pm

We plan to add the ability to configure different game controllers but it's not there yet. See #197. In the meantime, you could modify Jog.py and add another config section for your game controller.

First ssh into your controller. You should be able do this on Linux or MacOS with the following command:

Code: Select all

ssh bbmc@bbctrl.local
The default password is "buildbotics". Use something like Putty on Windows.

Then run these commands:

Code: Select all

sudo apt-get update
sudo apt-get install -y evtest
Again the default password is "buildbotics". Then plugin your game controller and run:

Code: Select all

sudo service bbctrl stop
sudo evtest
Select the number of the game controller device. Note the "Input device name: ..." section. You need this exact name in the config in Jog.py to match your controller. Now if you press buttons or move the axes on the controller the codes will be displayed on the screen. Exit evtest with CTRL-C.

Fill the codes into a new Jog.py config section using this template:

Code: Select all

"<input device name>": {
  "deadband": 0.1,
  "axes":     [<x-axis stick>, <y-axis stick>, <z-axis stick>, <a-axis stick>],
  "dir":      [<x-axis direction>, <y-axis direction>, <z-axis direction>, <a-axis direction>],
  "arrows":   [<left arrow>, <right arrow>],
  "speed":    [<crawl speed>, <low speed>, <medium speed>, <high speed>],
  "lock":     [<horizontal axis lock>, <vertical axis lock>],
},
The directions settings are either 1 or -1. -1 reverses the direction. You can manually edit your Jog.py file like this:

Code: Select all

sudo nano /usr/local/lib/python3.5/dist-packages/bbctrl-0.4.12-py3.5.egg/bbctrl/Jog.py
Remember spaces are important in Python. You may have to modify the above path to match your installed firmware version. Note that Jog.py will get overwritten when you upgrade. If you get a working config, send it to me and I'll add it to the firmware permanently. As I said above, eventually this will all be configurable via the Web interface.

Good luck,

Joe

tmadrms
Posts: 19
Joined: Mon Dec 23, 2019 10:16 pm

Re: Xbox One controller - wireless

Post by tmadrms » Sun Feb 09, 2020 3:59 pm

Awesome! This got it. Weirdly, it seems they (Xbox One and Logitech) output the exact same EVtest data, but I had to modify default to get it to work. Only need to mod the Z of the default to use the ABS_RZ and the rest worked out of the box (I'd assume if you had an A axis it'd need the mod as well). Adding an additional for the controller using the name from EVtest did not work, maybe I missed something, but I copy/pasted name to be sure I got it right. Either way, super easy mod. I assume this change will be overridden with firmware update? Just curious, super easy to fix now that I know what to change. Thanks again for your assistance, I'm very pleased to have one less cable in the way!

Post Reply