# Lecture 01 — Real-to-Sim Methodology

## 01 | What counts as agreement?

Real-to-sim engineering starts with a measurement, not with a simulator. The goal is to build a model that makes useful predictions about a particular physical system. We need to say what is being predicted, under which conditions, and how much error is acceptable. A simulation can look plausible in a video and still fail every test that matters for a robot. Conversely, a simple model can be valuable if it predicts the limited behavior we actually need.

Consider a small robot pushing a block across a bench. We measure the block's position as a function of time, not just its final destination. The simulator is initialized from what we believe to be the same state and control input. If the tracks disagree, several explanations are possible. The measurement may be biased. The initial velocity may differ. The collision shape or the friction model may be wrong. The physics timestep or controller may introduce error. We cannot distinguish those explanations by changing one parameter until the result looks right.

Our working method is a cycle: define an observable, establish a repeatable experiment, quantify measurement uncertainty, construct the smallest defensible model, and test predictions on new trials. We save a baseline before tuning. We isolate one cause at a time. And we report failures as well as matches.

An important qualification: there is no universally realistic simulator. A grasp-planning model needs reliable contact and stability over the grasps under consideration. A mobile robot model may instead need accurate wheel slip and actuator latency. The fidelity target is tied to the decision we are trying to make. Ask first: which prediction could change the decision? That becomes the acceptance test. We will not claim that synthetic example numbers are measurements from a real laboratory. Throughout the course, an illustrated observation is identified as illustrative until backed by actual data.

## 02 | Write an observable contract

Before running an experiment, specify the observable and the conditions of comparison. The observable could be position every ten milliseconds, stopping distance, peak contact force, a joint angle, or whether an object remains in a gripper for three seconds. A vague requirement like realistic motion gives you no way to identify success or failure.

Write a compact contract. For our sliding-block example, the input is a measured initial horizontal velocity and a level contact surface. The output is the block's planar trajectory until rest. The main metric is absolute stopping-distance error. Secondary metrics are trajectory error, unintended rotation, and time to rest. We specify coordinate axes, units, frame rate, and the surface condition before collecting data. We also specify an error tolerance based on the intended application and measurement precision.

Do not use a tolerance because it happens to be easy for the simulator to meet. Suppose our camera estimates position only within two millimeters. Claiming a tenth of a millimeter of experimental agreement would exceed the evidence. The number has to come from the task.

Sometimes one metric hides a failure. Two objects can stop at the same location but get there along different paths, or one can rotate unexpectedly. Plot the full response. For manipulation, include success rates across multiple initial placements rather than reporting the single best attempt. For a controlled experiment, establish a fixed launch protocol and document any excluded trial with a previously defined reason.

The contract should be readable by another engineer. They ought to know what to measure, when a trial begins and ends, which inputs are fixed, which inputs vary, and what constitutes an unacceptable outcome. A measurement contract is both the starting specification and the eventual validation checklist.

## 03 | Frames, units, and timestamps

Many apparent physics problems are actually alignment problems. The physical camera reports pixels, the robot controller reports joint positions, and the simulator reports poses in its world frame. These cannot be compared without specifying units and transformations. Choose a physical world frame and document how every sensor, object, and model frame maps into it.

For positions, the basic transform is a rotation followed by a translation. Rigid transformations preserve shape, distances, and angles. Unit conversion does not. Millimeters interpreted as meters create a thousandfold linear error. Degrees interpreted as radians produce a less obvious but equally serious orientation error.

Time alignment is just as important. Imagine the real camera begins recording thirty milliseconds after the simulated experiment begins. At one meter per second, that difference alone shifts position by three centimeters before considering acceleration. Establish a shared event such as the commanded release or measured first motion, and account for clock offsets and sampling delays. Never assume timestamps from different machines share a clock.

Coordinate handedness and quaternion component order also deserve explicit checks. A quaternion listed as w, x, y, z is not interchangeable with one listed as x, y, z, w. Confirm conventions in each API and verify with a known rotation. If a sensor frame is attached to the wrong body, the error can grow as the robot moves, giving a misleading impression of bad dynamics.

A practical test is to select several points whose coordinates are known, transform them through the entire pipeline, and reconstruct the originals. Then compare a simple stationary scene before examining dynamic motion. If the system cannot agree on an object at rest, a moving test will not clarify anything. Align the clocks and frames before identifying physical parameters.

## 04 | Measurement, repetition, and uncertainty

One run is an observation, not a calibration data set. Repeat the procedure enough times to learn which variations are ordinary and which are systematic. For our teaching example, collect at least five launches, and preferably more when variability is high. Record the measured initial velocity on every trial rather than assuming each push is identical.

Separate systematic error from random variation. A camera that is miscalibrated by two percent gives consistently biased positions. A hand release may produce different launch velocities from trial to trial. Taking an average reduces some random variation but does not remove the camera's scale bias. Repeating a biased method produces a precise estimate of the wrong quantity.

We also need to represent uncertainty honestly. Record resolution, calibration error, time synchronization, and any ambiguity around the start or end of motion. The inferred friction in a simple horizontal sliding model depends on speed squared. A small speed error can therefore dominate a carefully measured stopping distance. That is a reason to measure velocity directly, not an invitation to add arbitrary uncertainty bars afterward.

Build a trial record with an identifier, date, setup version, surface condition, mass, dimensions, starting pose, velocity, trajectory, and reason for any exclusion. Keep raw measurements separate from cleaned data and fitted parameters. The original measurement should be recoverable.

For physical systems, apparent outliers can be the most useful observations. A gripper may fail only when an object is humid, a cable may occasionally snag, or a wheel may skid on one section of floor. Those events may define the operating limits of the model. Our goal is to make the experimental variation visible, then design tests that distinguish measurement failure from real changes in behavior.

## 05 | Construct the minimum useful model

The first simulator should contain as few moving parts as the experiment permits. To study a free sliding block, use one free body and one plane. Specify the measured geometry, mass, gravity, contact properties, and initial state. Remove controllers, external forces, decorative meshes, and additional contacts until the basic system is understood. A minimal model is easier to inspect and easier to falsify.

Choose a model family that matches the observable. A rigid-body description is appropriate when object deformation has little influence on the outcome. It may fail for compliant fingertips, soft ground, flexible cables, or impacts where deformation matters. It is legitimate to start simple as long as the assumptions and operating envelope are stated.

Document every parameter with its source. Mass measured on a scale is a measurement. A center of mass inferred from a uniform-density assumption is an estimate. Friction chosen from a generic table is only an initial guess. A parameter tuned against trial outcomes is a fitted quantity. Those categories should not be mixed in the same report, because they carry different evidence.

Use the same initial conditions in physical and simulated tests. Verify the state immediately after the simulator initializes; some engines resolve penetrations, normalize rotations, or overwrite fields through initialization steps. Run extreme sanity cases. Near-zero friction should allow much longer motion than higher friction in a simple slide. If the outcome hardly changes, you may be altering a parameter that is not active.

Finally, version the scene, software, input data, and control sequence. When a numerical discrepancy appears, you must be able to return to the unchanged baseline. A trustworthy model is not the one with the most settings; it is the smallest model whose parameters and predictions can be independently checked.

## 06 | Isolate causes with controlled experiments

Suppose the physical block stops after twenty centimeters while the simulation stops after twenty-eight. That is a forty percent difference in stopping distance. We should start by writing competing hypotheses rather than immediately increasing friction. Perhaps launch speed was higher in simulation. Perhaps the physical bench has a small incline. Perhaps a collision proxy is rotated or overlapping the plane. Perhaps contact settings or timestep resolution differ.

Each hypothesis calls for a test that can discriminate it. Measure actual launch velocity from calibrated video, with uncertainty. Check the bench tilt independently with an inclinometer. Draw the collision surfaces and contact normals inside the simulator. Print the compiled contact pair settings rather than trusting a visual mesh or an XML attribute that might be overridden. Sweep timestep at fixed initial conditions to look for numerical convergence.

Change one family of parameters at a time. For example, under a simple Coulomb model, increasing the starting speed by twenty percent predicts a forty-four percent longer stopping distance. That quantitative prediction distinguishes a velocity error from a friction error. If the measured relationship differs, examine the assumptions before fitting each trial separately.

An ablation removes one element of the model to see whether the effect persists. Switch off the controller, replace a detailed collision mesh with a box, or remove a hidden support. The purpose is not to create a perfectly faithful environment during the ablation. It is to isolate the source of the mismatch. Restore the element only after the simpler system behaves as expected.

For every test, preserve the original prediction and the outcome. Avoid retrospectively presenting a successful parameter setting as though it were obvious. Diagnosis is a sequence of discriminating experiments. Parameter tuning without those experiments is a way to hide a problem, not to understand it.

## 07 | Fit parameters without fitting the noise

Calibration chooses model parameters that reduce disagreement with designated data. First identify which parameters are actually identifiable. If several combinations of mass, actuator force, friction, and damping produce nearly the same observable trajectory, one trajectory cannot tell you which combination is physically correct. You need independent measurements or experiments that excite different behavior.

A practical procedure is to partition the observations. Use a calibration subset to fit parameters and reserve a holdout subset for validation. If the experiment has important operating regimes, such as slow and fast motion, ensure the split tests a meaningful change rather than merely selecting adjacent frames from the same launch. Frames within one trial are correlated and should not be treated as independent experiments.

Choose a loss function that reflects the use case. For a sliding block, the loss could combine differences in stopping distance and position over time. For a gripper, it may combine slip, grasp failure, and unexpected rotation. Scale the terms appropriately so one metric does not dominate simply because its numerical units are larger.

A fitting algorithm cannot rescue bad measurement design. It will happily compensate for a camera timing offset by adjusting friction or a controller gain. Check units, geometry, and timestamps first. Report parameter ranges or sensitivity, not false precision. If a fitted friction coefficient changes dramatically with launch speed, investigate speed dependence, surface variation, and model inadequacy.

Keep the baseline and fitted model side by side. Save the code, random seed, parameter bounds, optimization objective, calibration trials, and output logs. Fitting is useful only when another person can repeat it and when the resulting model predicts an experiment not used during the fit.

## 08 | Numerical convergence and sensitivity

Even a correct physical model is approximated numerically. Simulators advance time in steps and solve contact constraints with finite tolerance. If a trajectory changes substantially when you halve the timestep, you may be studying numerical error rather than the physical parameter of interest. Before calibrating subtle effects, run a convergence experiment.

Hold the same initial state and time-dependent controls fixed. Compare time steps such as ten, five, two, and one milliseconds. Record the observable trajectory, maximum penetration, contact-force spikes, and computational cost. Evaluate whether predictions approach a stable value as steps decrease.

Also separate the simulation integration rate from the controller's update rate. A physics engine running at one kilohertz does not mean the real controller produces a new command each millisecond. Model control hold intervals and measured actuator latency if they affect the prediction. Otherwise you may accidentally tune numerical behavior that a physical robot cannot reproduce.

Perform a parameter sensitivity test. Increase friction by a modest amount and observe the effect on stopping distance. Increase mass while holding the initial velocity and simple sliding assumptions constant. The textbook model predicts no change in deceleration due to friction alone, because both inertia and normal force scale with mass. If the full simulator reacts differently, that is a diagnostic clue, not necessarily a bug. Rotation, actuation, rolling, or contact solver behavior may be involved.

Document solver type, tolerance, timestep, integrator, and any convergence criteria. A plot is more informative than saying the model appears stable. The simulator's numerical settings are part of the experimental apparatus, and changing them requires the same discipline as changing a physical sensor or a calibrated force gauge.

## 09 | Generalization and failure envelopes

A model that matches calibration data is not necessarily predictive. Evaluate it on trials that were not used to select parameters. Hold out different initial speeds, contact patches, orientations, payloads, or surface conditions according to the intended operating envelope. Make the split before optimization where possible. Otherwise it is easy to select the tests that flatter the model.

Examine the errors rather than reducing everything to an average. Plot residuals against initial speed, location, and contact mode. A systematic drift at higher speeds might indicate incorrect timing or speed-dependent friction. Errors only during rotation could implicate collision geometry, inertia, or torsional resistance.

The notion of robustness is task dependent. A robot that succeeds in ninety-eight of one hundred easy grasps but fails on every slippery object does not have a ninety-eight percent success rate for a deployment dominated by slippery objects. Report the distribution of tested conditions alongside summary statistics. Count failed or aborted runs and explain exclusions. Do not silently drop the catastrophic outliers.

Identify the domain where your approximation remains useful. Perhaps rigid contact predicts slow, level-surface motion but not flexible collisions. Perhaps measured camera position is accurate but torque is not. In a scientific report, say exactly what failed and how that failure affects decisions. An honest narrow model is more valuable than a broad, untested claim of realism.

When a holdout failure appears, return to hypothesis testing. Do not refit on the holdout and continue calling it independent validation. Either create a new independent test set or explicitly describe the earlier holdout as development data. The final proof is predictive agreement under stated conditions and uncertainty, not the number of sliders that can be tuned until the demo looks convincing.

## 10 | The real-to-sim evidence package

A completed real-to-sim task should produce an evidence package, not just a video. Include the experiment protocol, input measurements, uncertainties, scene and software versions, fitted parameters, numerical settings, calibration split, holdout results, and known failure cases. The goal is to let a skeptical colleague reconstruct the reasoning without having to trust the author.

For our sliding-block exercise, present a table of measured initial velocities and stopping distances. Show the baseline simulation under the same conditions. List hypotheses for the discrepancy and the tests conducted to distinguish them. Then show the calibrated model on the training subset and its predictions on independent trials. Report trajectory errors and any unexpected rotation or penetration. Separate results obtained from illustrative teaching data from results actually measured in a laboratory.

A strong lab submission states the predicted change before making a parameter sweep. If you think friction is too low, quantify how distance should change when friction increases. If you think the problem is a frame mismatch, write down the transform and verify it on stationary landmarks. If you think the solver is responsible, repeat the run at multiple timesteps while keeping controls fixed. That sequence makes a scientific finding testable. I report uncertainty and failure conditions. This is the answer that separates model validation from trial-and-error animation.

The laboratory accompanying this lecture implements a small, dependency-free calibration and holdout example. It is deliberately a simplified analytical model, not a claim to reproduce MuJoCo. Later lectures will introduce mesh geometry, mass and inertia, contact solvers, and simulator-specific implementation. The methodology remains the same: make a prediction, preserve the evidence, and be precise about where the model is trusted.

