Sim-to-Real: Model Uncertainty and Action Delay

English translation

Graduate course · Research application activities

Even a policy that works well in a simulator can fail when physical parameters and delays differ. Quantify these differences before transferring to real hardware.

Before practice

01 Will a good simulator policy also work well in reality?

Description

Differences in physical parameters, sensor noise, action delay, and normalization can change a simulator policy's behavior on real devices. Vary one factor at a time to identify vulnerabilities.

02 How do identification and randomization differ?

Description

System identification estimates a model from observations; domain randomization trains across a range of possible variations. Design the evaluation range separately from the training range.

Execution conditions

If the required package is missing, run %pip install control==0.10.2 gymnasium==1.3.0 stable-baselines3==2.9.2 in a Colab or Jupyter code cell.

Applications

Drive-system tracking performance and input cost

A synthetic 1st-order motor model that tracks a constant reference angular velocity in each experiment. Separate training at target 1 from evaluation at 0.5, 1, and 1.5.

Observation·State
Angular velocity ω/5\omega/5, target r/2r/2.
Action
Continuous a∈[−1,1]a\in[-1,1], actual input u=2au=2a.
Reward·Constraint
−((r−ω)2+0.05u2)-((r-\omega)^2+0.05u^2). Termination at |ω|>5|\omega|>5; time limit at 100 steps.
Comparison baseline
P control with the same input limits.
Metrics to check
Tracking RMSE, mean u², and number of safety terminations. Evaluate separately for each target.

HVAC and thermal process control

A design case for control that reduces both temperature deviation and energy use.

Observation·State
Temperature, target, outside-air conditions, and recent inputs. Include history when delays are substantial.
Action
Bounded continuous heating and cooling output.
Reward·Constraint
Temperature error and energy cost. Record safety limits as metrics separate from reward as well.
Comparison baseline
Thermostat and PI control.
Metrics to check
Error, energy, and time spent violating limits. Evaluate separately by outside-air condition.

Practice

Preview practice notebookDownload practice notebook

1. Baseline control with the nominal model

Starting conditions

Use the baseline motor model and P control. Compare reference angular velocities of 0.5, 1, and 1.5.

Procedure

  1. Record the model's input limits, time interval, and observation units, and run the baseline controller.
  2. Compare RMSE, input cost, and return for each target.

Results to retain

In the synthetic model, action a∈[−1,1]a\in[-1,1] corresponds to model input u=2a∈[−2,2]u=2a\in[-2,2]. Physical units for uu are unspecified.

Items to record and points to check
Objective
RMSE
Mean u²
Return

Points to check

  • Did you distinguish and record the mapping between action ranges and model input ranges?
  • Did you distinguish steady-state error from transient error?

2. Where performance breaks down when the model is wrong

Starting conditions

Apply gain .8→.6 or input delay 0→0.2 s, one at a time. Compare P control and briefly trained SAC under the same conditions.

Procedure

  1. Identify and mark only the terms that the provided StressMotor changes from the nominal model.
  2. Evaluate nominal, reduced-gain, and input-delay conditions, and compare the metrics.
  3. Find one condition under which each controller is vulnerable and connect it to quantities to measure on a real device.

Results to retain

Items to record and points to check
Policy
Condition
seed
Return
RMSE
Input cost

Points to check

  • Did you avoid changing multiple physical parameters simultaneously?
  • Did you avoid claiming that robustness in a synthetic model establishes real-device performance?

3. Define the reality gap in your research

Starting conditions

Choose the one of the three preceding conditions closest to your research.

Procedure

  1. Choose one priority among physical parameters, sensor noise, and delays to identify.
  2. Create a table of nominal values, measurement ranges, training ranges, and separate evaluation conditions.
  3. If measured data are available, describe the estimation method; otherwise, state the minimum observations needed.

Results to retain

Items to record and points to check
Uncertainty
Measurement method
Training range
Evaluation scope

Points to check

  • Did you avoid unconditionally using the same ranges for training and evaluation?
  • Did you define safety limits and metrics to check before applying to real equipment?

Official examples and data