Difference between revisions of "GettingTheGCSRunningonAGumstixBoard"

From PaparazziUAV
Jump to navigation Jump to search
Line 1: Line 1:
= Intro =
= Introduction =


Please take note that the page is in work at the moment and that we are doing our best to have it updated as soon as possible. Please feel free to contribute!
Would it not be great to have your small UAS in your backpack, throw it in the air and monitor and even adjust the flight via a small device in your pocket? If you think this would be awesome, read on, since that is what this page is all about. It is the first attempt and will not be about iPad, Android Phones, Amazon Kindles or the likes as a ground station. For this we have other wiki pages. No, we will use a thrusted solution; A Gumstix board with Linux on it connected to a small screen.
 
Would it not be great to have your small UAS in your backpack, throw it in the air and monitor and even adjust the flight via a small device in your pocket? If you think this would be awesome, read on, since that is what this page is all about. It is the first attempt and will not be about iPad, Android Phones, Amazon Kindles or the likes as a ground station. For this we have other wiki pages. No, we will use a thrusted solution; A Gumstix with Linux on it.
[[Image:GumstixBoard_OpenUAS.jpg|right|Gumstix carrier board and touchscreen]]


= Outcome =
= Outcome =


Have the Paparazzi GCS monitoring and adjusting a UA via an small Gumstix based device.
The outcome of our effords will be to:
 
#Have the Paparazzi GCS running on a small [https://www.gumstix.com Gumstix] computer board so we can monitoring and adjust the flight of our unmanned aircraft with just a small simple device.
#Have fully correct instructions on how to get it to work on this wiki page.
 
{TODO add screenshot of working setup}


= Hardware =
= Hardware =


What do you need to get this working:
What do you need to get your groundstation up and running:
 
 


# A gumstix board with a charger
{TODO add more links to Gumsticks products}
# 8 GB SD card
# A gumstix board with a power supply
# 8 GB or higher capacity SD card, the faster the better
# USB to mini-USB cable
# USB to mini-USB cable
# UTP network cable
# Regular UTP network cable
# 3.5" screen (such as the LCD panel with the Chestnut) or 4.3"
# A small, or big screen, prefferably with touch such as the 4.3" LCD panel that comes with the Chestnut board kit or this [https://www.gumstix.com/store/product_info.php?products_id=344 fully integrated Gumstix board]


= Software =
= Software =


Needed softwares to run this application:
What we will install on the SD is the following


#Paparazzi software
#Ubuntu OS on your Gumstix
#Ubuntu kernel on your Gumstix
#Support libraries
#Driver for the camera in order to be used with the Gumstix
#Paparazzi main software
Well, we have some tutorials on this wiki about how to install Paparazzi. Please have a look and you will definetly find all you need to know.


= Before proceeding =
= Before proceeding =


If you encounter unexplainable error messages during installation take a look a the [[GettingTheGCSRunningonAGumstixBoard#Tips_and_tricks | tips and tricks]] section.
# If you encounter unexplainable error messages during installation take a look a the [[GettingTheGCSRunningonAGumstixBoard#Tips_and_tricks | tips and tricks]] section.
# You can just copy the line(s) in the
 
$  this is a commando for your terminal exame of how it looks
 
and paste into your terminal. But do not copy the $ or # sign, this symbol is just added on this page to show that it is to be pasted at a terminal prompt as regular user($) or root user(#).
 
= Get the Operating System =


= Create an OS =
Pre-requisites
Pre-requisites


# 8 GB SD card or larger
Have the MicroSD card at hand and download the OS from [[http://releases.linaro.org/12.07/android/images/vexpress-ics-gcc47-armlt-staging-alt-open/vexpress-ics-gcc47-armlt-staging-alt-open.img.gz vexpress-ics-gcc47-armlt-staging-alt-open.img.gz]]
# Download the pre-built image from [[http://releases.linaro.org/12.07/android/images/vexpress-ics-gcc47-armlt-staging-alt-open/vexpress-ics-gcc47-armlt-staging-alt-open.img.gz vexpress-ics-gcc47-armlt-staging-alt-open.img.gz]]


or maybe use this custom one if you want to have kernel driver for the video digitizer already in [http://openuas.org/pub/support/pprz/gumstix/linaro_for_gumstix.img.gz get this OS]
$ wget http://releases.linaro.org/12.07/android/images/vexpress-ics-gcc47-armlt-staging-alt-open/vexpress-ics-gcc47-armlt-staging-alt-open.img.gz vexpress-ics-gcc47-armlt-staging-alt-open.img.gz


Installation Steps
or maybe use this custom one with everything already installed for a gumstix board and Chestnut43 with touchscreen


#Unzip the downloaded pre-build image
{TODO: provide an image with everything alreadly fully installed}
#Insert SD card and note the assigned '/dev/sdX' so on the command line type without the $ sign:
 
==Installation Steps==
 
#Unzip the downloaded OS via
 
$ unzip {TODO}
 
#Insert SD card in an SD reader and plug it in an USB port of your PC, then on the terminal type:  


  $ dmesg  
  $ dmesg  


where sdX is the SD reader device found with the command above
note line the assigned '/dev/sdX'
 
{TODO example output}
 
where sdX is the SD reader device found with the command above, then


  $ SDCARD=/dev/sdX   
  $ SDCARD=/dev/sdX   
Line 59: Line 82:
then patiently wait... once the OS is written on your SD card you can insert it in the SD slot of the Gumstix board and boot up your Gumstix on a carrier board.
then patiently wait... once the OS is written on your SD card you can insert it in the SD slot of the Gumstix board and boot up your Gumstix on a carrier board.


= Connecting peripherals=
== Connecting peripherals==
 
$ sudo apt-get install cutecom
 
When you have a Linux version running on your Gumstix, you can add a LCD, or a mouse, or a keyboard.
When you have a Linux version running on your Gumstix, you can add a LCD, or a mouse, or a keyboard.


Line 75: Line 101:
  boot
  boot


=Connect to the Gumstix through the network=
==Connect to the Gumstix through the network==


If you want to send files to the Gumstix, you can do it via a ssh connection. In order to do this, both devices, your computer and the Gumstix must be connected to the same network. Once you've done this, you can start setting up the connection.
If you want to send files to the Gumstix, you can do it via a ssh connection. In order to do this, both devices, your computer and the Gumstix must be connected to the same network. Once you've done this, you can start setting up the connection.
Line 94: Line 120:
Note: -G option will add the user to the specified group.
Note: -G option will add the user to the specified group.
  passwd sergiu
  passwd sergiu
You will be asked to enter a password and confirm it. IF successful, you will get this message:
You will be asked to enter a password and confirm it. Type your password, then hit CTRL + Enter key combination and then retype your password. IF successful, you will get this message:
  passwd: password updated successfully
  passwd: password updated successfully


Line 115: Line 141:


Now you should be able to connect using:
Now you should be able to connect using:
  ssh sergiu@192.168.0.100
  ssh sergiu@192.168.0.100 {TODO USERNAME change}
You will be asked to type the password you previously set for the user.
You will be asked to type the password you previously set for the user.


= Tweaks =
= Install the prerequsites=
 
You may get some errors during this installation. This depends on how well you are cooling down your system, how much RAM you have on your platform, the OS you are using and so on.
#Add swap file
Due to lack of RAM memory it is possible to see errors like this:
==== ERROR [while installing ocamlfind.1.3.3] ====
Internal error:
  # opam-version    1.0.1 (1.0.0-84-g9b3ff34)
# os              linux
opam: "fork" failed: Cannot allocate memory
'opam install ocamlfind' failed.
The solution to this problem is to create a swap file. For this case I created a 512 MB swap file, but you should adapt its size to the size of your SD card and the needed memory size.
 
Execute these commands to create and mount a swap file:
sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=524288 #(will create 512 MB swap file)
sudo mkswap /swapfile1
sudo chown root:root /swapfile1
sudo chmod 0600 /swapfile1
sudo swapon /swapfile1
Note: this will remove the swap file each time you shutdown. If you need the file, you have to repeat the swapon command after each boot. An alternative would be to have it mounted every time you boot the system.
For more explanations you can go to [http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/ this website]
 
#Remove the login prompt.
You may want to set your OS to auto-login. Why? Because there may be times you don't have a keyboard for the Gumstix around. You can find a good explanation of this [http://www.liberiangeek.net/2012/03/automatically-login-to-ubuntu-12-04-precise-pangolin/ here] .
You have to write in your command prompt:
sudo locale-gen en_US.UTF-8
sudo apt-get install vim
Note: if you get an error at this step, use the --fix-missing option as recommended.
sudo vim /etc/lightdm/lightdm.conf
Edit the autologin-user line by replacing the username with your own
autologin-user=sergiu
and add this line:
autologin-user-timeout=0
 
!!!! sudo update-locale en_US.UTF-8x
sudo export LC_ALL=en_US.UTF-8 !!!!!


or the right locale for your keyboard. If this didn't solve your problem, you may want to read [https://help.ubuntu.com/community/Locale here] more about it.
Now that you are connected to the gumstix via cutecom wh can get the rest installed:
#Remove the Lightdm GUI for freeing memory
sudo apt-get remove lightdm
After this step you must reboot.
#Remove processes not needed
sudo killall -9 NetworkManager  (for faster system)


==Libraries==


Here are some of the errors I occured and how I solved them. You may need to worry about them or not.
Installing one package at a time is the best path to succes since it is likely during installation that you will be asked to re-run some of the commands with the "--fix-missing" option.  


If you get errors when trying install a large number of packages/libraries at once, try to divide them into smaller groups.
Because the original image was created as 4 GB big, you have to execute the fallowing set of instructions to enlarge it:
#Add more space
You can use the gparted GUI tool if the SD in is an external SD reader hanging on you laptop( $ sudo gparted )
of not, the command line way to make a new partition and move you home dir
$ mkfs.ext3 /dev/mmcblk0p3
$ vol_id --uuid /dev/mmcblk0p3
$ blkid /dev/mmcblk0p3
$ vim /etc/fstab ???{TODO add what changed)
$ mv /home /oldHome
$ mkdir /home
$ mount /home
$ mount
??copy over old home data???
= Install paparazzi on the gumstix=
#Install all libraries needed
Note: most likely, you will be asked to re-run some of the commands with the "--fix-missing" option. So, it's probably not a good idea to try installing more than one package at a time.
$ sudo apt-get install ocaml-findlib
$ sudo apt-get install libxml-light-ocaml-dev
$ sudo apt-get install liblablgtk2-ocaml-dev
$ sudo apt-get install liblablgtk2-gnome-ocaml-dev
$ sudo apt-get install libocamlnet-ocaml-dev
$ sudo apt-get install libsdl-ocaml-dev
$ sudo apt-get install libpcre-ocaml-dev
  $ sudo apt-get install gtk2-engines-pixbuf
  $ sudo apt-get install gtk2-engines-pixbuf
  $ sudo apt-get install make
  $ sudo apt-get install make
Line 215: Line 170:
  $ sudo apt-get install python-lxml
  $ sudo apt-get install python-lxml
  $ sudo apt-get install python-wxgtk2.8
  $ sudo apt-get install python-wxgtk2.8
$ sudo apt-get install speech-dispatcher
  $ sudo apt-get install m4
  $ sudo apt-get install m4
  $ sudo apt-get install python-yaml  
  $ sudo apt-get install python-yaml  
  $ sudo apt-get install subversion
  $ sudo apt-get install subversion


#Create a subdirectory where you will download and install all the libraries and other software tools needed. To keep your home dir tidy it is advised to use a ''develop'' directory to store it all
===Keep it clean===
 
#Create a subdirectory where you will download and install all the libraries and other software tools needed. To keep your home dir tidy use a ''develop'' directory to store all the relevant downloads.


  $ mkdir ~/develop
  $ mkdir ~/develop
  $ cd ~/develop/
  $ cd ~/develop/


#Install Ocaml 4.00.1
==OCAML==


  $ wget http://caml.inria.fr/pub/distrib/ocaml-4.00/ocaml-4.00.1.tar.gz
  $ wget http://caml.inria.fr/pub/distrib/ocaml-4.00/ocaml-4.00.1.tar.gz
Line 233: Line 189:
  $ make world
  $ make world
  $ make opt
  $ make opt
$ make ocamldoc
$ make ocamlbuild.native
$ make ocamlbuild.byte
  $ sudo make install
  $ sudo make install
  $ sudo make optinstall
  $ sudo make installopt
  $ ocaml -version (make sure you have the right version, meaning 4.00.1)
$ su -c "echo \"export PATH=/usr/local/bin/ocamldoc/:\\\$PATH\" >> /etc/profile"
$ su - `whoami`
  $ ocaml -version  
#(make sure you have the right version, meaning 4.00.1)
  $ cd ~/develop
  $ cd ~/develop


#Install the OCAML Opam tool
==Opam tool==
#Install the OCAML '''Opam''' tool


  $ git clone https://github.com/OCamlPro/opam.git
  $ git clone https://github.com/OCamlPro/opam.git
Line 247: Line 210:
  $ cd ~/develop
  $ cd ~/develop


#Install pcre-ocaml
Personal note: later remove ~/.opam !!!!!!!!
opam init
eval `opam config env`
Please select yes.
sudo opam install ocamlfind
sudo opam install lablgtk
sudo opam install pcre-ocaml
sudo opam install ocamlnet
sudo opam install xml-light


Note: because version pcre-ocaml 7.0.2 does not work (yet?) for what we want at the moment of this GCS on Gumstix tryout, an little older version, pcre-ocaml 6.2.5 will be used.
=portability-support=


$ wget https://bitbucket.org/mmottl/pcre-ocaml/downloads/pcre-ocaml-6.2.5.tar.gz
#Get paparazzi-portability-support related files
  $ tar -xvzf pcre-ocaml-6.2.5.tar.gz
 
$ cd pcre-ocaml-6.2.5
  $ sudo apt-get install  debhelper devscripts fakeroot build-essential autoconf automake autotools-dev dh-make xutils lintian pbuilder dh-ocaml
$ make
$ sudo make install
  $ cd ~/develop
  $ cd ~/develop
$ <nowiki>git clone https://github.com/paparazzi/paparazzi-portability-support.git</nowiki>
$ cd paparazzi-portability-support/linux/
$ sudo ./develenv.sh
$ cd ivy/
$ svn checkout http://svn.tls.cena.fr/svn/ivy/ivy-c/trunk ivy-c
$ cd ivy-c/src/


$ opam config env
Patchthe Makefile with :
$ sudo opam install ocamlfind
<nowiki>
$ sudo opam install lablgtk
Patch content:
 
--- Makefile.orig 2013-05-23 16:36:45.000000000 +0000
Install from source xml-light
+++ Makefile 2013-05-23 16:32:22.000000000 +0000
$ wget http://tech.motion-twin.com/zip/xml-light-2.2.zip
@@ -28,6 +28,11 @@
  $ unzip xml-light-2.2.zip
FPIC=
  $ cd xml-light
endif
  $ make
   
+MACHINE = $(shell uname -m)
+ifeq ("$(MACHINE)", "armv7l")
+ FPIC = -fPIC
+endif
+
  ifndef PREFIX
export PREFIX=/usr/local
</nowiki>
  $ make all
  $ sudo make install
  $ sudo make install
$ cd ~/develop
Continue the installation
$ sudo opam install ocamlnet


#Get paparazzi-portability-support related files
== IVY ==
  $ sudo apt-get install libxt-dev tcl8.4-dev
$ sudo apt-get install tcl-dev
$ sudo apt-get install dpkg-dev debhelper devscripts fakeroot build-essential autoconf automake autotools-dev dh-make xutils lintian pbuilder dh-ocaml
$ cd ~/develop
$ git clone https://github.com/paparazzi/paparazzi-portability-support.git
$ cd paparazzi-portability-support/linux/
$ sudo ./develenv.sh
$ cd ivy/ivy-c
$ pkbuild
$ cd ivy-c-3.12.1/
$ debuild -i -us -uc -b


#Install ivy-ocaml
IVY is a simple protocol and a set of open-source libraries and programs that allows applications to broadcast information through text messages, with a subscription mechanism based on regular expressions. The project can be found at: http://www2.tls.cena.fr/products/ivy


cd ~/develop/
In the paparazzi project, Ivy is used to send telemetry data to where ever you want.
svn co http://svn.tls.cena.fr/svn/ivy/ivy-ocaml/trunk
mv trunk ivy-ocaml
cd ivy-ocaml/
ocamlmklib -o ivy-ocaml ivy.cmo ivyLoop.cmo civy.o civyloop.o  -livy
make
sudo make install
cd ~/develop
Note: if this didn't work for you, please replace the content of your Makefile with this file. Probably a "$ make clean " will be a good idea.


#Install ivy-python
NOTE: Do not confuse this IVY with the Apache Ivy project.  
cd ~/develop
svn co http://svn.tls.cena.fr/svn/ivy/ivy-python/trunk
mv trunk ivy-python
cd ivy-python/
sudo python setup.py
sudo python setup.py install
cd ../..


#Get paparazzi related files
== Ivy-OCAML ==


git clone git://github.com/paparazzi/paparazzi.git
The Ivy-ocaml is a Library that make it possible to use Ivy via the Ocaml language.
cd paparazzi
git checkout -b master_sergiu origin/master
cd ~/develop
#Install ivy-ocaml
git clone git://github.com/flixr/ivy-ocaml.git
cd ivy-ocaml
??Is this still needed??
vim /usr/local/lib/ocaml/3.12.0/ivy/META
vim /usr/local/lib/ocaml/3.12.0/glibivy/META
?????????????????????????
Note: if you have problems with Makefile from ivy-ocaml folder, replace it with this file.??File??


$ cd ~/develop/paparazzi-portability-support/linux/ivy/
$ <nowiki>svn checkout http://svn.tls.cena.fr/svn/ivy/ivy-ocaml/trunk ivy-ocaml</nowiki>
$ cd ivy-ocaml/
  $ make
  $ make
  $ sudo make install
  $ sudo PATH=$PATH make install
 
 
=== Ivy-python ===


Note: you may have to remove the files listed below, if you get any errors trying to install ivy-ocaml.
The ivy-python package makes it possible to use the IVY libraries from within the Python programming language. The ivy-python package is architecture independent, so it can be downloaded from the Ubuntu or Debian paparazzi repository. However since this is the from scratch page we will download it from the official source repository via


  $ sudo rm /usr/local/lib/ocaml/glibIvy.cmi
  $ cd ~/develop/paparazzi-portability-support/linux/ivy/
  $ sudo rm /usr/local/lib/ocaml/glibivy-ocaml.*
  $ <nowiki>svn co http://svn.tls.cena.fr/svn/ivy/ivy-python/trunk ivy-python</nowiki>
$ ocamlfind install  glibivy META glibIvy.mli glibIvy.cmi glibIvy.cmx glibivy-ocaml.cma glibivy-ocaml.cmxa libglibivy-ocaml.a glibivy-ocaml.a dllglibivy-ocaml.so
  $ cd ivy-python/
$ sudo cp /usr/local/lib/ocaml/3.12.0/* /usr/local/lib/ocaml/ -r
  $ sudo python setup.py install
  $ OCAMLFIND_CONF=/etc/ocamlfind.conf ocamlfind query
  $ export OCAMLFIND_CONF=/etc/ocamlfind.conf


!!!!Did not find these files !!!!
== Main sourcecode ==
???
Dependencies for paparazzi software;
  $ cp /home/sergiu/.opam/system/lib/findlib.conf /home/sergiu/.opam/system/lib/findlib.conf.old
  $ sudo apt-get install libgtksourceview2.0-dev
  $ cp /etc/ocamlfind.conf /home/sergiu/.opam/system/lib/findlib.conf
$ sudo apt-get install libgtksourceview2.0-dev
  $ apt-get install ocaml-findlib


!!!!!!!!
Now all the prequisites are installed, finally we can grab a copy of the full Paparazzi project


  wget https://forge.ocamlcore.org/frs/download.php/545/ocaml-http-0.1.5.tar.gz --no-check-certificate
  $ cd ~
tar -xzvf ocaml-http-0.1.5.tar.gz
  $ <nowiki>git clone https://github.com/paparazzi/paparazzi.git</nowiki>
cd ocaml-http_0.1.5/
  $ cd paparazzi
  make
  $ make
cd ..
wget "http://downloads.sourceforge.net/project/ocamlnet/ocamlnet/2.2.9/ocamlnet-2.2.9.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Focamlnet%2F&ts=1365529051&use_mirror=ignum"
mv ocamlnet-2.2.9.tar.gz\?r\=http\:%2F%2Fsourceforge.net%2Fprojects%2Focamlnet%2F\&ts\=1365529051\&use_mirror\=ignum.1 ocamlnet-2.2.9.tar.gz
tar -xzvf ocamlnet-2.2.9.tar.gz
cd ocaml/ocamlnet-2.2.9
./configure -enable-gtk2 -with-nethttpd
make all
  cd ../../ocaml-4.00.0
./configure
exit
make compilerlibs
  sudo make installopt
Note: if you get errors at this step, please replace Makefile file content with this.
sudo apt-get install python-xml libxml-light-ocaml-dev libxmlm-ocaml-dev libhttp-ocaml-dev


sudo apt-get remove  libocamlnet-ocaml-bin
run paparazzi center
opam remove ocamlnet (check where it was installed)
  $ ./paparazzi
sudo apt-get remove liblablgtk2-ocaml
----
sudo opam install lablgtk2 lablgtk ocamlnet topfind
cd develop/ocamlnet-2.2.9
make
cd paparazzi
make
opam init
opam install ocamlnet
cd ~sergiu/paparazzi
  ./paparazzi
Note: please replace the content of these files Makefile and sw/simulator/Makefile with the respective files from the archive and try running "./paparazzi" again.
opam install ocamlnet
cd /root/.opam/system/build/ocamlnet.3.6.0/src/netstring
make
make installopt
make install
cd ../..
make
make optinstall
make install
vim Makefile
cd ../ocamlnet.3.6.0/src/netclient/
make install
vim    def build(self):
vim /root/.opam/system/lib/findlib.conf
cd /opt/
cp ~sergiu/.opam/system/
cp -r ~/.opam ~sergiu/
chown -R sergiu ~sergiu/.opam
mkdir opam_sw
opam config env --root /opt/opam_sw/
opam init --root /opt/opam_sw/
cd opam_sw/
cp -r ~/.opam/system/lib system/lib/
. /root/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
cd ~sergiu/paparazzi
opam install xml-light
make
Note: if you get any errors at this step, please check that the content of this file /root/.opam/system/lib/findlib.conf looks like this. You must be logged in as root to edit this file.
Note: if you get any errors at this step, please check that the content of this file /root/.opam/system/lib/findlib.conf looks like this. You must be logged in as root to edit this file.
  destdir="/root/.opam/system/lib"
  destdir="/root/.opam/system/lib"
  path="/root/.opam/system/lib"
  path="/root/.opam/system/lib"


cp -r /opt/opam_sw/system/lib/xml-light ~/.opam/system/lib/
 
make
opam install glibivy
opam install glibivy2
cd /home/sergiu/develop/ivy-ocaml/
make install
cd ~sergiu/paparazzi
opam install lablgtk
cp  -r  /opt/opam_sw/system/lib/lablgtk* ~/.opam/system/lib/
apt-get install libgnomecanvas2-dev libgnomecanvas2-0
opam install lablgtk2.gnomeui
Note: if you get any errors at this step, please replace the content of this file sw/lib/ocaml/META.pprz with the file from here.
mktemp
Note: if you get any errors at this step, please replace the content of this file sw/supervision/Makefile with the file from here.
sudo apt-get install  liblablgtk2-ocaml
export LD_LIBRARY_PATH=/usr/lib/ocaml/stublibs/:$LD_LIBRARY_PATH
apt-get install  liblablgtk2-gnome-ocaml
make
export CAML_LD_LIBRARY_PATH=/root/.opam/system/lib/lablgtk2/:/root/.opam/system/lib/:$CAML_LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.opam/system/lib/lablgtk2/:/root/.opam/system/lib/:/root/.opam/system/lib/stublibs:/usr/local/lib/ocaml/stublibs
Note: please replace the content of these files Makefile and sw/ground_segment/multimon/Makefile and sw/ground_segment/cockpit/Makefile and sw/ground_segment/tmtc/Makefile with the respective file.
  make pprzcenter
  make pprzcenter
  make supervision
  make supervision
Line 474: Line 353:
  sw/ground_segment/cockpit/gcs  -b 192.168.209:2010
  sw/ground_segment/cockpit/gcs  -b 192.168.209:2010


  opam init
= Tweaks =
  . /home/sergiu/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
 
  eval 'opam config env'
You may get some errors during this installation. This depends on how well you are cooling down your system, how much RAM you have on your platform, the OS you are using and so on.
 
#Error and fixes
 
Some of the errors that you can come accross and how solve them.
 
If you get errors when trying install a large number of packages/libraries at once, try to divide them into smaller groups.
#Add swap file
Due to lack of RAM memory it is possible to see errors like this:
  ==== ERROR [while installing ocamlfind.1.3.3] ====
 
Internal error:
  # opam-version    1.0.1 (1.0.0-84-g9b3ff34)
# os              linux
opam: "fork" failed: Cannot allocate memory
  'opam install ocamlfind' failed.
The solution to this problem is to create a swap file. For this case I created a 512 MB swap file, but you should adapt its size to the size of your SD card and the needed memory size.
 
Execute these commands to create and mount a swap file:
sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=524288 (will create 512 MB swap file)
sudo mkswap /swapfile1
sudo chown root:root /swapfile1
sudo chmod 0600 /swapfile1
sudo swapon /swapfile1
Note: this will remove the swap file each time you shutdown. If you need the file, you have to repeat the swapon command after each boot. An alternative would be to have it mounted every time you boot the system.
For more explanations you can go to [http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/ this website]
 
#Autologin
 
Remove the login prompt
 
You may want to set your OS to auto-login. Why? Because there may be times you don't have a keyboard for the Gumstix around. You can find a good explanation of this [http://www.liberiangeek.net/2012/03/automatically-login-to-ubuntu-12-04-precise-pangolin/ here] .
 
$ sudo locale-gen en_US.UTF-8
$ sudo apt-get install vim nano
 
Note: if you get an error at this step, use the --fix-missing option as recommended.
 
$ sudo vim /etc/lightdm/lightdm.conf
 
Edit the autologin-user line by replacing the username with your own
 
autologin-user=sergiu
 
and add this line:
 
autologin-user-timeout=0
 
or the right locale for your keyboard. If this didn't solve your problem, you may want to read [https://help.ubuntu.com/community/Locale here] more about it.
 
#More Memory
 
Remove the Lightdm GUI manager we do not neet to free memory
 
  $ sudo apt-get remove lightdm
 
After this step you '''must''' reboot.
 
==More speed==
 
Remove processes not needed
 
$ sudo killall -9 NetworkManager  #(for faster system), {TODO in start the config? still needed?}
 
 
 
Because the original image was created as 4 GB big, you have to execute the fallowing set of instructions to enlarge it:{TODO make an 8GB OS image not 4GB the delete this text}
#Add more space
 
You can use the gparted GUI tool if the SD in is an external SD reader hanging on you laptop( $ sudo gparted ).


= Experimental steps =
= Experimental steps =


# Remove LightDM GUI to preserve Gumstix RAM


{TODO: Describe STEPS}
{TODO: Describe STEPS}
Line 505: Line 452:


= Links =
= Links =
Links to related information


* [[OMAP]]
* [[OMAP]]
* https://www.gumstix.com/
* https://www.gumstix.com/
* [[Dev/Caspa]]
* [[Dev/Caspa]]
* https://github.com/paparazzi/paparazzi-portability-support

Revision as of 15:39, 3 June 2013

Introduction

Would it not be great to have your small UAS in your backpack, throw it in the air and monitor and even adjust the flight via a small device in your pocket? If you think this would be awesome, read on, since that is what this page is all about. It is the first attempt and will not be about iPad, Android Phones, Amazon Kindles or the likes as a ground station. For this we have other wiki pages. No, we will use a thrusted solution; A Gumstix board with Linux on it connected to a small screen.

Gumstix carrier board and touchscreen

Outcome

The outcome of our effords will be to:

  1. Have the Paparazzi GCS running on a small Gumstix computer board so we can monitoring and adjust the flight of our unmanned aircraft with just a small simple device.
  2. Have fully correct instructions on how to get it to work on this wiki page.

{TODO add screenshot of working setup}

Hardware

What do you need to get your groundstation up and running:


{TODO add more links to Gumsticks products}

  1. A gumstix board with a power supply
  2. 8 GB or higher capacity SD card, the faster the better
  3. USB to mini-USB cable
  4. Regular UTP network cable
  5. A small, or big screen, prefferably with touch such as the 4.3" LCD panel that comes with the Chestnut board kit or this fully integrated Gumstix board

Software

What we will install on the SD is the following

  1. Ubuntu OS on your Gumstix
  2. Support libraries
  3. Paparazzi main software

Before proceeding

  1. If you encounter unexplainable error messages during installation take a look a the tips and tricks section.
  2. You can just copy the line(s) in the
$  this is a commando for your terminal exame of how it looks

and paste into your terminal. But do not copy the $ or # sign, this symbol is just added on this page to show that it is to be pasted at a terminal prompt as regular user($) or root user(#).

Get the Operating System

Pre-requisites

Have the MicroSD card at hand and download the OS from [vexpress-ics-gcc47-armlt-staging-alt-open.img.gz]

$ wget http://releases.linaro.org/12.07/android/images/vexpress-ics-gcc47-armlt-staging-alt-open/vexpress-ics-gcc47-armlt-staging-alt-open.img.gz vexpress-ics-gcc47-armlt-staging-alt-open.img.gz

or maybe use this custom one with everything already installed for a gumstix board and Chestnut43 with touchscreen

{TODO: provide an image with everything alreadly fully installed}

Installation Steps

  1. Unzip the downloaded OS via
$ unzip {TODO}
  1. Insert SD card in an SD reader and plug it in an USB port of your PC, then on the terminal type:
$ dmesg 

note line the assigned '/dev/sdX'

{TODO example output}

where sdX is the SD reader device found with the command above, then

$ SDCARD=/dev/sdX  
$ sudo dd bs=64k if=vexpress-ics-gcc47-armlt-staging-alt-open.img of=$SDCARD  

or if you have chosen the OS with included digitizer driver

$ SDCARD=/dev/sdX
$ sudo dd bs=64k if=gcsStix.img of=$SDCARD     

then patiently wait... once the OS is written on your SD card you can insert it in the SD slot of the Gumstix board and boot up your Gumstix on a carrier board.

Connecting peripherals

$ sudo apt-get install cutecom

When you have a Linux version running on your Gumstix, you can add a LCD, or a mouse, or a keyboard.

To set up your LCD you must follow these steps:

Connect through CuteCom to the Gumstix, restart the board and hit a key within 5 seconds:

Hit any key to stop autoboot: 5

Then type the following in the CuteCom command prompt:

setenv defaultdisplay lcd43

Or, if you are using a 3.5" screen (such as the LCD panel with the Palo35):

setenv defaultdisplay lcd35

You can save this setting for future boots by saving it:

saveenv

Finally, continue with the boot process by typing in CuteCom command prompt:

boot

Connect to the Gumstix through the network

If you want to send files to the Gumstix, you can do it via a ssh connection. In order to do this, both devices, your computer and the Gumstix must be connected to the same network. Once you've done this, you can start setting up the connection. Fistly, you need to know the IP address of the Gumstix. Start by opening CuteCom and connect to the device. To do so, download CuteCom tarball and follow the instructions. In your terminal, type:

cutecom

A window will pop up and you must adjust the pull-down menu settings as follows: Device will usually be either /dev/ttyUSB0 or /dev/ttyUSB1 . You can figure this out by typing on your command prompt:

dmesg|tail

Note: apply this command after you connected your Gumstix board to USB with your USB to mini-USB cable. This command lists the last connected devices. Baud rate must be set to 115200, data bits to 8, stop bits to 1, parity to none, handshake none checked, open for both reading and writing checked, apply settings when opening checked, choose "CR,LF end line" and Char delay 1ms.

Click on Open device and your connection should start. If you encounter any problems, but you are sure you did everything right check if your Gumstix board overheated or restart it.

The first thing you need in order to get rid of the USB to mini-USB cable and its physical limitations is to create a user and set a password for it and install openssh. Please feel free to replace "sergiu" with whatever username you choose, but keep in mind that you must replace it everywhere you encounter "sergiu".

useradd -c "Sergiu S" -m -s "/bin/bash" -G sudo sergiu

Note: -G option will add the user to the specified group.

passwd sergiu

You will be asked to enter a password and confirm it. Type your password, then hit CTRL + Enter key combination and then retype your password. IF successful, you will get this message:

passwd: password updated successfully
sudo apt-get install openssh-server

Once you have accomplished this, you must discover the Gumstix ip address, typing on CuteCom:

ifconfig -a 

Note: if you can't use this command for any reason you can get a list with all the IP addresses on the network using 'arp -a' on your machine. Among the data returned, you will see something like this:

eth0      Link encap:Ethernet  HWaddr 00:15:c9:28:c9:ff  
          inet addr:192.168.0.100  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::215:c9ff:fe28:c9ff/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3960 errors:0 dropped:0 overruns:0 frame:0
          TX packets:727 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3734905 (3.7 MB)  TX bytes:63765 (63.7 KB)
          Interrupt:80 

Now you should be able to connect using:

ssh sergiu@192.168.0.100 {TODO USERNAME change}

You will be asked to type the password you previously set for the user.

Install the prerequsites

Now that you are connected to the gumstix via cutecom wh can get the rest installed:

Libraries

Installing one package at a time is the best path to succes since it is likely during installation that you will be asked to re-run some of the commands with the "--fix-missing" option.

$ sudo apt-get install gtk2-engines-pixbuf
$ sudo apt-get install make
$ sudo apt-get install gcc
$ sudo apt-get install g++
$ sudo apt-get install libgsl0-dev
$ sudo apt-get install gnuplot
$ sudo apt-get install libgnomecanvas2-dev
$ sudo apt-get install bzip2
$ sudo apt-get install git
$ sudo apt-get install libusb-dev
$ sudo apt-get install speech-dispatcher
$ sudo apt-get install glade
$ sudo apt-get install imagemagick 
$ sudo apt-get install libpcre3-dev
$ sudo apt-get install git-core
$ sudo apt-get install python-usb
$ sudo apt-get install python-lxml
$ sudo apt-get install python-wxgtk2.8
$ sudo apt-get install m4
$ sudo apt-get install python-yaml 
$ sudo apt-get install subversion

Keep it clean

  1. Create a subdirectory where you will download and install all the libraries and other software tools needed. To keep your home dir tidy use a develop directory to store all the relevant downloads.
$ mkdir ~/develop
$ cd ~/develop/

OCAML

$ wget http://caml.inria.fr/pub/distrib/ocaml-4.00/ocaml-4.00.1.tar.gz
$ tar -xvzf ocaml-4.00.1.tar.gz 
$ cd ocaml-4.00.1
$ ./configure
$ make world
$ make opt
$ make ocamldoc
$ make ocamlbuild.native
$ make ocamlbuild.byte
$ sudo make install
$ sudo make installopt
$ su -c "echo \"export PATH=/usr/local/bin/ocamldoc/:\\\$PATH\" >> /etc/profile"
$ su - `whoami`
$ ocaml -version 
#(make sure you have the right version, meaning 4.00.1)
$ cd ~/develop

Opam tool

  1. Install the OCAML Opam tool
$ git clone https://github.com/OCamlPro/opam.git
$ cd opam
$ ./configure 
$ make (because of overheating you may get some errors, but keep doing 'make')
$ sudo make install
$ cd ~/develop

Personal note: later remove ~/.opam !!!!!!!!

opam init
eval `opam config env`

Please select yes.

sudo opam install ocamlfind
sudo opam install lablgtk 
sudo opam install pcre-ocaml
sudo opam install ocamlnet
sudo opam install xml-light

portability-support

  1. Get paparazzi-portability-support related files
$ sudo apt-get install  debhelper devscripts fakeroot build-essential autoconf automake autotools-dev dh-make xutils lintian pbuilder dh-ocaml
$ cd ~/develop
$ git clone https://github.com/paparazzi/paparazzi-portability-support.git
$ cd paparazzi-portability-support/linux/
$ sudo ./develenv.sh
$ cd ivy/
$ svn checkout http://svn.tls.cena.fr/svn/ivy/ivy-c/trunk ivy-c
$ cd ivy-c/src/

Patchthe Makefile with : Patch content: --- Makefile.orig 2013-05-23 16:36:45.000000000 +0000 +++ Makefile 2013-05-23 16:32:22.000000000 +0000 @@ -28,6 +28,11 @@ FPIC= endif +MACHINE = $(shell uname -m) +ifeq ("$(MACHINE)", "armv7l") + FPIC = -fPIC +endif + ifndef PREFIX export PREFIX=/usr/local

$ make all
$ sudo make install

IVY

IVY is a simple protocol and a set of open-source libraries and programs that allows applications to broadcast information through text messages, with a subscription mechanism based on regular expressions. The project can be found at: http://www2.tls.cena.fr/products/ivy/

In the paparazzi project, Ivy is used to send telemetry data to where ever you want.

NOTE: Do not confuse this IVY with the Apache Ivy project.

Ivy-OCAML

The Ivy-ocaml is a Library that make it possible to use Ivy via the Ocaml language.

$ cd ~/develop/paparazzi-portability-support/linux/ivy/
$ svn checkout http://svn.tls.cena.fr/svn/ivy/ivy-ocaml/trunk ivy-ocaml
$ cd ivy-ocaml/
$ make
$ sudo PATH=$PATH make install


Ivy-python

The ivy-python package makes it possible to use the IVY libraries from within the Python programming language. The ivy-python package is architecture independent, so it can be downloaded from the Ubuntu or Debian paparazzi repository. However since this is the from scratch page we will download it from the official source repository via

$ cd ~/develop/paparazzi-portability-support/linux/ivy/
$ svn co http://svn.tls.cena.fr/svn/ivy/ivy-python/trunk ivy-python
$ cd ivy-python/
$ sudo python setup.py install

Main sourcecode

Dependencies for paparazzi software;

$ sudo apt-get install libgtksourceview2.0-dev
$ sudo apt-get install libgtksourceview2.0-dev
$ apt-get install ocaml-findlib

Now all the prequisites are installed, finally we can grab a copy of the full Paparazzi project

$ cd ~
$ git clone https://github.com/paparazzi/paparazzi.git
$ cd paparazzi
$ make

run paparazzi center

$ ./paparazzi

Note: if you get any errors at this step, please check that the content of this file /root/.opam/system/lib/findlib.conf looks like this. You must be logged in as root to edit this file.

destdir="/root/.opam/system/lib"
path="/root/.opam/system/lib"


make pprzcenter
make supervision
cd sw/supervision/
export PPRZ_HOME=/home/sergiu/paparazzi/
export PAPARAZZI_HOME=/home/sergiu/paparazzi/
export PAPARAZZI_SRC=/home/sergiu/paparazzi/
make
make supervision
./paparazzicenter 
cd ../..
cd sw/logalizer/
make

Note: if you get any errors here, please replace the content of Makefile with the content of this file.

cd ../..
cd sw/ground_segment/multimon/
make clean
make
cd ../../..
make
cd sw/ground_segment/tmtc/
make clean
make
cd sw/simulator/
make clean
make
cd ../..
cd sw/../tools/

Note: please replace the content of Makefile with this.

make clean
cd ../
cd ground_segment/joystick/
make clean
make
cd ../../..
make
make ground_segment
X&
export DISPLAY=:0
xterm
git status
sw/ground_segment/cockpit/gcs  -b 192.168.209:2010
sw/ground_segment/cockpit/gcs 
sw/ground_segment/cockpit/gcs  -b 192.168.209:2010
mkdir /home/dirk
mkdir /home/dirk/nonSynced
ln -s /home/dirk/nonSynced/paparazzi /home/sergiu/paparazzi
ln -s  /home/sergiu/paparazzi /home/dirk/nonSynced/paparazzi
sw/ground_segment/cockpit/gcs  -b 192.168.209:2010

Tweaks

You may get some errors during this installation. This depends on how well you are cooling down your system, how much RAM you have on your platform, the OS you are using and so on.

  1. Error and fixes

Some of the errors that you can come accross and how solve them.

If you get errors when trying install a large number of packages/libraries at once, try to divide them into smaller groups.

  1. Add swap file

Due to lack of RAM memory it is possible to see errors like this:

==== ERROR [while installing ocamlfind.1.3.3] ====
Internal error:
  # opam-version    1.0.1 (1.0.0-84-g9b3ff34)
# os              linux
opam: "fork" failed: Cannot allocate memory
'opam install ocamlfind' failed.

The solution to this problem is to create a swap file. For this case I created a 512 MB swap file, but you should adapt its size to the size of your SD card and the needed memory size.

Execute these commands to create and mount a swap file:

sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=524288 (will create 512 MB swap file)
sudo mkswap /swapfile1
sudo chown root:root /swapfile1
sudo chmod 0600 /swapfile1
sudo swapon /swapfile1

Note: this will remove the swap file each time you shutdown. If you need the file, you have to repeat the swapon command after each boot. An alternative would be to have it mounted every time you boot the system. For more explanations you can go to this website

  1. Autologin

Remove the login prompt

You may want to set your OS to auto-login. Why? Because there may be times you don't have a keyboard for the Gumstix around. You can find a good explanation of this here .

$ sudo locale-gen en_US.UTF-8
$ sudo apt-get install vim nano

Note: if you get an error at this step, use the --fix-missing option as recommended.

$ sudo vim /etc/lightdm/lightdm.conf

Edit the autologin-user line by replacing the username with your own

autologin-user=sergiu

and add this line:

autologin-user-timeout=0

or the right locale for your keyboard. If this didn't solve your problem, you may want to read here more about it.

  1. More Memory

Remove the Lightdm GUI manager we do not neet to free memory

$ sudo apt-get remove lightdm

After this step you must reboot.

More speed

Remove processes not needed

$ sudo killall -9 NetworkManager  #(for faster system), {TODO in start the config? still needed?}


Because the original image was created as 4 GB big, you have to execute the fallowing set of instructions to enlarge it:{TODO make an 8GB OS image not 4GB the delete this text}

  1. Add more space

You can use the gparted GUI tool if the SD in is an external SD reader hanging on you laptop( $ sudo gparted ).

Experimental steps

{TODO: Describe STEPS}

{install python} {install ivy python} {install kivy}

Compile example

Source of Example

X11 server to display on LCD

Installing

Testing

Next

The next step will be to make onboard video work in the GCS.

Tips and tricks

Links

Links to related information