Difference between revisions of "Installation/Linux"

From PaparazziUAV
Jump to navigation Jump to search
Line 34: Line 34:
=== Using Synaptic Package Manager ===
=== Using Synaptic Package Manager ===
* Launch ''Synaptic Package Manager'' (Menu '''System/Administration''')
* Launch ''Synaptic Package Manager'' (Menu '''System/Administration''')
* In '''Settings/Repositories''', add a new repository (Software Source) in the tab '''Other Software''':<br>APT line: <tt>deb <nowiki>http://paparazzi.enac.fr/ubuntu</nowiki> natty main</tt><br>This APT line works for Ubuntu Maverick/10.10. For other Ubuntu versions adapt as described below in the command line section.
* In '''Settings/Repositories''', add a new repository (Software Source) in the tab '''Other Software''':<br>APT line: <tt>deb <nowiki>http://paparazzi.enac.fr/ubuntu</nowiki> natty main</tt><br>This APT line works for Ubuntu Maverick/11.4. For other Ubuntu versions adapt as described below in the command line section.
* Search for <tt>paparazzi-dev</tt>, <tt>paparazzi-arm7</tt> and <tt>paparazzi-stm32</tt> packages (use the ''Search'' button)
* Search for <tt>paparazzi-dev</tt>, <tt>paparazzi-arm7</tt> and <tt>paparazzi-stm32</tt> packages (use the ''Search'' button)
* Mark them for installation (right-click on package names)
* Mark them for installation (right-click on package names)

Revision as of 05:51, 23 July 2011

Introduction

Paparazzi is very easily installed on any laptop or workstation running the Ubuntu Linux OS or virtually any Debian based Linux or even Apple Macintosh running Mac OS X.

At a high-level here are the steps required to install Paparazzi:

  • Install a current Ubuntu Linux distribution.
  • The Paparazzi packages are installed using Synaptic Package Manager.
  • Download the sources from the git repository.
  • Allow access to the ports by copying the rules file: (export PAPARAZZI_HOME=~/paparazzi; export PAPARAZZI_SRC=~/paparazzi; sudo cp $PAPARAZZI_HOME/conf/system/udev/rules/10-paparazzi.rules /etc/udev/rules.d/)
  • Compile the binaries from the sources (cd paparazzi && make)

That's all.

Operating System

Paparazzi is very easily installed on any laptop or workstation running the Ubuntu Linux OS or virtually any Debian based Linux. Paparazzi is packaged for Debian as well as all of its dependencies. The repository hosted at ENAC holds their latest version.

It is also possible to have your Debian/Ubuntu running in a virtual machine, for instance with VirtualBox. This requires minimal changes to your computer setup, as you can run the VM from all common platforms (Windows, OS X, Linux). The virtual machine image can easily be transferred between different laptops, giving greater flexibility. Unfortunately, the Open-Source Edition of VirtualBox doesn't include the necessary USB support, so you'll need to get the regular version from the website.

If you are new and this is your first time installing it is suggested you keep it simple. Select a system you can dedicate to the Linux installation. No VMs or dual boot configurations. The idea is do a very simple generic installation that is certain to have no issues. This reassures you that the installation process works and you can see and use a working Paparazzi install for some time before you try a more complicated install. The install is well documented below and certain to succeed if followed exactly. Most issues arise when someone unfamiliar with Linux tries a non-standard install that requires special steps not documented here.

Compilers and Handlers

The typical installation contains all of the necessary C and OCaml compilers as well as some XML and Ivy handlers. These tools are provided by the paparazzi-dev package. Have no fear, this is all taken care of for you so all you must do is type a few simple commands. Below are those commands and helpful information. Commands can be copied and pasted from these pages to make it as easy as possible.

Source Code

The Paparazzi source code is hosted by Github. It is downloaded using git.

Installation of Compilers and Handlers

Using Synaptic Package Manager

  • Launch Synaptic Package Manager (Menu System/Administration)
  • In Settings/Repositories, add a new repository (Software Source) in the tab Other Software:
    APT line: deb http://paparazzi.enac.fr/ubuntu natty main
    This APT line works for Ubuntu Maverick/11.4. For other Ubuntu versions adapt as described below in the command line section.
  • Search for paparazzi-dev, paparazzi-arm7 and paparazzi-stm32 packages (use the Search button)
  • Mark them for installation (right-click on package names)
  • Left-click on Apply

From the Command Line

If the Synaptic Package Manager doesn't work for you, you can alternatively use the command line:

For the sources file (sources.list) you only add the line required for your version. Linux names their versions.

Just add the following lines to your repository list (/etc/apt/sources.list) and then uncomment the line relevant to your operating system (e.g. one of etch, gutsy or hardy):

Note: Because of the sources.list file permissions maybe you will need to edit it with root access. In Terminal write this:

gksudo gedit /etc/apt/sources.list


File: /etc/apt/sources.list
# Uncomment just _one_ of the following lines - depending on your OS version
# deb http://paparazzi.enac.fr/debian etch main
# deb http://paparazzi.enac.fr/debian lenny main
# deb http://paparazzi.enac.fr/debian squeeze main
# deb http://paparazzi.enac.fr/ubuntu gutsy main
# deb http://paparazzi.enac.fr/ubuntu hardy main
# deb http://paparazzi.enac.fr/ubuntu intrepid main
# deb http://paparazzi.enac.fr/ubuntu jaunty main
# deb http://paparazzi.enac.fr/ubuntu karmic main
# deb http://paparazzi.enac.fr/ubuntu lucid main
# deb http://paparazzi.enac.fr/ubuntu maverick main
# deb http://paparazzi.enac.fr/ubuntu natty main

Then, update your sources and install the dependencies needed for recompiling from the source (dev), and the cross-compilers (arm7, stm32 or both) :

For ARM7 (i.e. Tiny or TWOG boards) :

sudo apt-get update
sudo apt-get install paparazzi-dev paparazzi-arm7
-- or newerdays --
sudo apt-get install paparazzi-dev paparazzi-lpc21

For STM32 (i.e. Lisa boards) :

sudo apt-get update
sudo apt-get install paparazzi-dev paparazzi-stm32

Obsolete Packages

Users of the older AVR based boards will also need the paparazzi-avr package. It is unlikely you need it.

Older Ubuntu Versions

On older Linux distributions (not needed for lucid and later), the Braille TTY driver interferes with FTDI USB Serial adapters. If somehow your FTDI serial adapter does not work, remove the package via:

sudo apt-get remove brltty

Manual Installation of Individual Packages

Users of other Linux flavors than a recent Ubuntu or anyone needing manual control of each individual package can install them independently.

Downloading the Source Code

The complete source code should be downloaded from the paparazzi software repository on Github. Make sure you have installed the paparazzi-dev package as described above. Whithout these you will not be able to compile the sourcecode.

See the project page at Github for more details. From the directory of your choice type:

git clone git://github.com/paparazzi/paparazzi.git

or if you are behind a firewall with an http proxy available:

git clone https://github.com/paparazzi/paparazzi.git

This will download all of the paparazzi sourcecode need for an autopilot to work into the directory paparazzi/

If this whole "Git" thing is new to you an you are curious, more options and information can be found on the git page.

Launching the Software

The first step is to compile. From the paparazzi directory (cd paparazzi), run

make

You will have to run this command after each update of the source (git pull command). Launch the software from the paparazzi directory with

./paparazzi

From the Paparazzi Center interface, select the Microjet aircraft, select the sim target and Build it. Then Execute the Simulation session. The procedure is detailed in the Simulation page.

Quick Launch Icon

To create an icon on the desktop so you don’t have to manually type codes into the Terminal each time you want to start the Paparazzi Center follow these steps:

  1. Save this image file to your /paparazzi folder
  2. Right click anywhere on the Ubuntu desktop and click Create Launcher.
  3. Enter the following in the fields provided:
    • Name: Paparazzi Center
    • Command: /home/YOUR_USER_NAME/paparazzi/paparazzi
    • Comment: Runs the Paparazzi Center
    • Then click the icon image in the top left on the dialog box and select the Paparazzi logo you just downloaded.
  4. Click the OK button and that’s it! Your icon should appear on the desktop and you are ready to go.

Agents

If (and only if) you want to directly launch some Paparazzi agents (the Tools of the Paparazzi Center), without using the Paparazzi Center, you must have the Paparazzi source and home environment variables set correctly in your shell. These variables can be automatically set in your shell by adding the following lines to your .bashrc file:

File: ~/.bashrc
export PAPARAZZI_HOME=your paparazzi software directory
export PAPARAZZI_SRC=your paparazzi software directory

env Variables

If you wish to manually set the env variables (i.e. when compiling a backup copy of your code in a different folder) execute the following command from the folder you wish to set as your active paparazzi folder:

export PAPARAZZI_HOME=`pwd`;export PAPARAZZI_SRC=`pwd`

Verify that your variables are set correctly with the following command:

env | grep PAPARAZZI

which should return the following:

PAPARAZZI_HOME=your paparazzi software directory
PAPARAZZI_SRC=your paparazzi software directory

Setting access rights for USB download

This may be required to flash the Paparazzi-boards directly thru USB. For flashing details, see Compiling.

Default linux rights may not allow standard (non root) users to directly access the USB bus. You will need to make yourself a member of the plugdev "group" and then create a "rule", associated with that "group".
Make yourself a member of the plugdev group:

sudo adduser <your login> plugdev

Logout and login again. Then add the appropriate rule (available ine fhe file 50-paparazzi.rules) to the USB handler. Simply copy as root $PAPARAZZI_HOME/conf/system/udev/rules/50-paparazzi.rules to /etc/udev/rules.d/

sudo cp $PAPARAZZI_HOME/conf/system/udev/rules/50-paparazzi.rules /etc/udev/rules.d/

Software Updates

Paparazzi is a very rapidly evolving project and as such you might want to update your software regularly.

Any new files you created will not be lost/overwritten when updating (like your own airframe file). Nevertheless, as with all things, backups are advised. If you modified source code, the best way is of course to use the version control system Git to commit your changes. Otherwise at least use the brute force method and save everything in another directory.

Update your software with care and caution, and always test the functionality on the ground and in the air as some updates will affect tuning parameters. You might need to update your airframe file as well. The compiler will usually complain if there is a problem, at which point you can look at the Airframe Configuration wiki page again, look on the mailing list or some of the most recent airframe files on git to find the proper syntax. See the Compiling page for more help if needed.

That said, keeping your software up to date is fairly easy with Git.

To download and automatically merge any updated source files, run the following command from your Paparazzi directory

git pull

Please see the Git wiki page for more details.

After any git update or source code modification the code can be recompiled from your paparazzi software directory with the following command:

make

The make command will only recompile portions of the software where changed have been detected. If it does not behave as expected you can deleted all compiled files and recompile from scratch with the following commands:

make clean
make

See the Compiling page for more info.

Using the Live CD

There is a LiveCD available, but it dates back to 2008. It is still an easy way to get a first glimpse on Paparazzi.

From Scratch

In very rare occasions one needs to install the tools used, third-party libraries used by Paparazzi all from scratch. Currently there are no 64 bit Linux repositories, that is a very good reason to install from scratch. Sometime one just wants to be able to use all the latest and greatest compilers, or source code of everything to improve something. Then there is no other way than to install from scratch. To help you out getting it all smoothly working a special page is created just click here. If you do not understand what that all means, do not panic, then the information on that page is not important to you. Just pretend you never read this part of the Wiki. You are advised just to follow the regular step as described on the install page.

Using 32Bit on 64Bit

If you don't know what 64 bit (x86_64) means, then don't worry about this! As previously discussed, there are currently no 64 bit paparazzi pre-made deb packages available. You could opt to install from scratch as described here http://paparazzi.enac.fr/wiki/Install_paparazzi_and_everything_from_scratch An temporary solution is to use an i386 installation instead. In rare circumstances however, this may be problematic (certain engineering software for example requires 64 bit kernels). In these cases, a chroot is a good compromise, while avoiding the overhead of a virtual machine (and USB device problems which may occur). Initial instructions are here for now: https://help.ubuntu.com/community/DebootstrapChroot The command you use for the bootstrap needs to reflect your architecture - I used

 sudo debootstrap --variant=buildd --arch i386 lucid /var/chroot/lucid http://gb.archive.ubuntu.com/ubuntu/

The format for schroot config files has changed as of lucid however - here is mine:

 $ cat /etc/schroot/chroot.d/lucid-i386 
 [lucid]
 description=Ubuntu 10.04 Lucid for i386
 directory=/var/chroot/lucid
 personality=linux32
 root-users=my_user
 type=directory
 users=my_user

Once you've installed the ubuntu minimal package, make sure you also enable the uni- and multiverse repos (the easiest way for me is to simply copy my host's /etc/apt/sources.lst to /var/chroot/lucid/etc/apt/sources.lst). Then follow the standard instructions above. You may need to manually set the PAPARAZZI_HOME and PAPARAZZI_SRC environment variables. You will also have to set the DISPLAY environment variable to :0.0 like so:

 export DISPLAY=:0.0

Please note, this is more advanced than the standard paparazzi installation and therefore you may encounter strange problems.