Skip to content
LSLab

Which Layers of a Mop Robot Should Simulation Cover?

  • Intermediate
  • Article
  • Ages 16+
  • 7 min read
Seen from above, a laptop with a virtual apartment, a circuit board and an open robot chassis sit side by side on an engineering-paper desk.

Simulating a mopping robot should cover four layers: the circuit, the firmware, the motion and the whole fleet. Each layer answers its own question and has its own pass criterion, such as a power rail that stays above its required limit when the pump starts or a robot that heads home when its link drops. A real prototype is still needed for what simulation cannot measure.

Contents
The four simulation layers stack from components up to the whole robot fleet.
  • Circuit layer
  • Firmware layer
  • Motion layer
  • Fleet layer

What you will learn

  • Tell apart what simulation can prove from what only a real prototype can answer.
  • Write a testable pass criterion for each layer and tie it to a requirement.
  • Follow one requirement, returning home on link loss, through all four layers and know when to stop simulating and build.

Before you start

It helps to have read the article on the parts of a mini mopping-robot system. Other terms are explained where they first appear.

What can simulation prove, and what can it not?

Simulation gives evidence that a design meets a requirement inside a model, not inside a real home. The NASA Systems Engineering Handbook separates two questions: verification asks whether the end product was realized right, validation asks whether the right end product was realized. The same document places simulation among the methods of analysis: a model is a mathematical representation of reality, and a simulation is the manipulation of a model.

The reason to simulate is cost. Testing the real product is the most resource-intensive verification technique, and validation by testing is the same. Fixing the design in a model before building a prototype is a cheaper way to catch errors early.

The limit lies in the model. According to a survey of the gap between simulation and reality, there are no perfect simulators, so there is always a difference from the real world, called the reality gap. The survey describes the gap as many sub-gaps, each from the simulation failing to replicate a physical mechanism accurately, in dynamics, perception and sensing, actuation and control, and system design. So every passing result is valid only for the part that was modelled.

Between the model and the real home sits a gap made of four smaller parts.
  • Virtual model
  • Real home
  • Dynamics
  • Perception and sensing
  • Actuation and control
  • System design

What does each of the four simulation layers check?

Each layer checks a different group of faults, so all four are needed. The table below is one way to split them, with a typical tool for each; the next three articles go deep on circuits, firmware and motion.

LayerQuestion it checksExample toolCannot check yet
CircuitDo the supply, motors and pump behave when switched on together?ngspice simulates electric and electronic circuitsHeat and noise of a real board
FirmwareDoes the code handle events and faults correctly?Wokwi simulates ESP32 and Wi-FiReal timing, radio in a real home
MotionDoes the virtual robot cover the room, avoid edges and dock?Gazebo, reached through ROS topicsFloor friction, the damp pad
FleetDo the robots split zones and take turns at the dock?The real controller connected to the motion simulationLoad on a real home's Wi-Fi

The ngspice site describes an open source spice simulator for electric and electronic circuits. According to the Wokwi documentation, it simulates Arduino, ESP32, STM32 and many other boards, parts and sensors, and offers Wi-Fi simulation so a project can use MQTT, HTTP or NTP. With Gazebo, users interact with a running simulation by publishing and subscribing to topics over Gazebo Transport or ROS, which is how a controller on a computer can connect.

Once a real board exists, hardware in the loop adds another check. One hardware-in-the-loop framework shows the effect of delays, noise and saturation on a control system.

Each layer checks one part; the dashed box is what only a real prototype answers.
  • Circuit layer
  • Firmware layer
  • Motion layer
  • Fleet layer
  • Part not yet checked

How do you write a pass criterion for each layer?

A pass criterion is one sentence with a condition, an expected result and a way to measure it, so anyone running it reaches the same verdict. NASA's requirement checklist asks whether requirements are specified in a measurable, verifiable manner and whether all requirements are bidirectionally traceable to higher-level requirements. The table applies that idea to the illustrative design; the content of each criterion is a design proposal.

Source requirementLayerPass criterionResult
Stable powerCircuitWhen the pump and motors start together, the voltage at the microcontroller stays above the chip's limitPass or fail
Return home on link lossFirmwareWhen heartbeats stop past the timeout, the firmware cuts the pump, stops the wheels and enters the safe state; it returns only with a valid local route, localization and enough batteryPass or fail
Safe room coverageMotionOver many runs from different start points, the virtual robot covers the room, never drives off an edge and docks successfullyPass or fail
Shared dockFleetWhen two robots need the dock together, one enters first, the other waits and neither gets stuckPass or fail

The "Result" column is filled only after a run. Bidirectional traceability means each row points up to its source requirement, and each requirement points down to the test that checks it.

Two-way traceability: from requirement down to the test and back, each test ending in pass or fail.
  • Source requirement
  • Simulation test
  • Pass result
  • Fail result
  • Two-way traceability

How does one requirement cross all four layers?

One requirement usually needs evidence in several layers. Take "on link loss, stop mopping and return to the dock" as a hypothetical example:

  1. Circuit: with the pump off, the supply still gives the motors and the microcontroller enough power while the robot drives home.
  2. Firmware: the heartbeat timer expires, the state machine cuts the pump and stops the wheels within its time budget, then permits a return only with valid navigation data. A separate lost-localization test confirms it remains stationary.
  3. Motion: the virtual robot starts in a far zone, drives around a bed and a table, and docks successfully across many runs.
  4. Fleet: two robots lose the link and head to the dock together; robots enter only with permission from a modelled dock-side or local arbiter. If the lost central controller is the only arbiter, the correct outcome is separate holding positions outside the entrance, not a queue assumed to keep running.

Simulation exposes faults that reading code can miss. Suppose that in the firmware layer, repeated reconnection attempts keep resetting the heartbeat timer, so the pump never stops. The fault shows up when the link is cut many times in simulation, and the code is fixed before any board exists.

An example link-loss requirement: stop safely, return only when local conditions permit, and collect evidence at all four layers.
  • Link lost
  • Circuit lane
  • Firmware lane
  • Motion lane
  • Fleet lane

When should you stop simulating and build?

Stop when the criteria of all four layers pass and the remaining risk can only be measured on a real prototype. Four typical items belong there: how the damp pad wets the floor, battery chemistry, real Wi-Fi radio in a home and floor friction. They sit among the sub-gaps described above, which a model struggles to reproduce accurately.

A prototype is the costliest technique, so build the smallest one that measures exactly those things. Feed the measurements back into the model so later simulations sit closer to reality.

When all four layers pass, what remains is measured on a real prototype: damp pad, battery, radio, friction.
  • Frame of what only a prototype measures
  • Four layers passed
  • Damp pad wetting
  • Battery
  • Wi-Fi radio
  • Floor friction

Real-world example

Someone is about to buy parts. Before ordering the pump, they build the supply circuit in a circuit simulator and see the voltage dip when the pump runs with a motor. They add a smoothing capacitor in the model and rerun it. Only when the model passes do they order parts, and the first prototype is used to check whether the model was right.

Common misunderstandings

A passing simulation means the robot will run well in a home. The result holds only for what was modelled; the reality gap is always there.

Motion simulation is enough. Circuits and firmware have faults of their own that a motion simulator cannot see, such as a voltage dip or a heartbeat timer that keeps resetting.

Once simulated, no prototype is needed. The damp pad, the battery, Wi-Fi and friction still have to be measured on a real prototype.

Frequently asked questions

Can simulation replace a prototype?

Not completely. Simulation catches faults early and cheaply, while a prototype measures what a model struggles to reproduce.

Which layer should I simulate first?

Start with the layer where a fault costs most in the real build, usually the power supply and the firmware's safety logic. This is a design suggestion and depends on the project.

Do I need a real board to simulate firmware?

No. A simulator such as Wokwi runs code for ESP32 with Wi-Fi, so you can write and test code before the board arrives. Real timing and radio still need measuring on a real board.

Summary

  • Simulation gives evidence inside a model; the reality gap means each result holds only for what was modelled.
  • Four layers, circuit, firmware, motion and fleet, each have a testable pass criterion traced to a source requirement.
  • Stop simulating when all four layers pass, then build the smallest prototype to measure the damp pad, battery, real Wi-Fi and friction.

Terms in this article

English and Vietnamese terms, with the meanings used here. Hover, tap or Tab to a term with a dotted underline for an explanation as you read.

verificationxác minh
The formal process of confirming a system meets all specified requirements; it asks whether the end product was realized right.
validationthẩm định
Making sure the system works as expected in its intended environment; it asks whether the right end product was realized.
simulationmô phỏng
Running a model, a mathematical representation of reality, to see how a system responds.
reality gapkhoảng cách thực tế
The difference between a simulated and a real environment; no simulator removes it entirely.
hardware in the loopmô phỏng phần cứng trong vòng lặp
A simulation approach that puts real control hardware into the loop to show the effect of delays, noise and saturation.
traceabilitytruy vết
The ability to link each test to its source requirement and back, in both directions.
prototypemẫu thử
A physically built version used to measure what a model struggles to reproduce; the most resource-intensive validation technique.

This article is not marked as viewed

Spotted something wrong or unsafe?

Tell the administrator by email. The message already has the article title and address.

Report this article
See all articles of the topic

Sources

These sources are written for older readers. If they feel hard, read them with an adult.