Page 2 of 5

Re: Raspberry Pi Troubles

Posted: Thu May 09, 2013 2:45 pm
by marcus
foosel wrote:Went all-in and bought a small organizer bag yesterday to fit all of the stuff in the picture above when cabled together and running
Nice setup! I think I need to get one more Raspberry Pi :D

Re: Raspberry Pi Troubles

Posted: Sat May 11, 2013 2:26 pm
by jtang613
Hey, I'd love to get cfheadless working on my Pi, but it seems to hang when trying to establish comms:

Code: Select all

 Info: Using config path:  /home/pi/crazyflie-pc-client/lib/../conf
Info: sys.path= ['/home/pi/crazyflie-pc-client/lib', '/home/pi/crazyflie-pc-client/lib/../conf', '/home/pi/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!
[+] Starting joystick
INFO:cfclient.utils.config:Dist config read from /home/pi/crazyflie-pc-client/lib/cfclient/configs/config.json
INFO:cfclient.utils.config:Config file read from [/home/pi/crazyflie-pc-client/lib/../conf/config.json]
INFO:cfclient.utils.input:Parsing [PS3_Mode_1.json]
INFO:cfclient.utils.input:Parsing [xbox360_mode1.json]
INFO:cfclient.utils.input:Parsing [Jason1.json]
INFO:cfclient.utils.input:Parsing [PS3_Mode_2.json]
INFO:cfclient.utils.input:Parsing [Generic_OS_X.json]
[+] Reading config
[+] Connecting to Crazyflie
DEBUG:cflib.crazyflie:Adding callback on port [5] to [<bound method Log._new_packet_cb of <cflib.crazyflie.log.Log instance at 0x188e0d0>>]
DEBUG:cflib.crazyflie:Adding callback on port [0] to [<bound method Console.incoming of <cflib.crazyflie.console.Console instance at 0x188e288>>]
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 0x188e5d0>>]
Any ideas as to what is going wrong?

Thanks

Re: Raspberry Pi Troubles

Posted: Sat May 11, 2013 2:41 pm
by jtang613
Nevermind. Turns out my radio:// URI had a lower-case 'k' instead of upper-case 'K'.

(I might point out that correct engineering notation uses lower-case k for kilo :) )

Re: Raspberry Pi Troubles

Posted: Sat May 11, 2013 3:28 pm
by foosel
Yeah, I fell into the same trap at first and it drove me nuts for two or three hours until I reread greggius configuration and it made click ;)

Re: Raspberry Pi Troubles

Posted: Tue May 14, 2013 10:19 am
by meinside
Hi, all.

I'm trying on my rev.1 Model B(256MB) Raspberry Pi with wired Xbox360 controller,

and configs are as follows:

~/crazyflie-pc-client/lib/cfcfheadless.py

Code: Select all

app = HeadlessClient(sys.argv,link_uri="radio://0/10/250K",
                               input_config="xbox360_mode1")
/etc/udev/rules.d/99-crazyradio.rules

Code: Select all

SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="7777", MODE=="0664", GROUP="plugdev", RUN+="/root/bin/cfheadless.sh"
/etc/udev/rules.d/99-xbox360.rules

Code: Select all

SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="028e", RUN+="/root/bin/xbox360wired.sh"
Crazyflie and the controller both connect well, but when cfheadless starts up,

it prints out no messages like:

Code: Select all

Found [Xbox Gamepad (userspace driver)]
Will use [Xbox Gamepad (userspace driver)] for input
and Crazyflie gets no input from the controller.

Am I missing something? Is there any difference with wireless and wired controllers?

Any help would be extremely appreciated :D

Re: Raspberry Pi Troubles

Posted: Tue May 14, 2013 10:41 am
by foosel
What the contents of /root/bin/xbox360wired.sh? What does it do when you start it manually?

Re: Raspberry Pi Troubles

Posted: Tue May 14, 2013 11:19 am
by meinside
foosel wrote:What the contents of /root/bin/xbox360wired.sh? What does it do when you start it manually?
It is written after the post, nothing special:

Code: Select all

#!/bin/sh
if test "$ACTION" = "add"
then
        /usr/bin/xboxdrv > /tmp/xboxdrv.log 2>&1 &
else
        killall -9 xboxdrv
fi
When I run xboxdrv manually, it prints out verbose messages related to the input of the controller:

Code: Select all

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 Controller
Vendor/Product:    045e:028e
USB Path:          001:007
Controller Type:   Xbox360

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
X1:   655 Y1:   -55  X2: -1406 Y2:  -322  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1:   655 Y1:   -55  X2: -1406 Y2:  -643  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1:   655 Y1:   -55  X2: -1406 Y2:  -964  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
X1:   655 Y1:   -55  X2: -1406 Y2: -1285  du:0 dd:0 dl:0 dr:0  back:0 guide:0 start:0  TL:0 TR:0  A:0 B:0 X:0 Y:0  LB:0 RB:0  LT:  0 RT:  0
...
The controller itself seems to be functioning ok.

Re: Raspberry Pi Troubles

Posted: Tue May 14, 2013 1:02 pm
by foosel
Ah, my guess is that you need to adjust the udev rule to match a different product id... what does lsusb say?

Re: Raspberry Pi Troubles

Posted: Tue May 14, 2013 1:10 pm
by meinside
foosel wrote:Ah, my guess is that you need to adjust the udev rule to match a different product id... what does lsusb say?
It is same as my rule file:

Code: Select all

Bus 001 Device 011: ID 045e:028e Microsoft Corp. Xbox360 Controller

Code: Select all

SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="028e", RUN+="/root/bin/xbox360wired.sh"
:cry:

Re: Raspberry Pi Troubles

Posted: Thu May 16, 2013 8:02 pm
by humblehacker
Hello,
I've been experiencing similar troubles with the udev rules only I'm just using the standard PS3 configuration.
I'm running the latest version of Raspbian (released in Feburary 2013) on a 512MB Pi with a USB Hub and a standard PS3 Controller.
There are a couple things I'm hung up on one is getting the root/bin/cfheadless script to compile and execute, and the other is getting the client to run at all.
I tried running chmod, but it doesn't look like the script was made executable. I can't figure out if I didn't execute it properly or if the script just isn't compiling. What exactly is the recommended method for adding the /root/bin/cfheadless file? Do you use Leafpad? Geany? IDLE?

When I try to start the client from command line this is the output I get-

Code: Select all

Info: Using config path:  /home/pi/crazyflie-pc-client/lib/../conf
Info: sys.path= ['/home/pi/crazyflie-pc-client/lib', '/home/pi/crazyflie-pc-client/lib/../conf', '/home/pi/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!
INFO:cfclient.utils.config:Dist config read from /home/pi/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 [PS3_Mode_2.json]
INFO:cfclient.utils.input:Parsing [Generic_OS_X.json]
DEBUG:cflib.crazyflie:Adding callback on port [5] to [<bound method Log._new_packet_cb of <cflib.crazyflie.log.Log instance at 0x17cfeb8>>]
DEBUG:cflib.crazyflie:Adding callback on port [0] to [<bound method Console.incoming of <cflib.crazyflie.console.Console instance at 0x18b00a8>>]
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/120/1M]
INFO:cflib.crazyflie:We are connected[radio://0/120/1M], 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 0x18b0a80>>]
DEBUG:cflib.crazyflie:ExpectAnswer: Will expect answer on port [5]
Found [Sony PLAYSTATION(R)3 Controller]
Will use [Sony PLAYSTATION(R)3 Controller] for input
WARNING:cflib.crazyflie:Got link error callback [Too many packets lost] in state [1]
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 failed to [radio://0/120/1M]: Too many packets lost
DEBUG:cflib.crazyflie:ExpectAnswer: No answer on [5], do retry
It seems to recognize the PS3 controller but can't establish radio comms for some reason... Any ideas?
I managed to get the GUI running on Linux Ubuntu without a hitch, so the hardware works fine.