=====Getting started with DUNE, Neptus and Git=====
==== Prerequisites ====
You need to use a Linux computer. I prefer Linux Mint on a Dual boot computer, but a virtual computer is also an alternative.
In your linux terminal, you need to get some basic tools. (The commands are for debian-based distros like Ubuntu)
sudo apt-get install build-essential
sudo apt-get install eclipse eclipse-cdt g++ gcc openjdk-8-jdk
sudo apt-get install git cmake
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get install oracle-java8-installer
sudo apt-get update
==== DUNE ====
All code and shared files are placed on a gitlab repository. You can find it here: [[https://gitlab.com/aurlab|AURlab Git]]. To get the code yourself, you clone it into your chosen folder.
mkdir aurlab
cd aurlab
git clone https://gitlab.com/aurlab/lsts_toolchain/dune.git
cd dune
mkdir build
cd build
cmake ../dune
make -j8
Now, to import the project to Eclipse, open Eclipse for C++. Press //file//->//import//->//general//->//Existing Projects into Workspace//.Select root directory: //uavlab/build//. Now a project will appear in the box for projects, named DUNE-Release. Press //Finish//, and the project appears in your Project Explorer.
To find out more about DUNE, read [[https://lsts.fe.up.pt/toolchain/dune|LSTS Toolchain/Dune]]
==== Neptus ====
Now, clone and build Neptus.
cd aurlab
git clone https://gitlab.com/aurlab/lsts_toolchain/neptus.git
cd neptus
ant
When it is build, you can open Neptus by typing
./neptus
Once Neptus is opened, to see your vehicle, you click //Consoles/Open// and choose //ntnu/fixed-wind.ncon// or another if you're not working on a fixed-wing vehicle.
==== Working with DUNE ====
To start DUNE, you need to choose a configuration file (that is, a .ini-file). These files are placed under the // /etc//-folder. Before you write anything in DUNE, make sure you make your own //branch//. This is your own git version of the code, read more on [[dev:git|Developing with GiT]].
cd aurlab
cd dune
git checkout -b feature/your_descriptive_branch_name
Now you should have moved to your own branch. Every time you make something new on your branch, or do some major updates (minimum once a day), you should commit your changes.
You should have your own config file, and you make it by right-clicking on the // /etc//-folder and choose //new//->//File//. Name your file //name.ini//. In your config file you can include the tasks that you need to run, and specify the parameters for each task.
To run DUNE using your specific config file, you write
cd build
cmake ../dune
./dune -c name.ini
To [[dune:debugging_with_gdb|compile with debugging symbols for GDB]], add the flag `-DDEBUG=true` to cmake. To compile [[dune:unit_testing|the unit tests]], add `-DTESTS=true`.
It is also possible to see the available cmake flags and change their values in a simple GUI by running ''%%ccmake ../dune%%'' in the build directory (requires ''%%sudo apt-get install cmake-curses-gui%%'').
A lot of the tasks are specified to work either in //Hardware// or in //AP-SIL// or simulation mode. Then, you write
./dune -c name.ini -p Hardware
or, of course, //AP-SIL// instead of //Hardware//.
When DUNE starts running, the messages you get tell you which tasks are starting, and whether there are any warnings or errors.
To make your own task, type
cd dune/user
python ../programs/scripts/dune-create-task.py . "Your Name" Your/Task/name
To make sure your new tasks or files are compiled, type in your terminal:
make rebuild_cache
It could be wise to follow the tutorial on [[https://github.com/LSTS/dune/wiki|LSTS Dune Tutorials]]. The tasks communicate using IMC Messages. Read more about them on [[software:imc|IMC]]. To make debugging easier, you can code your printouts as //err//, //war//, //inf// and //cri//:
war("This is a warning message. You don't need any endline.");
You can also use the debug symbols //debug//, //trace// and //spew//.
==== Cross-compiling dune ====
To be able to use dune on an on-board platform, you need to cross-compile it and have a version of Glued on your on-board computer. See [[software:glued|Glued]] for description of how this is done.