Raspberry Pi Troubles

Post here to get support
greggius
Beginner
Posts: 4
Joined: Sun May 05, 2013 3:10 am
Location: Australia

Raspberry Pi Troubles

Post by greggius » Sun May 05, 2013 5:06 am

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!



marcus
Bitcraze
Posts: 599
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Raspberry Pi Troubles

Post by marcus » Sun May 05, 2013 8:21 am

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 :D

foosel
Expert
Posts: 175
Joined: Sat Feb 02, 2013 9:59 pm
Location: Obertshausen, Germany
Contact:

Re: Raspberry Pi Troubles

Post by foosel » Sun May 05, 2013 11:17 am

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! :)
Image
Also: AR.Drone 2.0 (RC-enabled thanks to self-soldered MiruMod) and Hubsan X4 H107

marcus
Bitcraze
Posts: 599
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Raspberry Pi Troubles

Post by marcus » Sun May 05, 2013 10:36 pm

Ah, I missed that one. I've answered in that thread.

greggius
Beginner
Posts: 4
Joined: Sun May 05, 2013 3:10 am
Location: Australia

Re: Raspberry Pi Troubles

Post by greggius » Mon May 06, 2013 1:28 pm

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!

foosel
Expert
Posts: 175
Joined: Sat Feb 02, 2013 9:59 pm
Location: Obertshausen, Germany
Contact:

Re: Raspberry Pi Troubles

Post by foosel » Mon May 06, 2013 9:49 pm

Got it working as well, my mobile basestation is a go now :D

Image

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! :)
Image
Also: AR.Drone 2.0 (RC-enabled thanks to self-soldered MiruMod) and Hubsan X4 H107

marcus
Bitcraze
Posts: 599
Joined: Mon Jan 28, 2013 7:02 pm
Location: Sweden
Contact:

Re: Raspberry Pi Troubles

Post by marcus » Tue May 07, 2013 7:49 am

Very nice set-up and thanks for detailing the udev rules. We will make sure to add the instructions to the wiki :D

foosel
Expert
Posts: 175
Joined: Sat Feb 02, 2013 9:59 pm
Location: Obertshausen, Germany
Contact:

Re: Raspberry Pi Troubles

Post by foosel » Tue May 07, 2013 12:42 pm

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 :D), if you'd tell me what I need to do to get an account on there (you seem to have disabled registration).
Image
Also: AR.Drone 2.0 (RC-enabled thanks to self-soldered MiruMod) and Hubsan X4 H107

skube
Member
Posts: 55
Joined: Fri May 03, 2013 2:41 pm
Location: Toronto, Canada

Re: Raspberry Pi Troubles

Post by skube » Tue May 07, 2013 12:47 pm

Just send them an email asking to register on the wiki. Given them a username too: http://www.bitcraze.se/about-bitcraze/
Crazyflie Nano 10-DOF | AR Drone v1 | MikroKopter Okto

foosel
Expert
Posts: 175
Joined: Sat Feb 02, 2013 9:59 pm
Location: Obertshausen, Germany
Contact:

Re: Raspberry Pi Troubles

Post by foosel » Wed May 08, 2013 10:11 pm

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
Image
Also: AR.Drone 2.0 (RC-enabled thanks to self-soldered MiruMod) and Hubsan X4 H107

Post Reply