spiri-sdk/index.html

251 lines
16 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome to spiri-sdks documentation! &mdash; spiri-sdk documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="_static/custom.css?v=dafc64e6" />
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="#" class="icon icon-home">
spiri-sdk
<img src="_static/SPIRI_STLockup_Mixed_RGB.png" class="logo" alt="Logo"/>
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<!-- Local TOC -->
<div class="local-toc"><ul>
<li><a class="reference internal" href="#">Welcome to spiri-sdks documentation!</a><ul>
<li><a class="reference internal" href="#spiri-sdk">Spiri SDK</a><ul>
<li><a class="reference internal" href="#overview">Overview</a></li>
<li><a class="reference internal" href="#prerequisites">Prerequisites</a><ul>
<li><a class="reference internal" href="#ensure-nvidia-drivers-are-working">Ensure nvidia drivers are working</a></li>
<li><a class="reference internal" href="#installing-docker">Installing Docker</a></li>
<li><a class="reference internal" href="#installing-copier">Installing Copier</a></li>
<li><a class="reference internal" href="#installing-vscode">Installing VSCode</a></li>
<li><a class="reference internal" href="#installing-nvidia-container-toolkit">Installing nvidia-container-toolkit</a></li>
</ul>
</li>
<li><a class="reference internal" href="#quickstart">Quickstart</a><ul>
<li><a class="reference internal" href="#creating-a-new-project">Creating a new project</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
</ul>
</div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="#">spiri-sdk</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="#" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">Welcome to spiri-sdks documentation!</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="welcome-to-spiri-sdk-s-documentation">
<h1>Welcome to spiri-sdks documentation!<a class="headerlink" href="#welcome-to-spiri-sdk-s-documentation" title="Link to this heading"></a></h1>
<div class="toctree-wrapper compound">
</div>
<section id="spiri-sdk">
<h2>Spiri SDK<a class="headerlink" href="#spiri-sdk" title="Link to this heading"></a></h2>
<section id="overview">
<h3>Overview<a class="headerlink" href="#overview" title="Link to this heading"></a></h3>
<p>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
docker compose file youll find in this repository starts an ardupilot-based UAV simulation
as well as a ROS master, and mavproxy to tie it together, mirroring the core deployment of
a spiri robot.</p>
</section>
<section id="prerequisites">
<h3>Prerequisites<a class="headerlink" href="#prerequisites" title="Link to this heading"></a></h3>
<p>This SDK was tested using Ubuntu 22.04 and an Nvidia GPU.</p>
<p>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.</p>
<p>We use VSCode as the default IDE, and we use Copier to manage project templates.</p>
<section id="ensure-nvidia-drivers-are-working">
<h4>Ensure nvidia drivers are working<a class="headerlink" href="#ensure-nvidia-drivers-are-working" title="Link to this heading"></a></h4>
<p>Ensuring nvidia drivers are installed is outside of the scope of
this document, but you can confirm they working are using the <code class="docutils literal notranslate"><span class="pre">nvidia-smi</span></code> command.
If the command is present and shows output relevent to your GPU, the drivers are installed.</p>
<p>You can find the official ubuntu documentation for install nvidia drivers <a class="reference external" href="https://ubuntu.com/server/docs/nvidia-drivers-installation">here</a>.</p>
<p>You can use the following command to let ubuntu try to install the appropriete drivers automatically:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>ubuntu-drivers<span class="w"> </span>install<span class="w"> </span>--gpgpu
</pre></div>
</div>
</section>
<section id="installing-docker">
<h4>Installing Docker<a class="headerlink" href="#installing-docker" title="Link to this heading"></a></h4>
<p>As per the <a class="reference external" href="https://docs.docker.com/engine/install/">official Docker documentation</a>.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1">#Uninstall any older docker packages</span>
<span class="k">for</span><span class="w"> </span>pkg<span class="w"> </span><span class="k">in</span><span class="w"> </span>docker.io<span class="w"> </span>docker-doc<span class="w"> </span>docker-compose<span class="w"> </span>docker-compose-v2<span class="w"> </span>podman-docker<span class="w"> </span>containerd<span class="w"> </span>runc<span class="p">;</span><span class="w"> </span><span class="k">do</span><span class="w"> </span>sudo<span class="w"> </span>apt-get<span class="w"> </span>remove<span class="w"> </span><span class="nv">$pkg</span><span class="p">;</span><span class="w"> </span><span class="k">done</span>
<span class="c1"># Add Docker&#39;s official GPG key:</span>
sudo<span class="w"> </span>apt-get<span class="w"> </span>update
sudo<span class="w"> </span>apt-get<span class="w"> </span>install<span class="w"> </span>ca-certificates<span class="w"> </span>curl
sudo<span class="w"> </span>install<span class="w"> </span>-m<span class="w"> </span><span class="m">0755</span><span class="w"> </span>-d<span class="w"> </span>/etc/apt/keyrings
sudo<span class="w"> </span>curl<span class="w"> </span>-fsSL<span class="w"> </span>https://download.docker.com/linux/ubuntu/gpg<span class="w"> </span>-o<span class="w"> </span>/etc/apt/keyrings/docker.asc
sudo<span class="w"> </span>chmod<span class="w"> </span>a+r<span class="w"> </span>/etc/apt/keyrings/docker.asc
<span class="c1"># Add the repository to Apt sources:</span>
<span class="nb">echo</span><span class="w"> </span><span class="se">\</span>
<span class="w"> </span><span class="s2">&quot;deb [arch=</span><span class="k">$(</span>dpkg<span class="w"> </span>--print-architecture<span class="k">)</span><span class="s2"> signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \</span>
<span class="s2"> </span><span class="k">$(</span>.<span class="w"> </span>/etc/os-release<span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$VERSION_CODENAME</span><span class="s2">&quot;</span><span class="k">)</span><span class="s2"> stable&quot;</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="se">\</span>
<span class="w"> </span>sudo<span class="w"> </span>tee<span class="w"> </span>/etc/apt/sources.list.d/docker.list<span class="w"> </span>&gt;<span class="w"> </span>/dev/null
sudo<span class="w"> </span>apt-get<span class="w"> </span>update
<span class="c1">#Install latest docker</span>
sudo<span class="w"> </span>apt-get<span class="w"> </span>install<span class="w"> </span>docker-ce<span class="w"> </span>docker-ce-cli<span class="w"> </span>containerd.io<span class="w"> </span>docker-buildx-plugin<span class="w"> </span>docker-compose-plugin
<span class="c1">#Allow current user to use docker without sudo</span>
sudo<span class="w"> </span>groupadd<span class="w"> </span>docker
sudo<span class="w"> </span>usermod<span class="w"> </span>-aG<span class="w"> </span>docker<span class="w"> </span><span class="nv">$USER</span>
<span class="c1">#Reload the group</span>
newgrp<span class="w"> </span>docker
</pre></div>
</div>
</section>
<section id="installing-copier">
<h4>Installing Copier<a class="headerlink" href="#installing-copier" title="Link to this heading"></a></h4>
<p>As per the <a class="reference external" href="https://copier.readthedocs.io/en/stable/#installation">official Copier documentation</a></p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python3<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>--user<span class="w"> </span>pipx
python3<span class="w"> </span>-m<span class="w"> </span>pipx<span class="w"> </span>ensurepath
pipx<span class="w"> </span>install<span class="w"> </span>copier
</pre></div>
</div>
</section>
<section id="installing-vscode">
<h4>Installing VSCode<a class="headerlink" href="#installing-vscode" title="Link to this heading"></a></h4>
<p>As per the <a class="reference external" href="https://code.visualstudio.com/docs/setup/linux">official VSCode documentation</a></p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>sudo<span class="w"> </span>apt-get<span class="w"> </span>install<span class="w"> </span>wget<span class="w"> </span>gpg
wget<span class="w"> </span>https://code.visualstudio.com/sha/download?build<span class="o">=</span>stable<span class="p">&amp;</span><span class="nv">os</span><span class="o">=</span>linux-deb-x64<span class="w"> </span>-O<span class="w"> </span>/tmp/vscode.deb
sudo<span class="w"> </span>dpkg<span class="w"> </span>-i<span class="w"> </span>/tmp/vscode.deb
</pre></div>
</div>
</section>
<section id="installing-nvidia-container-toolkit">
<h4>Installing nvidia-container-toolkit<a class="headerlink" href="#installing-nvidia-container-toolkit" title="Link to this heading"></a></h4>
<p>As per the <a class="reference external" href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html">offical nvidia-container-toolkit guide</a>.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>curl<span class="w"> </span>-fsSL<span class="w"> </span>https://nvidia.github.io/libnvidia-container/gpgkey<span class="w"> </span><span class="p">|</span><span class="w"> </span>sudo<span class="w"> </span>gpg<span class="w"> </span>--dearmor<span class="w"> </span>-o<span class="w"> </span>/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg<span class="w"> </span><span class="se">\</span>
<span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span>curl<span class="w"> </span>-s<span class="w"> </span>-L<span class="w"> </span>https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list<span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="se">\</span>
<span class="w"> </span>sed<span class="w"> </span><span class="s1">&#39;s#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g&#39;</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="se">\</span>
<span class="w"> </span>sudo<span class="w"> </span>tee<span class="w"> </span>/etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo<span class="w"> </span>apt-get<span class="w"> </span>update
sudo<span class="w"> </span>apt-get<span class="w"> </span>install<span class="w"> </span>-y<span class="w"> </span>nvidia-container-toolkit
sudo<span class="w"> </span>nvidia-ctk<span class="w"> </span>runtime<span class="w"> </span>configure<span class="w"> </span>--runtime<span class="o">=</span>docker
sudo<span class="w"> </span>nvidia-ctk<span class="w"> </span>cdi<span class="w"> </span>generate<span class="w"> </span>--output<span class="o">=</span>/etc/cdi/nvidia.yaml
nvidia-ctk<span class="w"> </span>cdi<span class="w"> </span>list
</pre></div>
</div>
</section>
</section>
<section id="quickstart">
<h3>Quickstart<a class="headerlink" href="#quickstart" title="Link to this heading"></a></h3>
<p>To get started you can simply clone this repository and run <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">compose</span> <span class="pre">--profile</span> <span class="pre">uav-sim</span> <span class="pre">up</span></code>.</p>
<p>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.</p>
<p>There is experimental GUI support you can enable by running <code class="docutils literal notranslate"><span class="pre">docker</span> <span class="pre">compose</span> <span class="pre">--profile</span> <span class="pre">uav-sim</span> <span class="pre">--profile</span> <span class="pre">ui</span> <span class="pre">up</span></code>.</p>
<section id="creating-a-new-project">
<h4>Creating a new project<a class="headerlink" href="#creating-a-new-project" title="Link to this heading"></a></h4>
<p>We provide project templates you can use for development that integrate seamlessly into
our simulated robots.</p>
<p>These templates are intended to be used with VSCode.</p>
<p>To get started with our project templates install the <a class="reference external" href="https://copier.readthedocs.io/en/stable/">copier</a> project
templating utility.</p>
<ul class="simple">
<li><p><a class="reference external" href="https://git.spirirobotics.com/Spiri/template-service-ros1-catkin">template-service-ros1-catkin</a></p></li>
</ul>
<p>This template uses the last stable release of ROS1 (ros noetic) and supports python and c++ programming
languages.</p>
<p>ROS1 is considered end of life. Its recomended to use a ROS2 template instead</p>
<ul class="simple">
<li><p>ROS2 template</p></li>
</ul>
<p>Were working on it…</p>
</section>
</section>
</section>
</section>
<section id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Link to this heading"></a></h1>
<ul class="simple">
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li>
<li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li>
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li>
</ul>
</section>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2024, Spiri Robotics.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>