Products
-
-
- Accessories
- Breakout boards
This is an old revision of the document!
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.
Note Since version 2015.3 you can setup your own SDCard in one command.
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.
Info All modern Linux distribution now have a kernel driver for the x-box gamepad. Thus it is unlikely the xboxdrv user-space driver is needed.
Lets install everything that we might need fro running the Crazyradio, controllers and the headless client.
sudo apt-get -y install python-usb xboxdrv
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:
sudo touch /etc/udev/rules.d/99-crazyflie.rules sudo 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"
In order for the Xbox 360 wireless controller to work the xboxdrv utility has to be installed and launched when the controller is connected. So add a new udev rule for this.
sudo nano /etc/udev/rules.d/99-xboxdrv.rules
Put the following into the text file:
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:
sudo mkdir /root/bin/ sudo touch /root/bin/cfheadless sudo chmod +x /root/bin/cfheadless sudo 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
sudo touch /root/bin/xbox360 sudo chmod +x /root/bin/xbox360 sudo 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
Go to the pi users home directory and clone the PC client and Crazyradio firmware projects.
cd mkdir projects cd projects git clone https://github.com/bitcraze/crazyflie-clients-python.git
Create the script that will execute when the Crazyradio is inserted. This will launch the cfheadless client.
cd touch start_cfheadless chmod +x start_cfheadless nano start_cfheadless
Insert the following text into the file:
/home/pi/projects/crazyflie-clients-python/bin/cfheadless -u `cat /home/pi/link.conf` -i `cat /home/pi/controller.conf` > /tmp/cfheadless.log 2>&1
Now the last part, the configuration. The script above will launch the cfheadless client with the controller and link configuration that is written in the two files 'controller.conf
' and 'link.conf
'. This configuration is written using the following commands:
echo PS3_Mode_1 > /home/pi/controller.conf echo radio://0/10/250K > /home/pi/link.conf
If you are using another controller configuration or another link, just use the same commands as above but replace it with your own settings.
That's it! Now you can connect the controller, start the Crazyflie and insert the Crazyradio and you are ready to fly.
update_on_pi_release