Xbox Controller + Wireless Gaming Receiever + Raspberry Pi
Xbox Controller + Wireless Gaming Receiever + Raspberry Pi
I'm really close to getting my Rasp Pi working with the an Xbox Controller, however I'm stuck at getting the controller to sync with the Gaming Receiver. The controller's ring just continually flashes green. I think it may have something to with the Pi, but I'm not sure as I'm definitely not a linux/debian dude. If anyone has any ideas, I'd really appreciate it.
thanks!
thanks!
Crazyflie Nano 10-DOF | AR Drone v1 | MikroKopter Okto
Re: Xbox Controller + Wireless Gaming Receiever + Raspberry
Here's what I did to get mine to work:
Are you using xboxdrv or driving a different approach?
Code: Select all
sudo apt-get install xboxdrv
sudo xboxdrv
Also: AR.Drone 2.0 (RC-enabled thanks to self-soldered MiruMod) and Hubsan X4 H107
Re: Xbox Controller + Wireless Gaming Receiever + Raspberry
Yes I'm using xboxdrv but I only did the first line.
Crazyflie Nano 10-DOF | AR Drone v1 | MikroKopter Okto
Re: Xbox Controller + Wireless Gaming Receiever + Raspberry
The command "sudo xboxdrv" just starts the program as root.
Re: Xbox Controller + Wireless Gaming Receiever + Raspberry
Which I had to do at least on my Pi, otherwise I got an error message (might have been before setting up proper udev rules though). Speaking of which (x-posted from here):
foosel wrote: /etc/udev/rules.d/99-xbox360.rules/root/bin/xbox360Code: Select all
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0719", RUN+="/root/bin/xbox360"
Code: Select all
#!/bin/sh if test "$ACTION" = "add" then /usr/bin/xboxdrv & else killall -9 xboxdrv fi
Also: AR.Drone 2.0 (RC-enabled thanks to self-soldered MiruMod) and Hubsan X4 H107
Re: Xbox Controller + Wireless Gaming Receiever + Raspberry
Thanks foosel and frog! Yes, I had to execute the to get the controller to pair to the gaming receiver. Wicked!
However now the problem is I can't plug in the gaming receiver, radio and keyboard (necessary to execute the commands) because there are only two USB ports on the Pi.
So, I tried to follow the instructions to make the client automatic start simply by plugging the radio dongle in, but the only thing that seems to happen is that the console shows a Crazyradio USB Dongle has found (with idVendor=1915 & idProduct=7777). The client does not appear to run at all.
Code: Select all
sudo xboxdrv
However now the problem is I can't plug in the gaming receiver, radio and keyboard (necessary to execute the commands) because there are only two USB ports on the Pi.
So, I tried to follow the instructions to make the client automatic start simply by plugging the radio dongle in, but the only thing that seems to happen is that the console shows a Crazyradio USB Dongle has found (with idVendor=1915 & idProduct=7777). The client does not appear to run at all.
Crazyflie Nano 10-DOF | AR Drone v1 | MikroKopter Okto
Re: Xbox Controller + Wireless Gaming Receiever + Raspberry
Have you made sure to plug in the controller first? If the client doesn't find a controller, it will just shutdown (or hang, can't remember which it was). Also, make sure to make the scripts referenced in the udev rules executable (sudo chmod +x /root/bin/cfheadless /root/bin/xbox360). In order to debug stuff, you might want to get your hands either on an USB hub, or just connect your Pi via ethernet, SSH into the box and take a look what's happening this way, this is what I did when creating those instructions.
Also: AR.Drone 2.0 (RC-enabled thanks to self-soldered MiruMod) and Hubsan X4 H107
Re: Xbox Controller + Wireless Gaming Receiever + Raspberry
I have made the two files (cfheadless and xbox360) executable but when I plug in the controller (or rather the gaming receiver) nothing happens. Shouldn't the xboxdrv get automatically started?'
I did manage to SSH into my Pi and by opening two tabs in my terminal, I was able to separately execute both the xboxdrv and cfheadless. From the terminal, I can see the xbox controls affecting the output and the radio appears connected to the CrazyFlie (green LED on). However the I still can't get liftoff. Here is the output from one of the open tabs:
I did manage to SSH into my Pi and by opening two tabs in my terminal, I was able to separately execute both the xboxdrv and cfheadless. From the terminal, I can see the xbox controls affecting the output and the radio appears connected to the CrazyFlie (green LED on). However the I still can't get liftoff. Here is the output from one of the open tabs:
Code: Select all
root@debian:~# python ~/crazyflie-pc-client/bin/cfheadless
Info: Using config path: /root/crazyflie-pc-client/lib/../conf
Info: sys.path= ['/root/crazyflie-pc-client/lib', '/root/crazyflie-pc-client/lib/../conf', '/root/crazyflie-pc-client/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/pymodules/python2.7']
Disabling standard output for libraries!
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4241:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4720:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM default
INFO:cfclient.utils.config:Dist config read from /root/crazyflie-pc-client/lib/cfclient/configs/config.json
INFO:cfclient.utils.input:Parsing [PS3_Mode_1.json]
INFO:cfclient.utils.input:Parsing [xbox360_mode1.json]
INFO:cfclient.utils.input:Parsing [Generic_OS_X.json]
INFO:cfclient.utils.input:Parsing [PS3_Mode_2.json]
DEBUG:cflib.crazyflie:Adding callback on port [5] to [<bound method Log._new_packet_cb of <cflib.crazyflie.log.Log instance at 0x14a9c10>>]
DEBUG:cflib.crazyflie:Adding callback on port [0] to [<bound method Console.incoming of <cflib.crazyflie.console.Console instance at 0x1592058>>]
DEBUG:cflib.crazyflie:Adding callback on port [2] to [<bound method _ParamUpdater._new_packet_cb of <_ParamUpdater(Thread-2, initial daemon)>>]
INFO:cflib.crazyflie:Callback->Connection initialized[radio://0/10/250K]
INFO:cflib.crazyflie:We are connected[radio://0/10/250K], request connection setup
DEBUG:cflib.crazyflie.toc:[5]: Start fetching...
DEBUG:cflib.crazyflie:Adding callback on port [5] to [<bound method TocFetcher._new_packet_cb of <cflib.crazyflie.toc.TocFetcher instance at 0x1592a58>>]
DEBUG:cflib.crazyflie:ExpectAnswer: Will expect answer on port [5]
Found [Xbox Gamepad (userspace driver)]
Found [Xbox Gamepad (userspace driver)]
Will use [Xbox Gamepad (userspace driver)] for input
Error while opening/initializing input device
Traceback (most recent call last):
File "/root/crazyflie-pc-client/lib/cfclient/utils/input.py", line 226, in startInput
idx = self.listOfConfigs.index(configName)
ValueError: 'xbox360_model' is not in list
DEBUG:cflib.crazyflie:ExpectAnswer: No answer on [5], do retry
DEBUG:cflib.crazyflie:ExpectAnswer: Will expect answer on port [5]
WARNING:cflib.crazyflie:ExpectAnswer: ERROR! Older timer whas running while scheduling new one on [5]
DEBUG:cflib.crazyflie:ExpectAnswer: No answer on [5], do retry
DEBUG:cflib.crazyflie:ExpectAnswer: Will expect answer on port [5]
WARNING:cflib.crazyflie:ExpectAnswer: ERROR! Older timer whas running while scheduling new one on [5]
DEBUG:cflib.crazyflie:ExpectAnswer: No answer on [5], do retry
DEBUG:cflib.crazyflie:ExpectAnswer: Will expect answer on port [5]
WARNING:cflib.crazyflie:ExpectAnswer: ERROR! Older timer whas running while scheduling new one on [5]
DEBUG:cflib.crazyflie:ExpectAnswer: No answer on [5], do retry
DEBUG:cflib.crazyflie:ExpectAnswer: Will expect answer on port [5]
WARNING:cflib.crazyflie:ExpectAnswer: ERROR! Older timer whas running while scheduling new one on [5]
INFO:cflib.crazyflie:Callback->Connected to [radio://0/10/250K]
DEBUG:cflib.crazyflie:ExpectAnswer: Got answer back on port [5], cancelling timer
ERROR:cflib.crazyflie.toc:Got packet that was not on TOC channel, TOC fetch will probably not succeed
DEBUG:cflib.crazyflie.toc:[5]: Got TOC CRC, 9 items and crc=0x892049D2
INFO:cflib.crazyflie.toc:TOC for port [5] found in cache
DEBUG:cflib.crazyflie:Removing callback on port [5] to [<bound method TocFetcher._new_packet_cb of <cflib.crazyflie.toc.TocFetcher instance at 0x1592a58>>]
DEBUG:cflib.crazyflie.toc:[5]: Done!
INFO:cflib.crazyflie:Log TOC finished updating
DEBUG:cflib.crazyflie.toc:[2]: Start fetching...
DEBUG:cflib.crazyflie:Adding callback on port [2] to [<bound method TocFetcher._new_packet_cb of <cflib.crazyflie.toc.TocFetcher instance at 0x15af080>>]
DEBUG:cflib.crazyflie:ExpectAnswer: Will expect answer on port [2]
DEBUG:cflib.crazyflie:ExpectAnswer: Got answer back on port [2], cancelling timer
DEBUG:cflib.crazyflie.toc:[2]: Got TOC CRC, 27 items and crc=0x27A2C4BA
INFO:cflib.crazyflie.toc:TOC for port [2] found in cache
DEBUG:cflib.crazyflie:Removing callback on port [2] to [<bound method TocFetcher._new_packet_cb of <cflib.crazyflie.toc.TocFetcher instance at 0x15af080>>]
DEBUG:cflib.crazyflie.toc:[2]: Done!
INFO:cflib.crazyflie:Param TOC finished updating
INFO:cflib.crazyflie:Callback->Connection setup finished [radio://0/10/250K]
Crazyflie Nano 10-DOF | AR Drone v1 | MikroKopter Okto
Re: Xbox Controller + Wireless Gaming Receiever + Raspberry
Code: Select all
Traceback (most recent call last):
File "/root/crazyflie-pc-client/lib/cfclient/utils/input.py", line 226, in startInput
idx = self.listOfConfigs.index(configName)
ValueError: 'xbox360_model' is not in list
Code: Select all
INFO:cfclient.utils.input:Parsing [PS3_Mode_1.json]
INFO:cfclient.utils.input:Parsing [xbox360_mode1.json]
INFO:cfclient.utils.input:Parsing [Generic_OS_X.json]
INFO:cfclient.utils.input:Parsing [PS3_Mode_2.json]
Only if you added a corresponding udev rule (maybe check if the vendor and product ids are correct for you using lsusb) and this rule gets parsed properly. If you perform a sudo /etc/init.d/udev restart and take a look at the end of /var/log/syslog afterwards, are there any error messages regarding the parsing of udev rulesets?skube wrote:I have made the two files (cfheadless and xbox360) executable but when I plug in the controller (or rather the gaming receiver) nothing happens. Shouldn't the xboxdrv get automatically started?'
Also: AR.Drone 2.0 (RC-enabled thanks to self-soldered MiruMod) and Hubsan X4 H107
Re: Xbox Controller + Wireless Gaming Receiever + Raspberry
I corrected the spelling of the mapping file (xbox360_model -> xbox360_mode1) and that worked! Well, I was able to affect Crazyflie with the XBox controller, however the mappings are all messed up for some reason. (Thrust is on the right joystick and diagonal!). Though the output on the xboxdrv tab appears correct, so I'm assuming it must be something with the cfheadless client.
Also, when trying to start the xboxdrv, it seems to only work when I switch to root (su -):
Probably cause I don't know what I'm doing Does it matter though? Can I just leave running as root as is? As I understand it, I think I would have to install everything (headless client) again as the default user instead of root.foosel wrote: As you are running cfheadless as root (why?)
Also, when trying to start the xboxdrv, it seems to only work when I switch to root (su -):
Code: Select all
skube@debian:~$ xboxdrv
xboxdrv 0.8.4 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmx.de>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details.
Controller: Microsoft Xbox 360 Wireless Controller (PC)
Vendor/Product: 045e:0719
USB Path: 001:007
Wireless Port: 0
Controller Type: Xbox360 (wireless)
-- [ ERROR ] ------------------------------------------------------
USBController::USBController(): libusb_open() failed: LIBUSB_ERROR_ACCESS
skube@debian:~$ su -
Password:
root@debian:~# xboxdrv
xboxdrv 0.8.4 - http://pingus.seul.org/~grumbel/xboxdrv/
Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmx.de>
Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details.
Controller: Microsoft Xbox 360 Wireless Controller (PC)
Vendor/Product: 045e:0719
USB Path: 001:007
Wireless Port: 0
Controller Type: Xbox360 (wireless)
Your Xbox/Xbox360 controller should now be available as:
/dev/input/js0
/dev/input/event0
Press Ctrl-c to quit, use '--silent' to suppress the event output
Crazyflie Nano 10-DOF | AR Drone v1 | MikroKopter Okto