Products
-
-
- Accessories
- Breakout boards
This is an old revision of the document!
In order to make it easy for users that have a Raspberry Pi to test out our headless client we prepared an SD-card image that is ready to use out of the box. The image is based on the Raspbian distribution, more specifically the Wheezey version that can be downloaded from this torrent.
We haven't removed anything from the image, just added our own stuff. So you can still log in and used the Raspberry Pi as you would with the Raspbian Wheezy image, but as an added feature you can also use our stuff.
Here's a step by step guide to what we added. So if you don't want to use our image, you can get another one and set it up yourself. Most of this stuff is based of the contributed instructions from the hacks section.
Before you get started with this you need a few things:
First of all you have to write the image to the SD-card. There are good instructions on how to do this here.
Now plug the SD-card into the Pi, attach all the cables and SSH to it. Log in user the username pi and the password raspberry and accept the fingerprint.
Most of these commands require root user, so switch to root:
sudo su
Let's create a user named bitcraze with the password crazyflie and add it to all the user groups.
useradd bitcraze -m -p crazyflie -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,netdev,input
Now install everything that we might need fro running the Crazyradio, controllers and the headless client.
apt-get -y install mercurial python2.7 python-usb python-pygame xboxdrv
The shebang in the cfheadless client uses /usr/bin/pyton2 which isn't available in the original image so create a symbolic link for it.
cd /usr/bin ln -s python2.7 python2
In order to be able to use the Raspberry Pi without having any keyboard/screen let's add a udev rule that starts up the client when the Crazyflie is inserted and kills it when it's removed. We should also have a rule that allows us to use the Crazyradio bootloader with out being root. Create the file and edit it:
touch /etc/udev/rules.d/99-crazyflie.rules nano /etc/udev/rules.d/99-crazyflie.rules
Put the following text in the file:
SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="7777", MODE=="0664", GROUP="plugdev", RUN+="/root/bin/cfheadless" SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="0101", MODE=="0664", GROUP="plugdev"
touch /etc/udev/rules.d/99-xboxdrv.rules nano /etc/udev/rules.d/99-xboxdrv.rules
Add xbox:
SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0719", GROUP="plugdev", RUN+="/root/bin/xbox360"
Now we should create the file used to launch/kill the cfheadless client. Create the file and edit it:
mkdir /root/bin/ touch /root/bin/cfheadless chmod +x /root/bin/cfheadless nano /root/bin/cfheadless
And add the following text:
#!/bin/sh if test "$ACTION" = "add" then /usr/bin/sudo -u bitcraze /home/bitcraze/start_cfheadless & 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
touch /root/bin/xbox360 chmod +x /root/bin/xbox360 nano /root/bin/xbox360
Also create the script to start/stop the xboxdrv for the wireless xbox360 controller.
#!/bin/sh if test "$ACTION" = "add" then /usr/bin/xboxdrv & else killall -9 xboxdrv fi
…..
Now switch to the newly created bitcraze user by first exiting switching back to the pi user and then bitcraze:
exit sudo su bitcraze
cd mkdir projects cd projects hg clone https://bitbucket.org/bitcraze/crazyflie-pc-client hg clone https://bitbucket.org/bitcraze/crazyradio-firmware
echo PS3_Mode_1 > /home/bitcraze/controller.conf echo radio://0/10/250K > /home/bitcraze/link.conf
touch start_cfheadless chmod +x start_cfheadless nano start_cfheadless
/home/bitcraze/projects/crazyflie-pc-client/bin/cfheadless -u `cat /home/bitcraze/link.conf` -i `cat /home/bitcraze/controller.conf` > /tmp/cfheadless.log 2>&1