This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
misc:hacks:rasberrypi [2013-05-21 13:49] foosel [Current state of the headless client] |
misc:hacks:rasberrypi [2015-02-20 15:31] macke Page moved from projects:crazyflie:hacks:rasberrypi to misc:hacks:rasberrypi |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Using the Raspberry Pi as a base station for flying ====== | ||
- | You should setup the CF Headless client (see [[# | ||
- | |||
- | For the following installation instructions it is assumed that you are running the popular [[http:// | ||
- | |||
- | ===== Setup the Crazyradio dongle ===== | ||
- | |||
- | In order for the client to be able to access the dongle, you'll have to setup [[projects: | ||
- | |||
- | ===== Install the headless client ===== | ||
- | |||
- | Execute the following commands as your user of choice (for example the default user '' | ||
- | |||
- | cd | ||
- | sudo apt-get install mercurial python2.7 python-usb python-pygame python-qt4 | ||
- | hg clone https:// | ||
- | cd crazyflie-pc-client | ||
- | hg up dev-headless | ||
- | |||
- | This installs the necessary dependencies for running the client, checks out the current development version from BitBucket and then switches to the branch containing the headless client. | ||
- | |||
- | If you are using an XBox Controller w/ Wireless Gaming Receiver, you might need to also install the userspace driver: | ||
- | |||
- | sudo apt-get install xboxdrv | ||
- | | ||
- | and start it: '' | ||
- | |||
- | Plugin your Crazyradio and your controller, power up the Crazyflie and start the client (via SSH and Ethernet or by using an USB hub to connect Crazyradio, controller and keyboard)((If you get an error message that '' | ||
- | |||
- | python ~/ | ||
- | |||
- | The client should start up, hopefully find your Crazyradio dongle, your Crazyflie and your controller and start accepting commands: | ||
- | |||
- | < | ||
- | pi@raspberrypi ~ $ ~/ | ||
- | Info: Using config path: / | ||
- | Info: sys.path= ['/ | ||
- | Disabling standard output for libraries! | ||
- | INFO: | ||
- | INFO: | ||
- | INFO: | ||
- | INFO: | ||
- | INFO: | ||
- | INFO: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | INFO: | ||
- | INFO: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | Found [Xbox Gamepad (userspace driver)] | ||
- | Will use [Xbox Gamepad (userspace driver)] for input | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | WARNING: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | WARNING: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | WARNING: | ||
- | INFO: | ||
- | ERROR: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | INFO: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | INFO: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | INFO: | ||
- | DEBUG: | ||
- | DEBUG: | ||
- | INFO: | ||
- | INFO: | ||
- | </ | ||
- | |||
- | **Note**: If you still have an old version of the headless client you'll need to manually change the URI of your Crazyradio from the default 1M to 250K (make sure the K is uppercase). If you want to use a custom configuration (other than '' | ||
- | |||
- | <code python> | ||
- | app = HeadlessClient(sys.argv, | ||
- | | ||
- | </ | ||
- | |||
- | You can then startup the client without any command line arguments and it should hopefully work as well: '' | ||
- | ===== Current state of the headless client ===== | ||
- | |||
- | [[http:// | ||
- | * Still dependent on QT (the plan is to remove this very soon) | ||
- | * Not much error handling yet (the plan is to improve this) | ||
- | * < | ||
- | * The headless client will open the first input-device found (so don't plug more than one) | ||
- | * No good way to quit it yet so you will have to kill the process | ||
- | ===== Make the client startup automatically on Crazyradio plug in ===== | ||
- | |||
- | Starting (and killing) the client automatically upon Crazyradio insertion/ | ||
- | |||
- | Adjust your Crazyradio udev rule (e.g. ''/ | ||
- | |||
- | < | ||
- | SUBSYSTEM==" | ||
- | </ | ||
- | |||
- | and (as root) create a file ''/ | ||
- | |||
- | <code bash> | ||
- | #!/bin/sh | ||
- | if test " | ||
- | then | ||
- | / | ||
- | echo $! > / | ||
- | else | ||
- | killall -9 cfheadless | ||
- | if test -f / | ||
- | then | ||
- | PID=`cat / | ||
- | kill -9 $PID | ||
- | fi | ||
- | fi | ||
- | </ | ||
- | |||
- | Don't forget to make it executable: '' | ||
- | |||
- | And for the XBox360 Controller (after an " | ||
- | |||
- | Create a udev file ''/ | ||
- | <code bash> | ||
- | |||
- | and (as root) create a file ''/ | ||
- | <code bash># | ||
- | if test " | ||
- | then | ||
- | / | ||
- | else | ||
- | killall -9 xboxdrv | ||
- | fi</ | ||
- | |||
- | :!: **Important** :!: Due to the current state of the client, you **must** make sure to first connect your controller and power up the Crazyflie before connecting the Crazyradio dongle and thus starting the client. If the client can't find either controller or Crazyflie, it will just hang and you'll have to re-plug the dongle again. | ||
- | |||
- | **Troubleshooting** If it still doesn' | ||
- | * / | ||
- | * / | ||
- | ===== Make your base station portable ===== | ||
- | |||
- | If you want to you can make your base station completely portable simply by using a portable USB power supply (e.g. the Anker3 10.000mAh) for powering the Pi. Putting everything into some case and attaching it somewhere on yourself (e.g. your belt) makes you completely mobile while piloting your Crazyflie :-) | ||
- | |||
- | {{https:// | ||
- | {{https:// |