Installation/RaspberryPi

From PaparazziUAV
Revision as of 18:32, 18 November 2012 by Scdwyer (talk | contribs) (Initial notes about how to run ground-side paparazzi software on Raspberry Pi)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

THIS PAGE IS STILL IN PROGRESS, IF YOU CAN ADD TO IT, PLEASE DO

Introduction

The Raspberry Pi is a small ARM-based computing platform. It is low power, lightweight and very inexpensive, and runs Linux. This makes it an attractive platform for advanced autonomy or payload functionality onboard a UAV, or as part of a compact portable ground control station.

This page is a compilation of information related to running Paparazzi related items on the Raspberry Pi. For Raspberry Pi information, see the website.

First steps are to get the hardware and set it up. For these tests, a Raspberry Pi Model B with 512MB of RAM was used. The only connections were a micro USB power supply and ethernet to a local network that was internet connected through a router. Work was done over SSH.

Raspbian “wheezy”

So far this attempt has failed.

The recommended Raspbian "wheezy" distribution was used initially. However, this did not work out (yet). The native ocamlopt compiler is not available by default, and trying to compile things from scratch led to dependency hell with package management, etc.

However, there is still promise in using Ocaml 4, and spending some more time on this.

Soft-float Debian “wheezy”

This attempt so far has proven fruitful. The soft-float version does not have hardware floating point support, and thus is slower. However, it tends to be more compatible.

So far, only the paparazzi-dev dependencies have been installed, and this means no airborne code for autopilots can be built. In addition, a number of extras for calibration, etc. have not yet been installed, so difficulty might be encountered in calibration scripts, etc. However, the goal so far is to run ground side programs such as server, messages, gcs, etc. This allows allows fast prototyping of additional autonomy features using the Ivy bus to make easy communication between programs on the RPi and the autopilot. It also allows for telemetry over wifi or a network, etc. Lots of room for exploration.

The following are rough notes on how to install. It could definitely be improved, but hopefully provides a decent starting point.

  • First install the OS as per the Raspberry Pi wiki here
  • Then boot it up and ssh in over your local network
  • Then run: $ sudo raspi-config and change the timezone, password and expand root partition to fill sd card, and anything else. Exit and reboot.
  • $ sudo apt-get update
  • $ sudo apt-get upgrade
  • $ sudo apt-get install vim or your other favourite editor
  • Install all the paparazzi-dev dependencies in one shot:
  • $ sudo apt-get install bzip2 git-core make gcc g++ gnuplot glade imagemagick libpcre3-dev libusb-dev python-usb python-lxml python-wxgtk2.8 speech-dispatcher libgnomecanvas2-dev ocaml libocamlnet-ocaml-dev libxml-light-ocaml-dev liblablgtk2-ocaml-dev liblablgtk2-gnome-ocaml-dev libsdl-ocaml-dev

Ivy-C

Now we want to build and install ivy-c:

  • $ sudo apt-get install subversion tcl8.4-dev dh-ocaml (need tcl8.4-dev to build ivy-c, need dh-ocaml to build ivy-ocaml)
  • Setup git as per paparazzi wiki and add ssh key to github (name and email)
  • Clone the paparazzi-portability-support repo
  • $ git clone -o desired_upstream_name git@github.com:your_username/paparazzi-portability-support.git
  • $ cd paparazzi-portability-support/
  • $ cd linux/ivy/ivy-c
  • $ fakeroot debian/rules get-orig-source
  • $ tar -xvzf ivy-c_3.12.1.orig.tar.gz
  • $ cd ivy-c-3.12.1/
  • $ rm -rf debian/
  • $ cp -r ../debian .
  • $ dpkg-buildpackage -rfakeroot -us -uc
  • Now we can install ivy-c:
  • $ cd ..
  • $ sudo dpkg -i ivy-c_3.12.1-1_armel.deb ivy-c-dev_3.12.1-1_armel.deb
  • Horray, now it is installed!

Ivy-ocaml

Now to build and install ivy-ocaml:

  • $ cd ~/paparazzi-portability-support/linux/ivy/ivy-ocaml
  • $ fakeroot debian/rules get-orig-source
  • $ cd ivy-ocaml-1.1/
  • $ cp debian/changelog.3.11.2 debian/changelog
  • $ dpkg-buildpackage -rfakeroot -us -uc
  • $ sudo dpkg -i ivy-ocaml_1.1-12_armel.deb
  • Horray! Should now be installed.

Ocamlgsl

Next, we should install libocamlgsl-ocaml-dev, but this doesn't work. This library won't build at all because of the following (from the README): "Architectures with double-word alignment for doubles are not supported"

However, this isn't a major problem, because this lib is currently not used for anything at all in Paparazzi (was going to be used for some yet unfinished features).

Ivy-python

Now to build and install ivy-python:

Building Paparazzi

  • Get the paparazzi source as per usual, using your desired method/setup. Easiest is:
  • $ git clone https://github.com/paparazzi/paparazzi.git
  • Now change to the paparazzi directory
  • $ cd paparazzi
  • Set the PAPARAZZI_HOME and PAPARAZZI_SRC environment vars
  • Before building, the multimon (i.e. audio telemetry link) support must be prevented from building, because it won't:
    • Comment out target line in Makefile (line 114)
    • Comment out audio support in sw/ground_segment/tmtc/link.ml (lines 477, 478, 491-496)
    • Now go to sw/ground_segment/tmtc/Makefile and delete dia and diadec targets from all: target, then delete references to the multimon libs
  • Build Paparazzi:
  • $ make
  • The lpc stuff at the end doesn't build, but everything else seems ok? This is not necessary for ground-side software anyways.

Trying it out

Rebooting is not a bad idea. There were some issues with GTK initialization, but they are intermittent, and ever since a reboot they seem to be better.

Initial Test

First test can be to run paparazzi center or messages with X11 forwarding. Start the ssh connection to the RPi using the -x option. Make sure ssh forwarding is enabled in the sshd config on the RPi. Google for instructions. Then:

  • $ cd ~/paparazzi
  • $ ./paparazzi or $ ./sw/ground_segment/tmtc/messages
  • After some waiting, you should see a window pop up on your local machine either with paparazzi center, or with an empty messages window (i.e. just the frame as small as possible)

Remote GCS/Messages

Next, one can try simulating on the local machine, and pushing the ivy bus messages across the local network and reading them with the programs on the RPi.

  • Build and test an airframe you wish to simulate as usual on the local machine, and test it quickly by simulating
  • Stop all the agents, and add the following option to the call: -b <local network broadcast ip> (for example 192.168.0.255)
  • Before running programs on the RPi, it needs to know about the freshly compiled airframe. So, copy the conf/conf.xml file from the local machine to the RPi, and also the whole var/ folder intact, AFTER having compiled for simulation
  • Restart the agents on the local machine with the ivy bus option, everything should be working as before
  • Now start messages on the RPi as described above, but set the bus to the same IP as the local machine (you can also try out the GCS by running $ sw/ground_segment/cockpit/gcs -b <local network broadcast ip>)