- A Unix based system (Linux, etc.), but we've only tested on Ubuntu 24.xx
- Docker Engine or Docker Desktop installed on your system
- A virtual Python >=3.12 environment with RobotSwarmSimulator installed If you have Python 3.11 or lower, you can use pyenv to install a newer version of Python.
- If you're cloning via
git, you should also install git lfs (rungit lfs installin the root directory of the repository)
Note
The Docker simulation must be run on a Unix based system (Linux, MacOS, etc.). This is because the Windows version of Docker does not properly support the --net=host option. Workarounds may exist, but we were unable to get them to work.
The following commands will create a virtual Python environment and install the RobotSwarmSimulator package. We'll use uv to speed up the installation process, but if you experience any errors, try removing uv from the command.
First, open a terminal where you'd like to place the project. You should not place the .venv folder inside the repository (the orb_sitl folder). I'll use the following directory structure in this example:
┬ ~/orbsim # Unzip to here if you downloaded it as a `.zip` file
├── orb_sitl/ # this repository
│ ├── .git/...
│ ├── rss/
│ │ ├── world.yaml
│ │ ├── SITLUTMWorld.py
│ │ ├── SITLOrbAgent.py
│ │ └── ...
│ ├── README.md
│ ├── requirements.txt
│ ├── rssitl.py
│ ├── orbs-gmu-docker-v1.tar # this should be > 100MB
│ └── ...
└── .venv/ # the virtual environment that you create
└── bin/
└── activate
mkdir -p ~/orbsim
cd ~/orbsim
Now, create a virtual Python environment.
Install and use uv to create the virtual environment:
pip install uv
uv venv
Note
If uv is giving you issues, use virtualenv instead:
pip install virtualenv
virtualenv .venv --prompt .
Now activate the virtual environment.
Make sure you're in the orbsim directory, where you should be able to see the .venv folder.
source .venv/bin/activate
Click Here for 🔧 Development RobotSwarmSimulator installation
If you need a newer version of swarmsim, you can install the RobotSwarmSimulator as editable from GitHub:
cd orbsim # make sure you're in the project folder
# make sure your virtual environment is activated.
source .venv/bin/activate # SKIP THIS IF (orbsim) IS ALREADY IN YOUR PROMPT
git clone https://github.com/kenblu24/RobotSwarmSimulator.git
cd RobotSwarmSimulator
uv pip install -e .You should now see (orbsim) at the beginning of your bash prompt.
cd to the orb_sitl directory and install the dependencies:
cd orb_sitl
uv pip install -r requirements.txt
You only need to load the image once, unless the image has been updated.
docker load -i orbs-gmu-docker-v1.tar
Note
If you cloned the repository via git, you may not have downloaded the image yet.
If this is the case, you'll see that the file size of orbs-gmu-docker-v1.tar is very small.
You can check the file size with ls -l, and you'll see the file size in bytes.
If this is the case, make sure you have git-lfs with git lfs install and then run git lfs pull to download the image.
The file size should be > 100MB.
If the docker image is updated at some point, you may need to re-run git lfs pull to download the new image.
docker run -it --net=host scruffy.jhuapl.edu:7654/kmm-flight-stack/imperium/imperium-runtime:gmu-docker-v1
docker run -it --net=host scruffy.jhuapl.edu:7654/kmm-flight-stack/imperium/imperium-runtime:gmu-docker-v1 /bin/bash
Tip
If you receive a permission error when running any of the docker commands, try prefacing the command with sudo
./launch_swarm.sh NUMBER_OF_ORBS
NUMBER_OF_ORBS should be set to 6 for now as the python script used speciically waits for 6 orbs to come online before sending commands. This can be updated by changing the agents: 6 line within the file orb_sitl/rss /world.yaml.
Once the docker image is running, in a separate terminal, activate a virtual python environment:
cd ~/orbsim
source .venv/bin/activate
Then, run the simulation script.
cd orb_sitl
python rssitl.py
The rssitl.py script accepts the following arguments:
| Argument | Description | Allowed Values |
|---|---|---|
-h or --help |
Prints help message | |
--viz --vizonly |
Disables sending commands to the orbs |
Docker is a virtualization technology that allows you to run an application in a container. Containers are isolated from the host system, like a virtual machine.
The docker image orbs-gmu-docker-v1 is a container that runs SITL (Software in the Loop) simulations of the Orb. This means that for each Orb in the simulation, your computer will run a copy of the Orb's onboard software. The --net=host option allows the Orbs to break network boundaries and communicate with each other and with anything else on your computer and network.
When you run ./launch_swarm.sh 6, the script will spawn 6 Orbs on the "ground". The orbs have simulated physical dynamics to approximate the flight dynamics of real Orbs, as well as simulated GPS and IMU, but no collisions. Additionally, AFAIK, the world is an infinite plane.
You can see or edit the networking and spawn parameters at the docker terminal:
nano imperium/config/orbs/jawbreaker/sitl/sitl.cfg.toml
When spawned, the Orbs are in a semi-dormant state. They will report their position and status only partially.
The Orbs communicate by sending UDP packets in broadcast or multicast mode. The format of the packets is defined by EpuC2.proto. This is a protobuf file written by JHUAPL. We've generated the python code for this file using protoc, and the resulting code is in EpuC2_pb2.py. This file should not be manually edited. It allows Python to read and send messages to/from the Orbs.
RobotSwarmSimulator is a python package that allows you to run 2D simulations of multiple robots. We're using it to visualize the Orbs' movements, store the state of the world, simulate the 2D BinaryFOVSensor, and send movement commands to the Orbs. We're not using it to simulate any kinds of physical dynamics; it just reads the positions and orientations of Orbs coming out of the Docker container. Technically, you DO NOT need RobotSwarmSimulator to interact with the Orbs, but it has some quality-of-life features that make it easier to configure and use. You can find the RobotSwarmSimulator documentation here.
When you run rssitl.py, the script will create a RobotSwarmSimulator world based on the world.yaml file.
This is also when the agent definitions are loaded (in orb.yaml), which specifies things like the
controllers (speed and turning rate), sensors (FOV and range), and other parameters for each agent.
Then, it begins to run the simulation loop.
Here's what happens in the loop (starting from SITLUTMWorld.step()):
- The script reads the Orbs' positions and orientations from the Docker container.
- Each Orb in the simulation has a unique name. If RSS hasn't seen the Orb before, it creates a new
SITLOrbAgentwith the name of the Orb. - Otherwise, it updates the agent's position and orientation.
- Each Orb in the simulation has a unique name. If RSS hasn't seen the Orb before, it creates a new
- Each of the SITLOrbAgents runs its
step()function.- Each agent has a
BinaryFOVSensorattached to it. It checks if any other agents are within its top-down 2D FOV. - Then, the agent's
SITLBinaryOrbControllerreads the0or1from the sensor, and chooses to turn left or right. - Finally, the agent sends a movement command to the respective Orb in the Docker container. This command consists of a velocity command and a heading command.
- Each agent has a
However, because the Orbs operate asynchronously, we've also added a delay before the simulation sends a launch command to wake up the Orbs. This delay is specified in the world.yaml file. It waits for 6 unique Orbs to come online before sending commands.