User Tools

Site Tools


misc:hacks:rasberrypi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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 [2013-06-09 23:31]
absoloodle37 Clarified how to create the cfheadless and xbox360 executable files in the /root/bin folder
Line 81: Line 81:
 INFO:cflib.crazyflie:Param TOC finished updating INFO:cflib.crazyflie:Param TOC finished updating
 INFO:cflib.crazyflie:Callback->Connection setup finished [radio://0/10/250K] INFO:cflib.crazyflie:Callback->Connection setup finished [radio://0/10/250K]
 +</code>
 +
 +**Note**: If you have more than one controller attached, you can select the one to use using the commandline parameter ''-c''. See ''cfheadless -h'' for available command line options:
 +
 +<code>
 +usage: cfheadless [-h] [-u URI] [-i INPUT] [-d] [-c CONTROLLER]
 +                  [--controllers]
 +
 +optional arguments:
 +  -h, --help            show this help message and exit
 +  -u URI, --uri URI     URI to use for connection to the Crazyradio dongle,
 +                        defaults to radio://0/10/250K
 +  -i INPUT, --input INPUT
 +                        Input mapping to use for the controller, defaults to
 +                        PS3_Mode_1
 +  -d, --debug           Enable debug output
 +  -c CONTROLLER, --controller CONTROLLER
 +                        Use controller with specified id, id defaults to 0
 +  --controllers         Only display available controllers and exit
 </code> </code>
  
Line 97: Line 116:
   * Not much error handling yet (the plan is to improve this)   * Not much error handling yet (the plan is to improve this)
   * <del>Values are still hardcoded in the script (like mapping and URI for Crazyflie). They can be changed at the bottom in lib/cfheadless.py</del> -> **Update** [[https://bitbucket.org/bitcraze/crazyflie-pc-client/pull-request/7/command-line-options-for-radio-uri/diff|A pull request]] adding some command line options for setting the input mapping and radio URI to use has been accepted, update your client to use that.   * <del>Values are still hardcoded in the script (like mapping and URI for Crazyflie). They can be changed at the bottom in lib/cfheadless.py</del> -> **Update** [[https://bitbucket.org/bitcraze/crazyflie-pc-client/pull-request/7/command-line-options-for-radio-uri/diff|A pull request]] adding some command line options for setting the input mapping and radio URI to use has been accepted, update your client to use that.
-  * The headless client will open the first input-device found (so don't plug more than one)+  * <del>The headless client will open the first input-device found (so don't plug more than one)</del> -> **Update** [[https://bitbucket.org/bitcraze/crazyflie-pc-client/pull-request/7/command-line-options-for-radio-uri/diff|A pull request]] adding some command line option for selecting the used input device has been accepted, update your client to use that.
   * No good way to quit it yet so you will have to kill the process   * No good way to quit it yet so you will have to kill the process
 ===== Make the client startup automatically on Crazyradio plug in ===== ===== Make the client startup automatically on Crazyradio plug in =====
Line 115: Line 134:
 if test "$ACTION" = "add" if test "$ACTION" = "add"
 then then
-        /usr/bin/sudo -u pi /home/pi/crazyflie-pc-client/bin/cfheadless -u radio://0/10/250K -i <your input config> > /tmp/cfheadless.log 2>&1 &+        /usr/bin/sudo -u pi /home/pi/crazyflie-pc-client/bin/cfheadless -u radio://0/10/250K -i <your input config without the .json extension> > /tmp/cfheadless.log 2>&1 &
         echo $! > /tmp/cfheadless.pid         echo $! > /tmp/cfheadless.pid
 else else
Line 127: Line 146:
 </code> </code>
  
-Don't forget to make it executable: ''chmod +x /root/bin/cfheadless''. This should now take care to startup the headless client when you plug in the dongle and (hopefully ;-)) kill it again when you unplug. If you need any additional setup to get your controller working, you can add a similar udev-rule for that to take care of everything upon plugging in the controller as well. An example for the Microsoft Wireless XBox360 controller for PC can be found [[http://forum.bitcraze.se/viewtopic.php?p=490#p490|in this forums post]] or as detailed below.+You can only create the cfheadless file above in the /root/bin/ folder by being root--not pi or any other user name.  Switch to root by typing: sudo -i and then navigating to the /root/bin/ folder: cd /root/bin/ Create the cfheadless file by typing: touch cfheadless to create the file.  Then nano cfheadless to edit the file with the code above (sudo prefix not needed because you're already root).  Use the same method for the xbox360 file, if using a xbox360 controller.  Don't forget to make your files executable: ''chmod +x /root/bin/cfheadless'' and ''chmod +x /root/bin/xbox360''. Once you've created the cfheadless (and xbox360 file, if needed), exit the root mode by typing Ctl + D This should now take care to startup the headless client when you plug in the dongle and (hopefully ;-)) kill it again when you unplug. If you need any additional setup to get your controller working, you can add a similar udev-rule for that to take care of everything upon plugging in the controller as well. An example for the Microsoft Wireless XBox360 controller for PC can be found [[http://forum.bitcraze.se/viewtopic.php?p=490#p490|in this forums post]] or as detailed below.
  
 And for the XBox360 Controller (after an "apt-get install xboxdrv"): And for the XBox360 Controller (after an "apt-get install xboxdrv"):
misc/hacks/rasberrypi.txt · Last modified: 2021-06-24 16:45 by kimberly