GettingTheGCSRunningonAGumstixBoard
Intro
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 with Linux on it.
Outcome
Have the Paparazzi GCS monitoring and adjusting a UA via an small Gumstix based device.
Hardware
What do you need to get this working:
- A gumstix board with a charger
- 8 GB SD card
- USB to mini-USB cable
- UTP network cable
- 3.5" screen (such as the LCD panel with the Chestnut) or 4.3"
Software
Needed softwares to run this application:
- Paparazzi software
- Ubuntu kernel on your Gumstix
- Driver for the camera in order to be used with the Gumstix
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
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. Here are some of the errors I occured and how I solved them. You may need to worry about them or not.
If you get errors when trying install a big number of packages/libraries at once, try to divide them in 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 it's size to the size of your SD card and the needed memory size. Run this commands as sudo:
dd if=/dev/zero of=/swapfile1 bs=1024 count=524288 (will create 512 MB swap file) mkswap /swapfile1 chown root:root /swapfile1 chmod 0600 /swapfile1 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
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
mkfs.ext3 /dev/mmcblk0p3 vol_id --uuid /dev/mmcblk0p3 blkid /dev/mmcblk0p3 vim /etc/fstab mv /home /oldHome mkdir /home mount /home mount
Create an OS
Pre-requisites
- 8 GB SD card or larger
- Download the pre-built image from [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 get this OS
Installation Steps
- Unzip the downloaded pre-build image
- Insert SD card and note the assigned '/dev/sdX' so on the command line type without the $ sign:
$ dmesg
where sdX is the SD reader device found with the command above
$ SDCARD=/dev/sdX $ sudo dd bs=64k if=vexpress-ics-gcc47-armlt-staging-alt-open.img of=$SDCARD
Once you have the image 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 type the following in the CuteCom command prompt:
$ printenv $ setenv defaultdisplay lcd43 $ saveenv $ run mmcboot
After this you must reboot your system.
Connecting peripherals
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 trough 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 same network. Once you did 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. When the system loaded, type into CuteCom command prompt:
ifconfig -a (if you can't use this command from any reason you can get a list with all the ips on the network \ using 'arp -a')
Among the data returned, you will see something like this:
eth0 Link encap:Ethernet HWaddr 00:15:c9:28:c9:ff inet addr:169.16.29.3
Now enter into the command prompt:
sudo dhclient eth1 169.16.29.3
When this is done, install on the Gumstix openssh write into the command prompt:
sudo apt-get install openssh-server
Set a password:
sudo passwd username password (replace password with any string you want as password) password (retype the password you chose)
To add the user to the sudoers group do:
sudo adduser username sudo
Now you should be able to connect using:
ssh root@169.16.29.3
Tweaks
- Remove the login prompt.
You may want to set your OS to auto-login. Why? Because you may not have at any time a keyboard for the Gumstix around. It is explained here very well how to do it. You have to write in your command prompt:
sudo vi /etc/lightdm/lightdm.conf
and then modify the lines as indicated on the webpage above.
There is a chance to get an error like this "Gtk-WARNING **: Locale not supported by C library.". To solve this write into your command prompt:
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 here more about it.
- 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)
Install paparazzi on the gumstix
- Install all libraries needed
sudo apt-get install ocaml-findlib libxml-light-ocaml-dev liblablgtk2-ocaml-dev liblablgtk2-gnome-ocaml-dev \ libocamlnet-ocaml-dev libsdl-ocaml-dev libpcre-ocaml-dev gtk2-engines-pixbuf make gcc g++ libgsl0-dev gnuplot \ libgnomecanvas2-dev bzip2 git libusb-dev speech-dispatcher glade imagemagick libpcre3-dev git-core python-usb \ python-lxml python-wxgtk2.8 speech-dispatcher m4 python-yaml subversion cvs
- Create a folder where you will download and install all the libraries
mkdir develop cd develop/
- Install Ocaml 4.00.0
wget -O ocaml-4.00.0.tar.gz http://caml.inria.fr/pub/distrib/ocaml-4.00/ocaml-4.00.0.tar.gz tar -xvzf ocaml-4.00.0.tar.gz cd ocaml-4.00.0 ./configure make world make opt umask 022 sudo make install ocaml -version (make sure you have the right version, meaning 4.00.0) cd ..
- Install Opam
git clone https://github.com/OCamlPro/opam.git sudo opam install ocamlfind xml-light cd opam ./configure make (because of overheating you may get some errors, but keep doing 'make') sudo make install cd ..
- Install pcre-ocaml
Note: because the version at the moment I tried to install didn't work( pcre-ocaml 7.0.2), I used 6.2.5 version.
wget https://bitbucket.org/mmottl/pcre-ocaml/downloads/pcre-ocaml-6.2.5.tar.gz tar -xvzf pcre-ocaml-6.2.5.tar.gz cd pcre-ocaml-6.2.5 ./configure make sudo make install cd .. sudo opam install -v lablgtk sudo opam install xml-light sudo opam install pcre-ocaml sudo opam install -v ocamlnet
- Get paparazzi-portability-support related files
cd ~ git clone https://github.com/paparazzi/paparazzi-portability-support.git cd paparazzi-portability-support/linux/ sudo apt-get install libxt-dev tcl8.4-dev sudo apt-get install tcl-dev sudo apt-get install dpkg-dev debhelper devscripts fakeroot linda build-essential autoconf automake \ autotools-dev dh-make xutils lintian pbuilder dh-ocaml sudo ./develenv.sh cd ivy/ivy-c pkbuild cd ivy-c-3.12.1/ debuild -i -us -uc -b
- Install ivy-ocaml
cd ~/develop/ 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 ..
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
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
git clone git://github.com/paparazzi/paparazzi.git 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.
make sudo make install
Note: you may have to remove the files listed lower if you get any errors trying to install ivy-ocaml.
sudo rm /usr/local/lib/ocaml/glibIvy.cmi sudo rm /usr/local/lib/ocaml/glibivy-ocaml.* 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 sudo cp /usr/local/lib/ocaml/3.12.0/* /usr/local/lib/ocaml/ -r OCAMLFIND_CONF=/etc/ocamlfind.conf ocamlfind query export OCAMLFIND_CONF=/etc/ocamlfind.conf
!!!!Did not find these files !!!!
cp /home/sergiu/.opam/system/lib/findlib.conf /home/sergiu/.opam/system/lib/findlib.conf.old cp /etc/ocamlfind.conf /home/sergiu/.opam/system/lib/findlib.conf
!!!!!!!!
cd .. cvs -d:pserver:anonymous@cvs.motion-twin.com:/cvsroot co ocaml/xml-light wget http://tech.motion-twin.com/zip/xml-light-2.2.zip unzip xml-light-2.2.zip cd xml-light make sudo make install cd .. wget https://forge.ocamlcore.org/frs/download.php/545/ocaml-http-0.1.5.tar.gz --no-check-certificate tar -xzvf ocaml-http-0.1.5.tar.gz cd ocaml-http_0.1.5/ 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.
vim paparazzi/sw/lib/ocaml/Makefile sudo apt-get install python-xml libxml-light-ocaml-dev libxmlm-ocaml-dev libhttp-ocaml-dev
sudo apt-get remove libocamlnet-ocaml-bin opam remove ocamlnet (check where it was installed) sudo apt-get install htop 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 34 login 60 opam install ocamlnet 62 echo $DISPLAY 63 xterm 64 cd ~sergiu/paparazzi 65 ./paparazzi 67 vim pprz_src_test.sh 69 vim Makefile 70 vim sw/simulator/Makefile
Note: if you have problems with pprz_src_test.sh and/or Makefile and/or sw/simulator/Makefile, replace them with the respective files from the archive.
76 ./paparazzi 81 opam install ocamlnet 82 cd /root/.opam/system/build/ocamlnet.3.6.0/src/netstring 84 make 85 make installopt 86 make install 87 cd ../.. 91 make 92 make optinstall 95 make install 96 vim Makefile 98 cd .. 100 cd ocamlnet.3.6.0/src/netclient/ 101 make install 105 vim def build(self): 106 vim /root/.opam/system/lib/findlib.conf 108 vim /root/.opam/system/lib/findlib.conf 112 cd /opt/ 114 cp ~sergiu/.opam/system/ 115 cp -r ~/.opam ~sergiu/ 116 chown -R sergiu ~sergiu/.opam 117 mkdir opam_sw 118 opam opam config env
- Which is correct?
119 opam config env 120 opam config env --root 121 opam config env --root /opt/opam_sw/ 122 opam init --root /opt/opam_sw/ 126 opam config 127 opam list 130 cd opam_sw/ 132 diff . ~/.opam/ 133 diff -r . ~/.opam/ 134 diff -r ./system/ ~/.opam/system/ 135 cp -r ~/.opam/system/lib system/lib/ 136 cat ~/.bashrc 137 . /root/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true 143 cd ~sergiu/paparazzi 145 make 146 opam install xml-light 147 make 165 vim /root/.opam/system/lib/findlib.conf 166 cp -r /opt/opam_sw/system/lib/xml-light ~/.opam/system/lib/ 167 make 168 opam install glibivy 169 opam install glibivy2 174 cd /home/sergiu/develop/ivy-ocaml/ 178 make install 181 cd ~sergiu/paparazzi 185 opam install lablgtk 190 cp -r /opt/opam_sw/system/lib/lablgtk* ~/.opam/system/lib/ 193 apt-get install libgnomecanvas2-dev libgnomecanvas2-0 202 opam install lablgtk2.gnomeui 211 vim sw/lib/ocaml/META.pprz 214 mktemp 215 vim sw/supervision/Makefile 219 sudo apt-get install liblablgtk2-ocaml 221 export LD_LIBRARY_PATH=/usr/lib/ocaml/stublibs/:$LD_LIBRARY_PATH 223 apt-get install liblablgtk2-gnome-ocaml 224 make 235 export CAML_LD_LIBRARY_PATH=/root/.opam/system/lib/lablgtk2/:/root/.opam/system/lib/:$CAML_LD_LIBRARY_PATH 245 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 255 vim sw/ground_segment/multimon/Makefile 256 vim Makefile 257 make pprzcenter 258 make supervision 260 cd sw/supervision/ 261 make 262 export PPRZ_HOME=/home/sergiu/paparazzi/ 263 export PAPARAZZI_HOME=/home/sergiu/paparazzi/ 264 export PAPARAZZI_SRC=/home/sergiu/paparazzi/ 265 make supervision 267 vim Makefile 268 vim sw/ground_segment/multimon/Makefile 269 vim ../ground_segment/multimon/Makefile 271 make 272 vim Makefile 274 ./paparazzicenter 275 cd ../.. 279 cd sw/logalizer/ 280 vim Makefile 281 make 282 vim ../supervision/Makefile 285 vim Makefile 286 make 287 cd ../.. 292 vim sw/ground_segment/cockpit/Makefile 297 vim sw/ground_segment/multimon/Makefile 299 cd sw/ground_segment/multimon/ 300 make clean 301 make 302 cd ../../.. 306 vim sw/supervision/Makefile 307 vim sw/ground_segment/tmtc/Makefile 308 make 309 cd sw/ground_segment/tmtc/ 310 make clean 311 make 312 cd ../../.. 315 vim sw/simulator/Makefile 316 cd sw/simulator/mak 317 cd sw/simulator/ 318 make clean 319 make 320 cd ../.. 324 cd sw/ground_segment/joystick/ 332 cd ../tmtc/ 333 cd ../../tools/ 335 vim Makefile 336 make clean 337 cd ../ 339 cd ground_segment/joystick/ 340 make clean 341 make 346 cd ../../.. 349 vim Makefile 350 make 351 make ground_segment 353 X& 354 export DISPLAY=:0 355 xterm 356 ./papara 358 git status 359 sw/ground_segment/cockpit/gcs -b 192.168.209:2010 360 sw/ground_segment/cockpit/gcs 361 sw/ground_segment/cockpit/gcs -b 192.168.209:2010 362 mkdir /home/dirk 363 mkdir /home/dirk/nonSynced 365 ln -s /home/dirk/nonSynced/paparazzi /home/sergiu/paparazzi 366 ln -s /home/sergiu/paparazzi /home/dirk/nonSynced/paparazzi 367 sw/ground_segment/cockpit/gcs -b 192.168.209:2010
opam init . /home/sergiu/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true eval 'opam config env'
If you will get an error when trying to install pcre-ocaml 7.0.2 please follow these steps:
wget https://bitbucket.org/mmottl/pcre-ocaml/downloads/pcre-ocaml-6.2.5.tar.gz tar -xvzf pcre-ocaml-6.2.5.tar.gz cd pcre-ocaml-6.2.5 make sudo make install
Experimental steps
- Remove LightDM GUI to preserve Gumstix RAM
{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.