Page 1 of 5
Raspberry Pi Troubles
Posted: Sun May 05, 2013 5:06 am
by greggius
I have spent the last couple of days trying to get the crazyflie to work with the Raspberry Pi and I now have it working... sort of. I have the crazyflie and original xbox controller connected and working with the pc client, but once connected the Pi struggles to keep up. I hit thrust on the controller and there is a good couple seconds of lag before the crazyflie responds. This gets worse as time goes by.
Per this post on your blog
http://www.bitcraze.se/2012/11/crazyfli ... pberry-pi/, it looks like you guys have had the crazyflie working successfully with the Pi?
I am running the latest version of Raspbian, and have overclocked the Pi to 1GHz using the raspi-config. Pi is powered by a 1A iphone charger and a Belkin 4 port USB hub connects the crazy radio and keyboard. The crazy radio only works correctly when the USB Hub is not powered (usb hub has its own 1A power supply).
The xbox controller is connected directly to the pi (I had issues connecting it through the usb hub) and I used xboxdrv to use connect it to the pi (
https://github.com/petrockblog/RetroPie ... controller)
There was a warning that i noticed in the console "WARNING cflib.crazyflie:ExpectAnswer: ERROR! Old timer whas running while scheduling new one on [2]" Not sure if this is an issue?
I am thinking that I might have better luck if i try a different usb hub, since the belkin seems a bit problematic. But the main issue seems to be that my Pi just isn't powerful enough. The activity monitor is completely maxed out when the crazyflie is connected. Anybody have any ideas?
On a happier note, I got the crazyflie working with my windows pc in no time and have been flying around without issues. Its very nimble and robust; a fine piece of work!
Re: Raspberry Pi Troubles
Posted: Sun May 05, 2013 8:21 am
by marcus
Hi greggius,
greggius wrote:I have spent the last couple of days trying to get the crazyflie to work with the Raspberry Pi and I now have it working... sort of. I have the crazyflie and original xbox controller connected and working with the pc client, but once connected the Pi struggles to keep up. I hit thrust on the controller and there is a good couple seconds of lag before the crazyflie responds. This gets worse as time goes by.
Per this post on your blog
http://www.bitcraze.se/2012/11/crazyfli ... pberry-pi/, it looks like you guys have had the crazyflie working successfully with the Pi?
For this we used a "headless" version of the client without any UI. Updating the UI with the latest values for logging/joystick is a bit heavy and this is probably where the lag is coming from. I'm not sure of the state for the "headless" client (if it uses the input mappings etc.) but we will check and push what we have into the Bitbucket repository.
greggius wrote:
On a happier note, I got the crazyflie working with my windows pc in no time and have been flying around without issues. Its very nimble and robust; a fine piece of work!
Glad to hear that you like it
Re: Raspberry Pi Troubles
Posted: Sun May 05, 2013 11:17 am
by foosel
marcus wrote:For this we used a "headless" version of the client without any UI. Updating the UI with the latest values for logging/joystick is a bit heavy and this is probably where the lag is coming from. I'm not sure of the state for the "headless" client (if it uses the input mappings etc.) but we will check and push what we have into the Bitbucket repository.
As I was
just wondering yesterday if you'd make this available somewhere: Way to go!
Re: Raspberry Pi Troubles
Posted: Sun May 05, 2013 10:36 pm
by marcus
Ah, I missed that one. I've answered
in that thread.
Re: Raspberry Pi Troubles
Posted: Mon May 06, 2013 1:28 pm
by greggius
I downloaded the dev-headless branch, and I now have everything working!
I just needed to modify a couple of lines in lib/cfheadless.py with my values:
Code: Select all
app = HeadlessClient(sys.argv,link_uri="radio://0/10/250K",
input_config="Xbox1")
and copy in my mapping file : lib/cfclient/configs/input/Xbox1.json
Thanks for all your help marcus!
Re: Raspberry Pi Troubles
Posted: Mon May 06, 2013 9:49 pm
by foosel
Got it working as well, my mobile basestation is a go now
FYI, I created a couple of additional udev rules for automatically starting and killing the client upon insertion of the crazyradio:
/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"
/root/bin/cfheadless
Code: Select all
#!/bin/sh
if test "$ACTION" = "add"
then
/usr/bin/sudo -u pi /home/pi/crazyflie-pc-client/bin/cfheadless > /tmp/cfheadless.log 2>&1 &
echo $! > /tmp/cfheadless.pid
else
killall -9 cfheadless
if test -f /tmp/cfheadless.pid
then
PID=`cat /tmp/cfheadless.pid`
kill -9 $PID
fi
fi
And for the XBox360 Controller (after an "apt-get install xboxdrv"):
/etc/udev/rules.d/99-xbox360.rules
Code: Select all
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0719", RUN+="/root/bin/xbox360"
/root/bin/xbox360
Code: Select all
#!/bin/sh
if test "$ACTION" = "add"
then
/usr/bin/xboxdrv &
else
killall -9 xboxdrv
fi
This way I can just bootup the Pi completely headless (the two USB ports are just enough for Crazyradio and controller). The only caveat is that I have to replug the Crazyradio dongle if the Crazyflie isn't powered up during start of the headless client, otherwise a connection won't be made.
Hope this helps anyone!
Re: Raspberry Pi Troubles
Posted: Tue May 07, 2013 7:49 am
by marcus
Very nice set-up and thanks for detailing the udev rules. We will make sure to add the instructions to the wiki
Re: Raspberry Pi Troubles
Posted: Tue May 07, 2013 12:42 pm
by foosel
Great! Btw, if you want to I'd also be happy to contribute stuff like this directly to the wiki myself (especially since you chose Dokuwiki -- I used to be take part in its development and simply love it
), if you'd tell me what I need to do to get an account on there (you seem to have disabled registration).
Re: Raspberry Pi Troubles
Posted: Tue May 07, 2013 12:47 pm
by skube
Just send them an email asking to register on the wiki. Given them a username too:
http://www.bitcraze.se/about-bitcraze/
Re: Raspberry Pi Troubles
Posted: Wed May 08, 2013 10:11 pm
by foosel
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:
- Raspberry Pi
- Portable USB power supply (Anker3 10000mAh)
- Crazyradio
- XBox360 controller dongle
Attached a small carabiner to it and can now wear my Crazyflie Portable Basestation on my belt
Some more infos and pictures
here