├── LICENSE.txt ├── README.md └── bitcraze_raspberrypi.sh /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2015 Bitcraze AB 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bitcraze pre-installed Raspian SD-card image 2 | 3 | **This repo is not currently being maintained** 4 | 5 | This project is for Bitcraze pre-installed Raspian SD-card image but doesn't contain any code or image, it's used for tracking issues and improvements. 6 | 7 | The SD-card image is based on the Wheezy version of Raspian for the Raspberry Pi. Nothing it removed from the image so you can use it for anything that you could use the origional image for. We have just added our stuff on top of it. 8 | 9 | There's a list of what's included: 10 | 11 | * UDEV rules for access to the Crazyradio and NRF bootloader 12 | 13 | * crazyflie-clients-python and crazyradio-firmware pre-cloned 14 | 15 | * pyusb 16 | 17 | * UDEV rules to automatically launch the cfheadless client when Crazyradio is plugged in 18 | 19 | * Driver for the Xbox 360 wireless controller and automatic start of the utilities 20 | 21 | * Git 22 | 23 | For more info see our [wiki](http://wiki.bitcraze.se/projects:crazyflie:binaries:raspberrypi "Bitcraze Wiki") and [hacks page](http://wiki.bitcraze.se/projects:crazyflie:hacks:rasberrypi "Raspberry hack page"). 24 | 25 | The image is generated from the raspberrypi.org release of Rasbian and by running bitctaze_raspberrypi.sh as pi user. 26 | 27 | Downloading 28 | ----------- 29 | The Bitcraze VM can either be downloaded via torrent or via direct download: 30 | 31 | * Bitcraze Raspian image 0.3 [torrent](http://files.bitcraze.se/dl/cfpi-0_3.7z.torrent "Torrent") (prefered) 32 | * Bitcraze Raspian image 0.3 [direct download](http://files.bitcraze.se/dl/cfpi-0_3.7z "Direct download") 33 | 34 | How do I use it? 35 | ---------------- 36 | First of all you need to set up what controller and link settings you are using. This is done by editing the two files in the folder /home/pi named controller.conf and link.conf. They should only contain one row each. 37 | 38 | To fly first insert the USB controller, then power on the Crazyflie and lastly insert the Crazyradio. This will start the cfheadless client and connect to the Crazyflie. In a few seconds you sould be ready to fly. 39 | 40 | To quick either power off the Crazyflie or pull-out the Crazyradio. 41 | 42 | In order to restart flying you have to pull-out the Crazyradio dongle and insert it again. 43 | 44 | Flashing the Crazyradio 45 | ----------------------- 46 | The Crazyradio firmware can be updated using the Raspberry Pi and doing the following steps: 47 | * Connect the Raspberry Pi to your local network 48 | * Power it on and SSH to it (user=raspberry and password=pi) 49 | * Make sure that no controller is connected 50 | * Insert the Crazyradio into a USB port on the Raspberry Pi 51 | * Go into the crazyradio-firmware directory and download a firmware update 52 | ``` 53 | cd projects/crazyradio-firmware 54 | wget https://bitbucket.org/bitcraze/crazyradio-firmware/downloads/cradio-0.52.bin 55 | ``` 56 | * Launch the Crazyradio bootloader and flash the firmware 57 | ``` 58 | python usbtools/launchBootloader.py 59 | python usbtools/nrfbootload.py flash cradio-0.52.bin 60 | ``` 61 | * Make sure that the flashing is successful, otherwise retry again! 62 | * Unplug the Crazyradio and re-insert it again. It's now running the new firmware. 63 | 64 | Flashing the Crazyflie 1 65 | ------------------------ 66 | The Crazyflie firmware can be updated using the Raspberry Pi and doing the following steps: 67 | * Connect the Raspberry Pi to your local network 68 | * Power it on and SSH to it (user=pi and password=raspberry) 69 | * Make sure that no controller is connected 70 | * Insert the Crazyradio into a USB port on the Raspberry Pi 71 | * Go into the crazyflie-clients-python directory and download a firmware update 72 | ``` 73 | cd projects/crazyflie-clients-python 74 | wget https://bitbucket.org/bitcraze/crazyflie-firmware/downloads/Crazyflie_2014.01.0.bin 75 | ``` 76 | * Power off the Crazyflie and launch the bootloader 77 | ``` 78 | bin/cfloader flash Crazyflie_2014.01.0.bin 79 | ``` 80 | * Power on the Crazyflie within 10s and wait while the firmware is flashing 81 | * The Crazyflie will automatically resetart and run the new firmware once the flashing is done 82 | 83 | Troubleshooting 84 | --------------- 85 | Try to pull-out and insert the Crazyradio. Then wait up to 10 seconds before you try to control the Crazyflie. 86 | 87 | If you see the LED on the Crazyradio blinking green, then it's connected. If it's blinking red it means that it cannot connect to the Crazyflie. 88 | 89 | Check logfile /tmp/cfheadless.log for messages 90 | 91 | Logging in 92 | ---------- 93 | There's a new user created that can be used to log in: 94 | ``` 95 | User: pi 96 | Pass: raspberry 97 | ``` 98 | 99 | ## Contribute 100 | 101 | Go to the [contribute page](https://www.bitcraze.io/contribute/) on our website to learn more. 102 | -------------------------------------------------------------------------------- /bitcraze_raspberrypi.sh: -------------------------------------------------------------------------------- 1 | set -x 2 | 3 | CLIENT_VERSION=2014.12.3 4 | 5 | #install required packages 6 | sudo apt-get update 7 | sudo apt-get -y install python-usb xboxdrv 8 | 9 | #clone projects 10 | cd 11 | mkdir -p projects 12 | cd projects 13 | git clone https://github.com/bitcraze/crazyflie-clients-python 14 | cd crazyflie-clients-python 15 | git checkout $CLIENT_VERSION 16 | 17 | #Create udev files 18 | cat > 99-crazyflie.rules << __EOF__ 19 | SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="7777", MODE=="0664", GROUP="plugdev", RUN+="/root/bin/cfheadless" 20 | SUBSYSTEM=="usb", ATTRS{idVendor}=="1915", ATTRS{idProduct}=="0101", MODE=="0664", GROUP="plugdev" 21 | __EOF__ 22 | sudo mv 99-crazyflie.rules /etc/udev/rules.d/99-crazyflie.rules 23 | 24 | cat > 99-xboxdrv.rules << __EOF__ 25 | SUBSYSTEM=="usb", ATTRS{idVendor}=="045e", ATTRS{idProduct}=="0719", GROUP="plugdev", RUN+="/root/bin/xbox360" 26 | __EOF__ 27 | sudo mv 99-xboxdrv.rules /etc/udev/rules.d/99-xboxdrv.rules 28 | 29 | #Create launch scripts 30 | cd 31 | sudo mkdir -p /root/bin 32 | cat > cfheadless << __EOF__ 33 | #!/bin/sh 34 | if test "\$ACTION" = "add" 35 | then 36 | /usr/bin/sudo -u pi /home/pi/start_cfheadless & 37 | echo \$! > /tmp/cfheadless.pid 38 | else 39 | killall -9 cfheadless 40 | if test -f /tmp/cfheadless.pid 41 | then 42 | PID=\$(cat /tmp/cfheadless.pid) 43 | kill -9 \$PID 44 | fi 45 | fi 46 | __EOF__ 47 | sudo mv cfheadless /root/bin/cfheadless 48 | sudo chmod +x /root/bin/cfheadless 49 | 50 | cat > xbox360 << __EOF__ 51 | #!/bin/sh 52 | if test "\$ACTION" = "add" 53 | then 54 | /usr/bin/xboxdrv & 55 | else 56 | killall -9 xboxdrv 57 | fi 58 | __EOF__ 59 | sudo mv xbox360 /root/bin/xbox360 60 | sudo chmod +x /root/bin/xbox360 61 | 62 | cat > start_cfheadless << __EOF__ 63 | /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 64 | __EOF__ 65 | chmod +x start_cfheadless 66 | 67 | #Create default configuration 68 | echo PS3_Mode_1 > /home/pi/controller.conf 69 | echo radio://0/10/250K > /home/pi/link.conf 70 | --------------------------------------------------------------------------------