DEV Community

kazogihara
kazogihara

Posted on

How to run Skybrush with SITL on Windows

Prerequisites

Conceptual scheme

Image description

Setup Linux Distro

1.Install VSCode Extension

  • Open VSCode, search WSL extension from marketplace and install

Image description

2.Setup Ubuntu22.04

  • Create Distor from VSCode

Image description

Image description

Image description

Image description

  • Type Username and Password

Image description

3.Back to VSCode and connect to Ubuntu

  • Select Ubuntu22.04 from Connect to WSL using Distro...

Image description

  • If you see WSL:Ubuntu-22.04 at left-bottom corner, you successfully connect to it.

Image description

4.Update and Upgrade Registry

  • Popup console using ctrl + j

Image description

  • Update and Upgrade Registry
sudo apt update && sudo apt upgrade
Enter fullscreen mode Exit fullscreen mode

Build Python3.11

1.Follow below commands and build python.

sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
wget https://www.python.org/ftp/python/3.11.3/Python-3.11.3.tgz
tar -xzvf Python-3.11.3.tgz
cd Python-3.11.3
./configure --enable-optimizations
make -j 12
sudo make altinstall
sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.11 1
Enter fullscreen mode Exit fullscreen mode

2.Check if you can see the version of python is 3.11.

skybrush@MyComputer:~/Python-3.11.3$ python --version
Python 3.11.3
Enter fullscreen mode Exit fullscreen mode

Install Poetry

1.install poetry using pip3.

sudo apt install python3-pip
pip3 install poetry

Enter fullscreen mode Exit fullscreen mode

Build skybrush server

1.Clone source code and install using poetry.

git clone https://github.com/skybrush-io/skybrush-server.git
cd ~/skybrush-server/
python3 -m poetry install
Enter fullscreen mode Exit fullscreen mode

2.Launch skybrush server

python3 -m poetry run skybrushd -c etc/conf/skybrush-outdoor.jsonc
Enter fullscreen mode Exit fullscreen mode
  • If you correctly launch it, the result will be like below.
skybrush@MyComputer:~/skybrush-server$ python3 -m poetry run skybrushd -c etc/conf/skybrush-outdoor.jsonc
[13:32:13]   server                 Starting Skybrush server 2.15.0
           ✔ skybrush               Loaded configuration from '/home/skybrush/skybrush-server/etc/conf/skybrush-outdoor.jsonc'
             logging                Storing logs in '/home/skybrush/.cache/Skybrush Server/log'
             logging                Logging started
             http_server            Starting HTTP server on :5000
           ▲ insomnia               Cannot prevent sleep mode on this platform
             mavlink     mav        Routing primary traffic to mav
             mavlink     mav        Routing RTK corrections to mav
             mavlink     mav        Routing RC overrides to mav
             mavlink     mav        Connection at :14550 up and running
Enter fullscreen mode Exit fullscreen mode

Build SITL

1.Press + button and create new console and switch to it.

Image description

Image description

2.Build SITL

git clone https://github.com/skybrush-io/ardupilot.git
cd ardupilot/
git checkout CMCopter-4.2
git submodule update --init --recursive
sudo apt install python3.10-venv
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip wheel
pip install future empy intelhex pexpect
./waf configure --debug --board sitl
./waf copter
Enter fullscreen mode Exit fullscreen mode

3.Test SITL

build/sitl/bin/arducopter
Enter fullscreen mode Exit fullscreen mode

Build ap-swarm-launcher

1.Build ap-swarm-launcher

deactivate
cd ~
git clone https://github.com/skybrush-io/ap-swarm-launcher
cd ap-swarm-launcher
python3 -m poetry install

Enter fullscreen mode Exit fullscreen mode

2.Launch ap-swarm-launcher

python3 -m poetry run ap-sitl-swarm -n 20 --num-drones-per-row 5 --spacing 5 --pos-noise 0.5 --yaw-noise 10 ../ardupilot/build/sitl/bin/arducopt
er
Enter fullscreen mode Exit fullscreen mode
  • If you correctly launch it, the result will be like below.
skybrush@MyComputer:~/ap-swarm-launcher$ python3 -m poetry run ap-sitl-swarm -n 20 --num-drones-per-row 5 --spacing 5 --pos-noise 0.5 --yaw-noise 10 ../ardupilot/build/sitl/bin/arducopter
    1 | Setting SIM_SPEEDUP=1.000000
    1 | Suggested EK3_BCOEF_* = 16.288, EK3_MCOEF = 0.209
    1 | Home: -35.363254 149.165234 alt=584.000000m hdg=345.000000
    1 | Starting sketch 'ArduCopter'
    1 | Starting SITL input
    1 | Using Irlock at port : 9005
    1 | UDP connection 127.0.0.1:14550
    1 | Loaded defaults from /tmp/sitl-swarm-kkeeabzu/drones/001/default.param
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kkeeabzu/drones/019/default.param
   20 | validate_structures:476: Validating structures
   20 | Loaded defaults from /tmp/sitl-swarm-kkeeabzu/drones/020/default.param
Enter fullscreen mode Exit fullscreen mode

Launch Skybrush live

1.Back to Host OS(wiundows11), download Skybrush live Installer and install.

2.Launch Skybrush live

  • If you can see drones, it's showtime! Image description

Top comments (0)