Difference between revisions of "Installation/RaspberryPi"
(just changed the look a bit to the boxes from just <tt>)
|Line 94:||Line 94:|
* Now we can install ivy-c:
* Now we can install ivy-c:
$ cd ..
$ cd ..
$ sudo dpkg -i ivy-c_3.12.1-
$ sudo dpkg -i ivy-c_3.12.1-.deb ivy-c-dev_3.12.1-.deb
* Horray, now it is installed!
* Horray, now it is installed!
Revision as of 19:06, 9 January 2013
THIS PAGE IS STILL IN PROGRESS, IF YOU CAN ADD TO IT, PLEASE DO
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.
To run OCaml on the hardfloat Raspbian you need to build some libs from source. This is a bit more work than then soft-float version, but should run faster.
First install some dependencies:
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 m4
Once you have Raspbian installed, the byte-code ocamlc compiler will work, but the ocamlopt native code compiler doesnt work out of the box. This is due to differences in the ARMv6 and ARMv7 instruction sets.
Since we need ocamlopt: install Ocaml 4 from Raspberry Caml by adding to your /etc/apt/sources.list:
deb http://www.cl.cam.ac.uk/~lpw25/ocaml-rpi/ wheezy main deb-src http://www.cl.cam.ac.uk/~lpw25/ocaml-rpi/ wheezy main
Then update the repos and install it:
sudo apt-get update sudo apt-get install ocaml
The OPAM (OCaml Package Manager) is used to build some other ocaml libs for OCaml 4.0.
git clone https://github.com/OCamlPro/opam.git cd opam ./configure && make sudo make install
opam init eval `opam config env`
Update your shell environment as per opam init's instructions. E.g. add to your ~/.profile:
eval `opam config env`
Install some dependencies to build lablgtk for ocaml:
sudo apt-get install libglade2-dev libgnomeui-dev libgnomecanvas2-dev librsvg2-dev libgtkspell-dev libcanberra-gtk-dev
Build and install needed OCaml libs for 4.0:
opam install ocamlfind xml-light pcre-ocaml opam install -v lablgtk opam install -v ocamlnet
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
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).
Install some libs (need libxt-dev and tcl8.4-dev to build ivy-c, need dh-ocaml to build ivy-ocaml):
$ sudo apt-get install subversion libxt-dev tcl8.4-dev dh-ocaml
Clone the paparazzi-portability-support repo:
Now we want to build and install ivy-c:
$ cd ~/paparazzi-portability-support/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_arm**.deb ivy-c-dev_3.12.1-1_arm**.deb
- Here, ** is either hf for the hard-float raspian or el for the soft-float version
- Horray, now it is installed!
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/ $ rm -rf debian/ $ cp -r ../debian . $ dpkg-buildpackage -rfakeroot -us -uc $ sudo dpkg -i ivy-ocaml_1.1-12_armel.deb
- Horray! Should now be installed.
Now to build and install ivy-python:
$ cd ~/paparazzi-portability-support/linux/ivy/ivy-python $ uscan $ dpkg-buildpackage -rfakeroot -us -uc $ sudo dpkg -i ivy-python_2.2-3~ppa1_all.deb
- Horray should be working now.
- Get the paparazzi source as per usual, using your desired method/setup as described in git, e.g.:
$ 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
$ git checkout master
- Build Paparazzi:
$ make ground_segment
If (and only if) you are NOT on the master development branch (but e.g. on a stable release < 4.9), 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.
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)
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>)