Introduction

If you want to install COSMOS without using the development environment, you can always install COSMOS from scratch.

Dependencies

COSMOS depends on Git, CMake 2.8.12+ and Build Essential to function.

  • Git
    • A version control manager that COSMOS depends on.
  • CMake 2.8.12+
    • A cross-platform set of tools that packages COSMOS code and compiles it.
  • Build essential
    • Compilers (gcc, g++ and their dependencies) that builds COSMOS code.

First you should make sure that you have all the dependencies you need by running the following in a terminal window:

$ sudo apt update && sudo apt upgrade -y
$ sudo apt-get install git cmake build-essential -y

Clone COSMOS Core

Clone the installer script:

$ git clone https://github.com/hsfl/cosmos-installer.git ~/cosmos

Run the installer script:

$ cd ~/cosmos
$ ./cosmos-install.sh

Switch to the Dev Branch

There are many changes present in the COSMOS Core dev branch that are not present in the master branch. To get the newest changes, switch to the dev branch:

$ cd ~/cosmos/source/core
$ git checkout dev
$ git fetch

Build COSMOS Core with Qt Creator

Install Qt

For Qt Installation process, follow these instructions.

In Qt Creator, click on File > Open File or Project..., and open up the file ~/cosmos/source/core/CMakeLists.txt.

TODO: a project configuration dialog might show up?

Once the project is finished loading, click the Projects button on the left side of the window, and then click on Desktop, and then click on Build under it.

Make sure the build directory looks something like:

/home/YOUR_USERNAME/cosmos/source/core/build-core-Desktop-Debug

Now you can press CTRL + B (or the hammer icon at the bottom left) to build the project. This can take a while.

All of the executables are now located in the build directory from above. They are nested in a bunch of different folders, but we need to put them together all in the same folder. To do so, run the following command in a terminal (replacing YOUR_USERNAME with your username):

$ cd /home/YOUR_USERNAME/cosmos/source/core/build-core-Desktop-Debug
$ mkdir bin
$ find ./ -perm /a+x -exec cp {} bin \;

Now you can copy the contents of the /home/YOUR_USERNAME/cosmos/source/core/build-core-Desktop-Debug/bin folder to the /home/YOUR_USERNAME/cosmos/bin folder. There will be a bunch of files already in the destination folder, but you can remove the old ones (those are from the master branch).

Testing COSMOS

  1. Navigate to the “Projects” tab on the left menu.
  2. Under “Build & Run” on the left menu, click the “Run” under the same kit you built with.
  3. Under the Run category, select agent_001 under the run configuration. To run it, press Ctrl + R.
  4. Now select agent_002 under the run configuration. Again, press Ctrl + R to run it.

The agents should now be talking to each other. This illustrates the interconnectivity aspect of COSMOS and its ability to piece together heterogeneous systems.

Build COSMOS Core on the Command Line

Build COSMOS Core

To build COSMOS, open a terminal and type:

$ cd ~/cosmos/source/core/build
$ mkdir linux
$ ./do_cmake linux
$ cd linux
$ make -j
$ make -j install

Testing COSMOS

Let's test the installation of COSMOS Run the following commands in a terminal:

$ cd ~/cosmos/bin
$ ./agent_002

In another terminal, run:

$ cd ~/cosmos/bin
$ ./agent_001

The agents should now be talking to each other. This illustrates the interconnectivity aspect of COSMOS and its ability to piece together heterogeneous systems.

Add COSMOS to PATH

A path allows easy access to executable programs. Through this method, you will be able to run agents globally; simply add the cosmos/bin folder to the path. Enter into the terminal:

$ nano ~/.bashrc

This will open up the file containing the directories the shell looks for programs in. Now, add the following line to the bottom of the file:

export PATH="$HOME/cosmos/bin:$PATH"

After you've added that line, press CTRL + S to save the file, and then CTRL + X to exit.

Next, close the terminal window and open up a new one to reload the PATH. You should be able to run the following command to see the usage of the program:

$ agent

See Also

Tags: