System configuration - gregd72002/rpicopter GitHub Wiki

Overview:

Steps:

Initial system

You should be able to use any distribution. The smaller the distribution the better. I used cut down version of Raspbian: (http://www.linuxsystems.it/raspbian-wheezy-armhf-raspberry-pi-minimal-image/)

Install it on you SD card and boot RPi.

Now you will need to ensure you have internet access. Check Wifi section below for details.


Wifi

There a plenty of guides on the internet how to get Wifi working on you RPi. Just google it.

The rough guide for rt73 dongles:

  • apt-get install wpasupplicant firmware-realtek
  • edit /etc/network/interfaces

example: interfaces

  • edit /etc/wpa_supplicant/wpa_supplicant.conf

example: wpa_supplicant.conf

Once you complete the installation you should be able to ssh to your rpi over wifi. DONE!


Bluetooth

Install the following packages:

  • bluez
  • bluez-compat
  • dnsmasq
  1. Ensure btusb module is loaded when you plug you bluetooth adapter.
  2. Setup udev so everytime bluetooth is plugged in:
  • puts your bluetooth into discoverable mode
  • start PAN daemon
  • start pairing agent
  1. Setup dnsmasq as DHCPD server for you Bluetooth PAN network
  • Edit dnsmasq.conf: dnsmasq.conf
  • (the only change that was needed was dhcp-range and interface values)
  1. Edit /etc/network/interfaces and define bnep0 interface
  1. Restart your RPi and try to connect to it over bluetooth

UDEV setup

UDEV in here is used to run a script when bluetooth device is plugged in or removed.

Steps:

  1. copy the following into /etc/udev/rules.d/
  1. copy the following scripts into /usr/local/bin/
  1. add the following line to /etc/rc.local
  • /usr/bin/pand --listen --role gn -M -u /usr/local/bin/btnetconnect.sh
  • I was not able to start correctly PAN daemon from udev therefore the workaround

Don't forget to chmod +x all of these scripts!

If you have another computer with bluetooth, try connecting it to the bluetooth network of your RPi. You should be able to ping it. DONE!

Note: my computer was connecting to RPi over bluetooth perfectly fine (bnep0 interface was created), however it was not acquiring ip address correctly. I had to use this UDEV script on my PC to sort it out: bnep0 dhcp.

Also, if you would like your RPi to have access to the internet through your PC (tether), you need the correct entries in the routing table. Add this script to /etc/network/if-up.d/ on you PC and restart it:


NFS

NFS will be used to get access to RPi filesystem from our build machine

Steps:

  1. install nfs-common and nfs-kernel-server

  2. configure /etc/exports and add the following line to export the entire RPi root filesystem:

  • / 10.0.1.0/255.255.255.0(rw,async,all_squash,no_subtree_check,insecure)
  1. restart nfs-kernel-server service on RPi

Now you should be able to mount RPi filesystem from you PC using the following command: sudo mount 10.0.1.1:/ [MOUNT_DIR]

A good idea is to add the mount command to udev rule so it is executed every time bluetooth network is established.


Xenomai

Why? You do not want to get your copter to respond with random delays.

For more see: Xenomai official guide

Compile a new kernel with Xenomai support and install it onto RPi. Ensure that BT and WIFI works.

Run Xenomai examples to ensure this is also working.

Compile Xenomai front end

get ps3 controller (possibly with xenomai) https://github.com/petrockblog/RetroPie-Setup/wiki/Setting-up-a-PS3-controller

add controller https://github.com/vjaunet/QUADCOPTER