Download Game! Currently 72 players. Last logged in:GalronioGanvarDeinoSerke

Blitzer's Blog >> 73099

Back to blogs index
Posted: 24 Oct 2026 18:34 [ permalink ]
Yes, it is entirely possible to simulate the entire system before buying a
single piece of hardware. In modern robotics, this is known as
Software-in-the-Loop (SITL). By using the right emulators, you can run the
exact same compiled code in the simulation as you will on the physical
hardware.
Here is a breakdown of the operating systems and languages each component will
use, followed by the master plan to simulate the entire cluster.
1. The Real-World Software Stack
| Component | Operating System | Primary Languages | Function |
|---|---|---|---|
| Orchestration Cluster (Android Phones) | Android (Linux Kernel) | Kotlin,
C++ (NDK), Rust | High-level SLAM, AI vision, state-machine orchestration,
mesh routing. |
| Spinal Bridge (RP2040 / STM32) | Bare Metal or RTOS (Zephyr, FreeRTOS) | C,
C++ | Translates Android IP packets (UDP/TCP) into deterministic CAN FD
frames. |
| Socket Controllers (RP2040s) | Bare Metal or RTOS | C, C++ | Subscribes to
CAN commands, runs microsecond PID motor control loops. |
| The Bus (CAN FD) | Protocol Level (Handled by SocketCAN) | N/A |
Deterministic, publish-subscribe hardware transport layer. |
2. The Simulation Toolchain
To simulate this distributed architecture, we do not write a monolithic "fake
robot" script. We string together three distinct, open-source simulation
engines that talk to each other just like the real hardware.
A. The Physics Engine: Gazebo
Gazebo is the industry-standard robotics simulator. You will use it to build a
3D model of your modular transformer chassis (using a format called URDF).
Gazebo simulates gravity, wheel friction, and most importantly, it generates
synthetic sensor data. It will output a fake 3D LiDAR point cloud and virtual
camera feeds as if the robot is actually driving around a room.
B. The Microcontroller Emulator: Renode
You cannot run ARM Cortex-M0+ (RP2040) C++ firmware natively on a desktop PC.
Renode is an open-source framework specifically designed to emulate embedded
systems and multi-node networks. You compile your RP2040 firmware exactly as
you would for the real chips, and Renode executes the binaries, simulating the
memory, clocks, and GPIO pins of multiple RP2040s simultaneously.
C. The Virtual Bus: Linux vcan & Docker
Linux has built-in support for virtual CAN networks (vcan). You can route the
simulated CAN traffic from Renode directly into the Linux kernel, allowing you
to use standard network analysis tools (like Wireshark) to monitor your
robot's nervous system.
3. The End-to-End Simulation Architecture
Here is how the simulation components talk to each other to create the full
SITL environment:
 * The Virtual Environment (Gazebo): Runs on your desktop PC (or a Linux
Docker container). It acts as the "real world."
 * The Brains (Android Emulators): You spin up standard Android Studio
Emulators (AVDs) running your app. They ingest the synthetic LiDAR and camera
feeds directly from Gazebo over a virtual network connection, calculate the
SLAM mapping, and output target velocity commands via UDP.
 * The Nervous System (Renode + vcan): The virtual Android phones send their
UDP commands to a Renode instance simulating the Spinal Bridge RP2040. Renode
translates this and broadcasts it over a Linux vcan interface.
 * The Muscles (Renode + Gazebo Bridge): Renode is also running four simulated
socket RP2040s. They read the vcan bus, process the velocity commands, and
output "motor torque" commands. A small bridging script reads these simulated
torques and feeds them back into Gazebo, causing the virtual 3D wheels to
turn.
Why This Architecture Wins
Because you are simulating the system at the binary and network levels, the
transition to reality is practically copy-paste.
When the physical hardware arrives, you don't rewrite your code. You simply
point the Android phones to the real Ethernet switch instead of the virtual
one, flash the exact same .elf binaries to the physical RP2040s that you were
running in Renode, and the robot drives.