2024-10-16 09:13:46 -03:00
|
|
|
# Spiri SDK
|
2024-09-19 11:20:08 -03:00
|
|
|
|
2024-10-16 14:07:01 -03:00
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
## Overview
|
|
|
|
|
2024-09-19 11:20:08 -03:00
|
|
|
Spiri Robots run a number of docker containers to achieve their core functionality,
|
|
|
|
we try to keep these essential docker containers in one docker compose file. The
|
2024-09-19 11:37:02 -03:00
|
|
|
docker compose file you'll find in this repository starts an ardupilot-based UAV simulation
|
2024-10-16 09:13:46 -03:00
|
|
|
as well as a ROS master, and mavproxy to tie it together, mirroring the core deployment of
|
|
|
|
a spiri robot.
|
2024-09-19 11:20:08 -03:00
|
|
|
|
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
## Prerequisites
|
2024-09-19 11:20:08 -03:00
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
This SDK was tested using Ubuntu 22.04 and an Nvidia GPU.
|
2024-09-20 08:12:27 -03:00
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
UI features like 3D worlds (gazebo simulation) were tested with Nvidia GPUs using CDI passthrough.
|
|
|
|
Machine-learning features like image recognition are expected to only work with NVIDIA GPUs.
|
2024-10-16 09:13:46 -03:00
|
|
|
|
2024-10-16 12:55:18 -03:00
|
|
|
We use VSCode as the default IDE, and we use Copier to manage project templates.
|
2024-10-16 09:13:46 -03:00
|
|
|
|
2024-10-16 14:07:01 -03:00
|
|
|
### Ensure nvidia drivers are working
|
2024-10-16 14:01:31 -03:00
|
|
|
|
2024-10-16 14:07:01 -03:00
|
|
|
Ensuring nvidia drivers are installed is outside of the scope of
|
|
|
|
this document, but you can confirm they working are using the `nvidia-smi` command.
|
|
|
|
If the command is present and shows output relevent to your GPU, the drivers are installed.
|
2024-10-16 14:01:31 -03:00
|
|
|
|
|
|
|
You can find the official ubuntu documentation for install nvidia drivers [here](https://ubuntu.com/server/docs/nvidia-drivers-installation).
|
|
|
|
|
2024-10-16 14:07:01 -03:00
|
|
|
You can use the following command to let ubuntu try to install the appropriete drivers automatically:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo ubuntu-drivers install --gpgpu
|
|
|
|
```
|
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
### Installing Docker
|
2024-10-16 09:13:46 -03:00
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
As per the [official Docker documentation](https://docs.docker.com/engine/install/).
|
2024-10-16 09:13:46 -03:00
|
|
|
|
2024-10-16 12:55:18 -03:00
|
|
|
```bash
|
|
|
|
#Uninstall any older docker packages
|
|
|
|
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
|
|
|
|
|
|
|
|
# Add Docker's official GPG key:
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install ca-certificates curl
|
|
|
|
sudo install -m 0755 -d /etc/apt/keyrings
|
|
|
|
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
|
|
|
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
|
|
|
|
|
|
|
# Add the repository to Apt sources:
|
|
|
|
echo \
|
|
|
|
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
|
|
|
|
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
|
|
|
|
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
|
|
sudo apt-get update
|
|
|
|
|
|
|
|
#Install latest docker
|
|
|
|
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
|
|
|
|
|
|
|
#Allow current user to use docker without sudo
|
|
|
|
sudo groupadd docker
|
|
|
|
sudo usermod -aG docker $USER
|
|
|
|
#Reload the group
|
|
|
|
newgrp docker
|
|
|
|
```
|
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
### Installing Copier
|
2024-10-16 09:13:46 -03:00
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
As per the [official Copier documentation](https://copier.readthedocs.io/en/stable/#installation)
|
|
|
|
|
|
|
|
```bash
|
|
|
|
python3 -m pip install --user pipx
|
|
|
|
python3 -m pipx ensurepath
|
|
|
|
pipx install copier
|
|
|
|
```
|
|
|
|
|
|
|
|
### Installing VSCode
|
2024-10-16 09:13:46 -03:00
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
As per the [official VSCode documentation](https://code.visualstudio.com/docs/setup/linux)
|
2024-10-16 09:13:46 -03:00
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
```bash
|
|
|
|
sudo apt-get install wget gpg
|
|
|
|
wget https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64 -O /tmp/vscode.deb
|
|
|
|
sudo dpkg -i /tmp/vscode.deb
|
|
|
|
```
|
2024-10-16 09:13:46 -03:00
|
|
|
|
|
|
|
### Installing nvidia-container-toolkit
|
|
|
|
|
|
|
|
|
2024-10-16 12:55:18 -03:00
|
|
|
As per the [offical nvidia-container-toolkit guide](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html).
|
2024-10-16 09:13:46 -03:00
|
|
|
|
2024-10-16 12:55:18 -03:00
|
|
|
```bash
|
|
|
|
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
|
|
|
|
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
|
|
|
|
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
|
|
|
|
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y nvidia-container-toolkit
|
|
|
|
sudo nvidia-ctk runtime configure --runtime=docker
|
|
|
|
sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
|
|
|
|
nvidia-ctk cdi list
|
|
|
|
```
|
2024-10-16 09:13:46 -03:00
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
## Quickstart
|
|
|
|
|
|
|
|
To get started you can simply clone this repository and run `docker compose --profile uav-sim up`.
|
|
|
|
|
|
|
|
Once the simulated UAV is running you can connect to it with QGroundControl or other
|
|
|
|
MavLink compatible software. We expose the UAVs Mavlink conenction on tcp port 5760.
|
|
|
|
|
|
|
|
There is experimental GUI support you can enable by running `docker compose --profile uav-sim --profile ui up`.
|
2024-10-16 09:13:46 -03:00
|
|
|
|
2024-10-16 11:47:57 -03:00
|
|
|
### Creating a new project
|
2024-09-19 11:20:08 -03:00
|
|
|
|
|
|
|
We provide project templates you can use for development that integrate seamlessly into
|
|
|
|
our simulated robots.
|
|
|
|
|
2024-09-19 11:37:02 -03:00
|
|
|
These templates are intended to be used with VSCode.
|
|
|
|
|
2024-09-19 11:20:08 -03:00
|
|
|
To get started with our project templates install the [copier](https://copier.readthedocs.io/en/stable/) project
|
|
|
|
templating utility.
|
|
|
|
|
|
|
|
* [template-service-ros1-catkin](https://git.spirirobotics.com/Spiri/template-service-ros1-catkin)
|
|
|
|
|
|
|
|
This template uses the last stable release of ROS1 (ros noetic) and supports python and c++ programming
|
|
|
|
languages.
|
|
|
|
|
|
|
|
ROS1 is considered end of life. It's recomended to use a ROS2 template instead
|
|
|
|
|
|
|
|
* ROS2 template
|
|
|
|
|
|
|
|
We're working on it...
|
2024-10-16 12:55:18 -03:00
|
|
|
|
|
|
|
|
|
|
|
|