Installation/MacOSX
Update on OS X installation: Currently, arm-none-eabi-gdb on 10.6 should be broken (gcc-arm-embedded can be compiled by hand if required without python support, or installing python2.7 as a framework from a dmg might work).
(Feb. 1, 2014) Current OS X limitations:
- 10.6.* requires some manual effort to properly install gcc-arm-embedded, email the mailing list if help required (gcc-arm-embedded can be compiled by hand if required without python support, or installing python2.7 as a framework from a dmg might work)
- There is no cross compiler for the ARDrone2.
Intro
This page describes the installation of paparazzi on a MacOS X.
There are not as many MacOS X users as there are Linux users. We are always looking for more people to help with the effort of maintaining the OSX port. If you are a frequent user of OS X and understand the underpinnings we are looking for an official OSX maintainer at the moment. Let us know on gitter: https://gitter.im/paparazzi/discuss
Presently it is known that Paparazzi will install on OSX versions 10.6.*, 10.7.*, 10.8.*, 10.9.*, 10.10.*.
There are a few legacy installation approaches that might work on older OS X versions but are known not to work on the current Mac OS X. They all can be found on the Installation/MacOSX-legacy page.
Installing from Source (Homebrew/Opam)
Note: Macports used to conflict with homebrew. According to the homebrew website it is not the case any more as homebrew overrides the environment variables to have a pristine environment as if macports or fink were not installed on the system. It is not confirmed that opam does the same, so it probably is still a good idea to not have macports or fink installed simultanously with homebrew.
- Install XQuartz.
- Add XQuartz libraries to pkg-config search path by adding the following line:
export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig
to your ~/.profile, ~/.bashrc, ~/.zshrc.local or similar. Note: You have to restart your terminal for the variable to be set, or you execute the export manually in your terminal by pasting the line and pressing enter.
- Install XCode
- Run XCode.app once to accept the license. You can find it in your /Applications folder
- Install homebrew.
- Not all packages are yet part of the official homebrew repository (like ivy-c or jsbsim) this is why you might want to run the installation in two steps using the official repository and then [paparazzi homebrew tap https://github.com/paparazzi/homebrew-paparazzi].
- Install the packages included in homebrew:
brew install git coreutils gnu-sed gtk+ libglade libgnomecanvas sdl libusb libusb-compat gsl opam wget dfu-util
- Add paparazzi tap:
brew tap paparazzi/homebrew-paparazzi
- Install the remaining packages: Note: We provide these packages as a tap but the hope is to eventually include them in the official homebrew repository.
brew install ivy-c jsbsim
- Install the packages included in homebrew:
- Initialize opam You should allow opam to modify your .profile and .ocamlinit so that it's settings stay permanent. Also do not forget to run
opam init
after the initialization or restart your terminal.eval `opam config env`
opam pin add paparazzi-dev https://github.com/paparazzi/paparazzi-portability-support.git
- Install GCC ARM embedded.
- Download the gcc-arm-none-eabi-version.tar.bz2 from the website.
- Extract it into your home directory:
cd ~/
tar xfvj ~/Downloads/gcc-arm-none-eabi-*.tar.bz2
- Add the bin directory to your PATH environment variable by adding an export to your .profile or .bashrc or .zshrc.local or similar. Do not forget to restart your terminal or at least source the new .profile by executing
echo export PATH=$(echo ~/gcc-arm-none-eabi-* | tr ' ' '\n' | sort -r | head -n 1 )/bin:\$PATH >> ~/.profile
. ~/.profile
- Now you should be able to clone the paparazzi repository and run make, and execute ./paparazzi
This process is tested and is working on Mac OS Yosemite 10.10.2 ( Esden (talk) 16:16, 16 March 2015 (PDT) )
This process is tested and is working on Mac OS Yosemite 10.10.5 ( Esden (talk) 14:10, 22 September 2015 (PDT) )
This process is tested and is working on Mac OS El Capitan 10.11 ( Esden (talk) 16:59, 1 October 2015 (PDT) )
Installation Troubleshooting Notes
"Fatal error: exception Gtk.Error("GtkMain.init: initialization failed\nml_gtk_init: initialization failed")"
Try starting ./paparazzi inside of the XQuartz X11 terminal.
aspcud is not compiling with the error "CMAKE_OSX_DEPLOYMENT_TARGET is '10.11' but CMAKE_OSX_SYSROOT: """
It is a known bug in homebrew. You have to install full XCode you can't just use the command line tools.
El Capitan’s /usr/include
I was having trouble getting paparazzi to build against the native libxml2 libraries on Mac OS X v10.11 - “El Capitan.” The problem was that I was missing the header files – in fact the entire /usr/include tree was gone.
Here's the error I was seeing during the make process:
OL app_server app_server.c:42:10: fatal error: 'libxml/xmlreader.h' file not found #include <libxml/xmlreader.h> ^ 1 error generated. make[1]: *** [app_server] Error 1 make: *** [tmtc] Error 2
The fix is to run xcode-select --install. Apparently you can have the developer tools installed, but not have the “command line developer tools” which include /usr/include. Unfortunately, thanks to the “rootless” feature, this Apple-sanctioned installer is pretty much the only way to get /usr/lib back.
Running Paparazzi
Please see Installation for details on running Paparazzi, downloading source code from GitHub and updating software.
Paparazzi can be started in the usual way
cd ~/paparazzi ./paparazzi
Changing the GTK look and feel
Run /opt/local/bin/switch2 to select a different theme. More detailed instructions can be found at http://gtk.php.net/manual/en/html/tutorials/tutorials.installation.macosx-stepbystep.html
Additional themes can be downloaded from http://art.gnome.org/themes/gtk2
A good choice is:
switch2 /opt/local/share/themes/ClearlooksClassic/
Another theme selector with a little bit better preview option is "gtk-chtheme"
USB Drivers for Telemetry
No drivers need to be installed in order to program either the STM32 based or LPC2148 based autopilot boards (ie TINY, TWOG, Booz, Lisa/L, Lisa/M) using a USB port. However telemetry between the vehicle and ground control station requires a modem. On an Apple Mac this will generally be connected to a USB port. Whatever modem is used it will be necessary to load drivers that allow Paparazzi to communicate with the modem. It is not possible to describe all possible modems and their configuration. However the most commonly used chipset for USB to serial communication is produced by FTDI. Below is described the installation of the FTDI drivers. This can be used as a guide for installing drivers for modems using other chipsets.
FTDI drivers can be downloaded from FTDI
The device will probably become available as something like /dev/tty.usbserial-000013FD when connected. Note that different USB ports get different addresses. When connecting to another port the same device came up as /dev/tty.usbserial-000014FA
Since Paparazzi is currently configured to use /dev/ttyUSB0 it's easiest to just create a link to the required device.
- Remove all USB devices from the computer and run the command
ls -l /dev/*usb* /dev/*USB*
hopefully this will not list anything - Plug in your radio and repeat the command
ls -l /dev/*usb* /dev/*USB*
this should now list the serial port that the radio has been connected to. In my case I getls -l /dev/*usb* /dev/*USB*
- crw-rw-rw- 1 root wheel 11, 27 20 Jan 14:38 /dev/cu.usbserial-000013FD
- crw-rw-rw- 1 root wheel 11, 26 20 Jan 14:38 /dev/tty.usbserial-000013FD
- Next we need to create a symbolic link to the tty.usbserial device listed to /dev/ttyUSB0 in my case the command is
sudo ln -s /dev/tty.usbserial-000013FD /dev/ttyUSB0
- To check that everything is correct run the first command again
ls -l /dev/*usb* /dev/*USB*
and you should get something like thisls -l /dev/*usb* /dev/*USB*
- crw-rw-rw- 1 root wheel 11, 27 20 Jan 14:38 /dev/cu.usbserial-000013FD
- crw-rw-rw- 1 root wheel 11, 26 20 Jan 14:38 /dev/tty.usbserial-000013FD
- lrwxr-xr-x 1 root wheel 0 20 Jan 14:42 /dev/ttyUSB0 -> /dev/tty.usbserial-000013FD
Once the FTDI driver (kernel extension) is loaded it takes over for all FTDI connections. This means that it will not be possible to program the Lisa/L or Lisa/M boards while the driver is loaded.
To unload the driver use the command
sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext
This should not give an error. if it does then try again a few times after quitting programs that may have used the connection. If the driver still fails to unload then a reboot may be required.
When it comes time to connect the modem again you'll again need the driver loaded. This can be done with the complementary command
sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext
Workaround for Issues with errors (Device busy) when trying to program a Lisa/L
Programming the Lisa on OS X
The problem: The "default" vendor id and product id for the ftdi device on Lisa is the same one used by all the manufacturers of clone usb-serial interfaces. This isn't an issue on Linux because of the udev rules file we use does not load the ftdi drivers for lisas programming interface. Windows and Mac OS X don't use this file so they can only use vendor id and product id. So as soon as you plug in Lisa they load USB->serial port drivers for the two ports they believe are on Lisa causing a conflict. The programming of Lisa happens through a different mechanism and does not want the programming interface of Lisa to be taken by the FTDI driver which has already been loaded. For OS X there is a hack we can do that makes it better until we can get vendor and product ids sorted out. It involves modifying the /System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents/Info.plist file. We change it so only the first of the two serial interfaces is loaded. The second is not as it is the programming interface.
The File (edit with a text editor):
/System/Library/Extensions/FTDIUSBSerialDriver.kext/Contents/Info.plist
Here is a diff between a "vanilla OS X" and one that has been modified (Essentially below was removed):
quadzilla:Contents root# diff ~/Info.plist Info.plist
1784,1805d1783
< <key>FT2232C_B</key>
< <dict>
< <key>CFBundleIdentifier</key>
< <string>com.FTDI.driver.FTDIUSBSerialDriver</string>
< <key>ConfigData</key>
< <dict>
< <key>LatencyTimer</key>
< <integer>2</integer>
< </dict>
< <key>IOClass</key>
< <string>FTDIUSBSerialDriver</string>
< <key>IOProviderClass</key>
< <string>IOUSBInterface</string>
< <key>bConfigurationValue</key>
< <integer>1</integer>
< <key>bInterfaceNumber</key>
< <integer>1</integer>
< <key>idProduct</key>
< <integer>24592</integer>
< <key>idVendor</key>
< <integer>1027</integer>
< </dict>
1830,1853d1807
< <key>FT2232H_B</key>
< <dict>
< <key>CFBundleIdentifier</key>
< <string>com.FTDI.driver.FTDIUSBSerialDriver</string>
< <key>ConfigData</key>
< <dict>
< <key>LatencyTimer</key>
< <integer>2</integer>
< </dict>
< <key>IOClass</key>
< <string>FTDIUSBSerialDriver</string>
< <key>IOProviderClass</key>
< <string>IOUSBInterface</string>
< <key>bConfigurationValue</key>
< <integer>1</integer>
< <key>bInterfaceNumber</key>
< <integer>1</integer>
< <key>bcdDevice</key>
< <integer>1792</integer>
< <key>idProduct</key>
< <integer>24592</integer>
< <key>idVendor</key>
< <integer>1027</integer>
< </dict>
Once you have edited the file
- sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext/ - sudo kextload /System/Library/Extensions/FTDIUSBSerialDriver.kext/
To reload the driver or you can just reboot.
It is expected as Paparazzi moves to supporting more operating systems that unique product and vendor ids will be obtained thus removing the need for this step.
Installing FlightGear
FlightGear has been packaged for use on OS X. This package can be downloaded from: http://www.flightgear.org/download/
There are several packages available. Recently, FlightGear 3.0 was released. A binary for OS X is available, and seems to work properly on Maverics (OS X 10.9.2). Follow the directions here for installation. Additional documentation can be found here.
Once FlightGear is installed, the GUI launcher can be used to set common options. By clicking on the Advanced Features arrow, one can gain access to many more options as well as an interface to specify command line options (the Others tab). This is where one can specify the flight dynamics model and network connectivity required for visualizing Paparazzi simulations as described on the Simulation page.
- In Paparazzi Center, add to the simulator command the --fg option plus the IP address of the machine running flightgear in this case the loopback interace is used as Flightgear and Paparazzi are running on the same machine:
.../sw/simulator/pprzsim-launch --aircraft TJ1 -t sim --boot --norc --fg_host 127.0.0.1
Note TJ1 is the name of the aircraft you must substitute this with the name of your aircraft.
- Launch Flight Gear with the following set in the others tab under advanced settings:
--fdm=null --native-gui=socket,in,30,,5501,udp
For Flight Gear visualization, version 3.0 or greater with Rembrand switched on is best. If you wish to use version 2.4 or lower, you must add the following to the firmware section of your airframe file:
<firmware name="fixedwing or rotorcraft">
...
<define name="FG_2_4" value="1"/>
...
</firmware>
Simulations Using JSBSim
JSBSim is an open-source flight dynamics and control software library. It can provide a more realistic simulation environment over the basic built-in Paparazzi simulator. See the Simulation page for background information and how to run a normal simulation. After this can be done in a satisfactory manner, follow the steps below to utilize the JSBSim flight dynamics model.
Please see JSBSim for installation instructions and Simulation#JSBSim for instructions on how to use the JSBSim FDM in simulations.
Differences with the Linux version
This section is intended to document all the subtle differences between Linux and Mac OS X versions of Paparazzi.
Change of text editor
The default editor in Linux is gedit, but in OS X, it is open, which simply uses whatever the default program for opening .xml files is setup.
Ivy subnet mask
On Linux, the Ivy submask is 127.255.255.255
On Mac OS X, the Ivy submask is 224.255.255.255
In C applications, such as tmtc/c_ivy_client_example_1.c, this should be set adaptively by something like:
#ifdef __APPLE__ printf("Mac OS, network submask: 224.255.255.255\n"); IvyStart("224.255.255.255"); #else printf("NO Mac OS, network submask: 127.255.255.255\n"); IvyStart("127.255.255.255"); #endif
Is there a better way to do this?