# A Simulation Test Plan Before a Robot Meets Hardware

Published 2026-10-22 · Gabriele Masetti · Robotics.world

> Simulation can retire most software risk before a robot moves, if each behaviour gets a measured sim-to-real gap number and a pass threshold set before the first hardware trial.

## Simulation as a Measured Instrument

A simulator can retire most of a robot's software risk before any motor turns, but only when the plan treats the simulator as an instrument with a measured error. The usual failure is a policy or a navigation setup that passes every simulated run and then meets friction, latency and sensor noise that the model never contained. The remedy is a test ladder with a pass criterion at every rung, plus a gap number for each behaviour that matters, written down before the first hardware trial.

## The Ladder: Unit, Mock, Simulated, Staged Real

The ladder has four rungs. Unit and integration tests run the code with no physics at all. Mock hardware runs the controllers and launch files against fake joints. A simulated world adds physics, sensors and a clock. Staged real trials start with the robot restrained or in a cage and end with the full task.

Each rung catches a different kind of defect, and a defect caught lower costs less. A wrong topic name or a controller that fails to load is a rung-one or rung-two problem and should never consume simulator time. A tuning problem that depends on contact belongs on rung three, and a problem that depends on a real motor's behaviour can only be settled on rung four.

Keeping the rungs separate makes a failure attributable: when a test fails on a higher rung, the lower rungs already passed, so the cause lies in what that rung added.

## Step 1: Test the Software Without Physics

ROS 2 ships launch_testing, described in its README as "a framework for launch integration testing." Tests can read each process's exit code, standard output and standard error, check that processes shut down cleanly, and fail when a process dies unexpectedly. Some tests run alongside the launched processes and interact with them.

Write these tests first for the things that must hold on every rung: the node graph comes up, lifecycle nodes reach the active state, and shutdown is clean. They run in seconds and need no GPU, so they can run on every commit.

## Step 2: Run Controllers Against Mock Hardware

The ros2_control documentation describes mock components as "trivial 'simulations' of the hardware components, i.e., System, Sensor, and Actuator." They echo commands back as states, so they test wiring and model no physics. The documentation states the intent directly: "The main intention is to reduce debugging time on the physical hardware and boost your development." The Generic System component mirrors commands to states, supports mimic joints from the URDF, and can add fake interfaces for sensor or GPIO data.

With mocks, a team can check that every controller loads, that the URDF's joints match the controller configuration, and that integrations such as MoveIt receive the states they expect. Any failure here would also have failed in a physics simulator, only more slowly.

## Step 3: Set Up the Simulation Clock

Before adding physics, fix the clock. The ROS 2 design article on clock and time states that the time abstraction "can be published by one source on the `/clock` topic," and that ROS time is active on a node when its `use_sim_time` parameter is set. Until then, ROS time reports system time, so the same node can run unchanged on hardware. The article also notes that a simulator may run much faster or much slower than real time.

Isaac Sim documents both options for its ROS 2 Publish Clock node: by default, simulation time increases monotonically and is published to `/clock`, with an optional `resetOnStop` to restart from zero on each reset. A second workflow publishes system time instead, and for the camera and RTX lidar helper nodes the documentation says to set `useSystemTime` to true so their timestamps match.

A mixed clock can cause silent failures. A node on simulated time and a sensor stamped with wall time produce transform lookups that fail or extrapolate. A rung-three checklist should therefore include one test that echoes `/clock`, confirms every node has `use_sim_time` set, and confirms that sensor stamps fall on the same timeline.

## Step 4: Choose the Physics Engine and Read Its Assumptions

Gazebo is a separate project from ROS, and its documentation recommends the latest long-term-support versions of both for new users, with the default Gazebo version from the ROS repository when installing `ros_gz`. It marks non-default pairings as possible but effortful and warns that "We do not recommend this approach for beginners!" The compatibility table on that page is the authority for any given release pair.

In October 2026, the Gazebo page lists ROS 2 Jazzy with Gazebo Harmonic as a recommended pairing, and ROS 2 Rolling and Lyrical with Gazebo Jetty. The Isaac Sim ROS 2 page recommends ROS 2 Humble and Jazzy as the officially tested distributions, with experimental loading of other natively installed distributions. Re-read both pages before pinning versions.

Gazebo uses the DART physics engine by default and lists preliminary support for Bullet-based plugins as alternatives, selectable with the `--physics-engine` option. Switching the engine on the same world is a cheap robustness test: a behaviour that only works under one engine depends on that engine's contact handling.

MuJoCo's documentation is explicit about its model. Contact is formulated as a convex optimization problem, the model is "inherently soft," and "gradual contact slip cannot be avoided." The same documentation calls the time step "perhaps the single most important parameter that the user can adjust": too large and the simulation becomes unstable, too small and computation is wasted. It recommends the implicitfast integrator as usually the best trade-off of stability and performance. Record the time step, the integrator and the contact settings in the test report next to every result.

A peer-reviewed survey in IEEE Access (volume 9, 2021) by Collins, Chand, Vanderkop and Howard covers physics simulators across seven robotics sub-domains and aims to help researchers choose one for their use case. It is a reasonable starting point when the candidates are not yet narrowed.

## Step 5: Run the Real Stack in a Simulated World

For a wheeled robot, Nav2 gives the cleanest example because its servers can be tested as the same code that runs on the vehicle. Nav2 describes itself as an open-source autonomy framework built from independent servers coordinated by behavior trees: a planner server, a controller server, a behavior server, smoothers, a collision monitor, and costmaps, with plugins for controllers and planners.

The Nav2 quickstart launches the stack with the AMCL localizer in a simulated TurtleBot 3 world. You set the initial pose with RViz's 2D Pose Estimate button and then choose a goal. The documentation notes that `headless` defaults to true, so the Gazebo 3D view does not start unless you ask for it, and cautions that the instructions are a simplified version of the TurtleBot 3 manual.

Turn that manual demonstration into a scripted test. Fix the map, the start pose, a list of goals and a timeout, then record success, path length, time to goal and the number of recovery behaviours triggered. Run it a few dozen times with randomized start poses. Those distributions become the baseline for the comparison in Step 7.

## Step 6: Randomize Unmeasured Parameters

Some parameters cannot be measured cheaply: floor friction, payload mass, sensor bias. For these, the standard technique is domain randomization. Tobin and colleagues, in a March 2017 arXiv paper submitted to IROS 2017, trained an object detector only on simulated images with random non-realistic textures and reported real-world accuracy within 1.5 cm, robust to distractors and partial occlusion.

Isaac Lab exposes the same idea for physics. Its event terms include rigid-body material randomization, which samples static friction, dynamic friction and restitution into a bucketed set of materials on the PhysX backend, and rigid-body mass randomization, which accepts add, scale or absolute operations and uniform, log-uniform or Gaussian distributions. The documentation notes that inertia is recomputed after a mass change (the recompute_inertia flag, on by default) on the assumption of uniform density, so the result may be wrong for non-uniform bodies.

Isaac Lab's API also lists noise models, including Gaussian and uniform configurations, and Gazebo's sensors library has a Gaussian noise model class with mean, standard deviation and bias accessors.

Choose ranges from measurements wherever any exist. A friction range of the wrong width trains or tests against a world the robot will never see, and a range wider than reality can make a safe controller look unsafe.

## Step 7: Measure the Gap per Behaviour

The gap is a number for each behaviour, from the same scripted run on both sides. The multipanda_ros2 paper, presented at ICRA 2026, is a worked example for a manipulator.

Its authors pair a MuJoCo simulation with metrics for kinematic accuracy and dynamic consistency, covering torques, forces and control errors, and report that identifying the real robot's inertial parameters improves the agreement of forces and torques. Their framework targets a 1 kHz control loop and controller switching in 2 ms or less, which makes timing part of what the comparison can trust.

For a mobile robot, the same recipe uses path-tracking error, time to goal and success rate, each computed on the simulator and on the robot over the same goal list. Decide the acceptable difference before running the hardware trial, so the pass criterion is fixed before any hardware result is known.

Learned policies get the same treatment. Salimpour and colleagues, in a January 2025 arXiv preprint, trained end-to-end reinforcement learning local planners in Isaac Sim, tested them in Gazebo, and ran inference on real ROS 2 robots. They report zero-shot transfer and performance comparable to Nav2. A team replicating the approach still has to produce its own comparison against a Nav2 baseline, which is what the scripted test from Step 5 provides.

## Step 8: Stage the Real Trials

The first hardware run repeats the scripted simulation test with the robot restrained or with wheels off the ground. Controllers, timing and sign conventions are checked before any motion in free space. Then comes slow motion in a clear area with an emergency stop within reach, then the scripted goal list at full speed, and finally the task in its real environment.

Log the same metrics as on the simulated side and compute the gap table. A behaviour whose gap exceeds the pre-set threshold goes back to the simulator with a specific hypothesis, such as a friction range, a latency, or an inertial parameter. The multipanda_ros2 authors' inertial identification is one concrete way to feed measurements back into the model.

## Limits of Simulated Evidence

A simulated pass is evidence about the model, and the model has stated limits. The MuJoCo documentation says its contact model is soft by design, so contact-rich behaviour carries a model error that the engine's own authors describe. Isaac Lab's documentation says inertia recomputation assumes uniform density. Real hardware can violate either assumption.

The conservative reading of the evidence is that simulation makes the real trials fewer, safer and better aimed, and that the gap table is what tells a team which behaviours still need them. A behaviour with a small, repeatable gap on several scripted runs has earned a lighter hardware test, and a behaviour with a large or unstable gap needs the full hardware test whatever its simulated score.

## Sources

1. [Skerlj et al., Bridging the Sim-to-Real Gap with multipanda_ros2 (ICRA 2026)](https://arxiv.org/abs/2602.02269) arXiv:2602.02269
2. [Salimpour et al., Sim-to-Real Transfer for Mobile Robots with RL (arXiv preprint)](https://arxiv.org/abs/2501.02902) arxiv.org
3. [ROS 2 Design: Clock and Time](https://design.ros2.org/articles/clock_and_time.html) design.ros2.org
4. [Nav2 documentation](https://docs.nav2.org/rolling/) docs.nav2.org
5. [Gazebo: Installing Gazebo with ROS](https://gazebosim.org/docs/latest/ros_installation/) gazebosim.org
6. [NVIDIA Isaac Sim: ROS 2 Clock](https://docs.isaacsim.omniverse.nvidia.com/latest/ros2_tutorials/tutorial_series/tutorial_ros2_clock.html) docs.isaacsim.omniverse.nvidia.com
7. [MuJoCo documentation](https://mujoco.readthedocs.io/en/stable/overview.html) mujoco.readthedocs.io
8. [Tobin et al., Domain Randomization for Transferring Deep Neural Networks](https://arxiv.org/abs/1703.06907) arxiv.org
9. [ros2_control — Mock Components](https://control.ros.org/rolling/doc/ros2_control/hardware_interface/doc/mock_components_userdoc.html) control.ros.org
10. [ros2/launch — launch_testing README](https://github.com/ros2/launch/blob/rolling/launch_testing/README.md) github.com
11. [Isaac Lab — isaaclab.envs.mdp (events)](https://isaac-sim.github.io/IsaacLab/main/source/api/lab/isaaclab.envs.mdp.html) isaac-sim.github.io
12. [Gazebo gz-sensors — GaussianNoiseModel](https://gazebosim.org/api/sensors/9/classgz_1_1sensors_1_1GaussianNoiseModel.html) gazebosim.org
13. [Gazebo Sim — Physics](https://gazebosim.org/api/sim/9/physics.html) gazebosim.org
14. [MuJoCo documentation — Computation](https://mujoco.readthedocs.io/en/stable/computation/index.html) mujoco.readthedocs.io
15. [Isaac Sim — ROS 2 tutorials](https://docs.isaacsim.omniverse.nvidia.com/latest/ros2_tutorials/index.html) docs.isaacsim.omniverse.nvidia.com
16. [Collins et al., A Review of Physics Simulators for Robotic Applications, IEEE Access 9 (2021), doi:10.1109/ACCESS.2021.3068769](https://ora.ox.ac.uk/objects/uuid:e64b1797-917d-4b75-8eae-a5a60af74246) ora.ox.ac.uk

## Explore

[More articles](https://robotics.world/implementation)

---

Canonical: https://robotics.world/implementation/simulation-test-plan-before-robot-hardware
