# Installation of AIM 2024 software stack

To run Gazebo you will need an Ubuntu Linux (22.04) environment. You can run the Ubuntu as a native OS or as a virtual machine. Recommended specs for running the Gazebo simulation environment are as follows:

| Component       | Amount                                   |
| --------------- | ---------------------------------------- |
| Processor       | Any modern quad-core processor or better |
| RAM             | 8GB of RAM or better                     |
| Hard Disk Space | \~20GB of space (SSD recommended)        |

## Installation of Ubuntu 22.04

#### Notice

{% hint style="warning" %}
It is advised to have a steady internet collection and system to be plugged onto power as installation and setting up the setup will take a long time to finish. We also advise you to perform this installation on a clean Ubuntu 22.04 installation.
{% endhint %}

#### Steps for Ubuntu 22.04 setup

Steps to setup ubuntu are described in the attached PPT below. Both methods for dual boot and only ubuntu BIOS are mentioned below:

{% file src="<https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-6a4ae1e63f4c7197dd456bada5186f7a89fad9a2%2FAIM_installation_guide.pptx?alt=media>" %}
Ubuntu 22.04 installation
{% endfile %}

{% hint style="danger" %}
The slides are made in reference for ubuntu ver 20.04, but same steps apply for latest versions as well.
{% endhint %}

## Setting up SSH keys

{% hint style="info" %}
To use NXP Gazebo, you will need to have a GitHub account. The installation scripts require a GitHub account with an SSH key.
{% endhint %}

#### Creating an SSH key

To create an SSH key, run the following in a terminal:

```
$ ssh-keygen
```

Follow the prompt. We suggest just pressing enter until you reach the end. It will be easier if you just use the default path for the id\_rsa file and if you go without a passphrase (though you're welcome to use one!). You should get the output below. Note that the RSA key is not shown here for security reasons:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-08787d9015daffdf17a8146cc99acc06804f807f%2Fimage.png?alt=media)

Next, you'll want to install `xclip`. This program will allow you to copy the contents of the id\_rsa.pub file to your clipboard so you can paste it into GitHub. To install `xclip`, run the following command:

```
$ sudo apt install xclip git
```

Once you've installed xclip, you need to copy the id\_rsa.pub file to your clipboard. To do so, run the following command:

```
$ xclip -sel clip < ~/.ssh/id_rsa.pub
```

#### Adding your SSH key to GitHub

Now, log into your GitHub account and paste your SSH key. The SSH key field is located in your account settings under "SSH and GPG keys". Add a new SSH key by pressing "New SSH key" and pasting your SSH key in the box. Make sure to give it a name!

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-c463671daa9214db5060acba53da20023d0b03bf%2Fssh_key_gen.PNG?alt=media)

Once you've done this, you're ready to begin the installation.

## Installing the Setup

Install the following package which contains a python installation script to be used in next steps.

{% hint style="danger" %}
Please make sure you are using the updated installer, uploaded on 15th July,2024 (10 PM IST).
{% endhint %}

{% file src="<https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-40aca44e2f75677370952848f2cc1f27f4b4e4e8%2FAIM_S3_Installation_FINAL.zip?alt=media>" %}
AIM 2024 installation setup (updated)
{% endfile %}

#### Python version check

You can check your python version by using the following command:

```
$ python3 --version
```

The output should be something like this:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-61080ee6b9dbc070064bd30938d3b76549345549%2Fpic1.PNG?alt=media)

If python version is 3.11 or greater than 3.11, make sure to run the following command:

```
$ sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED
```

(Note: Replace the python3.11 with you installed version. For example, if your installed version is 3.12.06, the you should write python3.12)

### Running the Installation Script

To run the installation script follow the steps below:

1. Install streamlit

```
$ sudo pip install streamlit
```

2. Navigate to the folder where you have downloaded the installation script
3. Run the following command

```
$ streamlit run AIM_S3_Install_Script.py
```

On running this command, if it asks for your email, you can skip that by just pressing enter. After that the following should be opened on your default browser:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-6707386688070d87a9c6d2ace978af1b791bd8ee%2Fpic2.PNG?alt=media)

{% hint style="info" %}
If the above page does not open on its own, you can go to your default web browser and paste this:
{% endhint %}

```
$ localhost:8051
```

4. Enter your device usename and password ![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-40aa3b83848be531795069024f2b2fb95892e372%2Fpassword.PNG?alt=media)

{% hint style="warning" %}
Make sure to check that username and password have been entered before executing any SET
{% endhint %}

#### Step-1

Execute SET 1 commands by pressing the **Sart Installation (SET 1)** button Wait for the script to run. After the script has been run, the following can be seen:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-944d3358ec1f0fa1f10888a893755c0d443391c3%2Fstep1.PNG?alt=media)

The progress and the outcome can also be verified from the terminal on which you ran the ‘streamlit run …’ command. The output will be something like:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-d70e2feadd3cb309db1c0c9c9a51fbdb72f93844%2Fstep1.png?alt=media)

\*\* After runing SET 1, please restart your device. \*\*

{% hint style="warning" %}
If SET 1 fails, you can manually follow SET 1 steps from this link: <https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html>
{% endhint %}

#### Step-2

Now, after restart, again go the directory where you downloaded the installation script and run the **‘streamlit run …’** command again. Now the **Start Installation (SET 2)** button should be enabled

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-944d3358ec1f0fa1f10888a893755c0d443391c3%2Fstep1.PNG?alt=media)

Once again enter your username and password and press the **Start Installation (SET 2)** button. Now wait for some time till the commands ran successfully message pops up

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-dd34350e0cf97a43535e9d591b834a6eb774ca5f%2Fstep3.PNG?alt=media)

Now wait for a pop-up terminal window to open… **Enter 1, to choose the airy release**

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-34e58a5e297148aebf24106057d0ed79619f23b9%2Fstep3_airy.PNG?alt=media)

**Again Enter 1, to choose native installer**

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-5b80148912bc6cf76ab13940048ee552dccfc621%2Fstep3_native.PNG?alt=media)

**Enter your device password**

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-f7f1617ae5a711563259c9032224b2b3d49307d3%2Fstep3_password.PNG?alt=media)

**Enter y, when asked to clone repositories with git using already setup github ssh keys**

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-669e794eea103b82b4ab562ee93ca22938abcf88%2Fstep3_y.PNG?alt=media)

**Enter yes, when asked if you are sure you want to continue connecting**

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-c0d233170589dfe53b732d9a6d35ba812389b320%2Fstep3_y2.PNG?alt=media)

This will take some time to download and install. After successfully running, the terminal will automatically close and you will be notified with following on main terminal:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-bbedba8d09b58fe4dc16428613b1c9d9d9784914%2Fstep2.png?alt=media)

Now run the following command in a seperate terminal:

```
$ source ~/.bashrc
```

{% hint style="info" %}
After successful Installation there should be a folder named cognipilot in the home directory and the \~/cognipilot/ directory should look like this:
{% endhint %}

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-8b65f1583c4f62e2aa39a09b1ef2af52874d4528%2Fstep3_folder.PNG?alt=media)

**Now please restart your device.**

#### Step-3

Now the **Start Installation (SET 3)** button should be enabled

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-dd34350e0cf97a43535e9d591b834a6eb774ca5f%2Fstep3.PNG?alt=media)

Once again enter your username and password and press the **Start Installation (SET 3)** button. Now wait for some time till the commands ran successfully message pops up. \_***This may take some time (upto 10 mins) depending on your device configurations.***

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-e544a88b25f3ff9098a41b48b30e42921341ce1c%2Fstep3_1.png?alt=media)

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-4dc0a788559375e2da4852d783616d18e35a0550%2Fstep3_2.png?alt=media)

{% hint style="info" %}
After running SET 3, the directory structure inside the \~/cognipilot/ folder should look like the following:
{% endhint %}

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-1ddd15d702062b8558b470ae45c7347310c89e55%2Fstep3_last_dic.PNG?alt=media)

{% hint style="warning" %}
If SET 3 fails multiple times, or if the directory structure does not resemble the picture above, restart your device and run the following command on terminal after restart:
{% endhint %}

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-1ddd15d702062b8558b470ae45c7347310c89e55%2Fstep3_last_dic.PNG?alt=media)

```
$ cd ~/cognipilot
$ build_workspace
```

**Now please restart your device.**

#### Step-4

Now the **Start Installation (SET 4)** button should be enabled.

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-82af7dc8ea498085e4625a27eb39136b40742e83%2Fstep4.PNG?alt=media)

Once again enter your username and password and press the **Start Installation (SET 4)** button. Now wait for some time till the commands ran successfully message pops up:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-38a9bfd7c4eff6f82caa92fd32388aa3a15c4340%2Fstep4.png?alt=media)

**Now please restart your device.**

#### Step-5

1. Download the file from the following link:

<https://396338415-files.gitbook.io/\\~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FU93yDWZcgjXGgsC1Duqv%2Fuploads%2FlOvM24532lSgdGTQmH49%2Fupdate\\_repos\\_native.sh?alt=media\\&token=dce08eda-26f1-440e-8ca7-cf8ac297b1d4>

2. Rename the file as: ***update\_repos\_native.sh***
3. Save the file in the following directory: \_***\~/cognipilot/***
4. Run the following commands in a new terminal

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-f9658d6944da21710179553d9f51c087112147b5%2Fstep5_1.png?alt=media)

```
$ cd ~/cognipilot
$ chmod +x update_repos_native.sh
$ ./update_repos_native.sh
```

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-8876d7808485af28a29f3abd5faed1c7fd9bd4da%2Fstep5_2.png?alt=media)

Close this terminal and now run SET 5 of installation script, which should be enabled now:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-4cf6d1c2edbcb89edbbd157064db9271ad05a011%2Fstep5.PNG?alt=media)

Once again enter your username and password and press the **Start Installation (SET 5)** button. Now wait for some time till the commands ran successfully message pops up.This may take some time (upto 10 mins) depending on your device configurations.

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-a42d28d83078a0cb854e0d44f3415f823cbeebf9%2Fstep5_3.png?alt=media)

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-67965f1bcdd7e87cd04f119ae531ec08cf52446e%2Fstep5_4.png?alt=media)

**Now please restart your device.**

#### Step-6

Now the **Start Installation (SET 6)** button should be enabled.

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-6d10598648ed835b3d66eb4b5fae4a48aba12140%2Fstep6.PNG?alt=media)

Once again enter your username and password and press the Start Installation (SET 6) button. Now wait for some time till the commands ran successfully message pops up:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-61279ef56dd7efd83f0f552a66a85aeca0c78d4b%2Fstepdone.PNG?alt=media)

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-e1d23d3cde4e60970d62319fd2c9e5b21fe92797%2Fstep6_1.png?alt=media)

\_***Congratulations, you are done with the Install and Setup!***

### Troubleshooting after final step of installation

If you are getting a similar error message at the end of step-6:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-e1d23d3cde4e60970d62319fd2c9e5b21fe92797%2Fstep6_1.png?alt=media)

It means that there was some error in one of the modules. To rectify this follow the following steps: Run the following command in a new terminal:

```
$ cd ~/cognipilot/cranium
$ colcon build
```

You will get a similar output as follows:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-5981bff2c199d68fbf78715a72bf5797d799abf8%2Fstep6_troubleshoot_1.png?alt=media)

Over here you can see that there was a error in synapse\_ros , Identify where all error is coming in your case in a similar way. Now run the following commands in the folder where the error is identified. For example for \_*synapse\_ros* error as above, we need to run the following command in the \_*\~/cognipilot/cranium/src/synapse\_ros/*

```
$ cd ~/cognipilot/cranium/src/synapse_ros/
$ git checkout
```

The branch should be **airy**. If it is any other branch (like in the image below):

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-f88e69461ec1d58f51d0ce4f2f89aaca62599f68%2Fgit_checkout.PNG?alt=media)

Run the following command to change the branch:

```
$ git checkout airy
$ git pull
```

Output should be as follows:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-1ecd39f2809a0480571eaa897efdfc6a1cf5e07b%2Fgit_pull.PNG?alt=media)

After doing the above steps for all the nodes that had error, run the following command:

```
$ cd ~/cognipilot/cranium
$ colcon build
```

Now you should get the following output:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-f9cbb91e69aa6e2bac64a9a3a3e251d525d1700e%2Fbuild_success.PNG?alt=media)

And a similar popup should appear:

![](https://1677675178-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWeiLnwrIKZJWLFsXhf%2Fuploads%2Fgit-blob-3d51dff84cf9018ae20a9ce5c089c6db2d7e2776%2Fcolcon_build_pass.PNG?alt=media)

***Now you are ready to run the simulation.***
