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
Required packages: gymnasium, stable-baselines3, and PyTorch.
SB3 policy: MlpPolicy.
Gymnasium step: 5 return values.
Public environment visualization: Add gymnasium[classic-control].
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 , target .
Action
Continuous , actual input .
Reward·Constraint
. Termination at ; 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.
Use the baseline motor model and P control. Compare reference angular velocities of 0.5, 1, and 1.5.
Procedure
Record the model's input limits, time interval, and observation units, and run the baseline controller.
Compare RMSE, input cost, and return for each target.
Results to retain
Evaluation table by target and representative tracking curves.
In the synthetic model, action corresponds to model input . Physical units for 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
Identify and mark only the terms that the provided StressMotor changes from the nominal model.
Evaluate nominal, reduced-gain, and input-delay conditions, and compare the metrics.
Find one condition under which each controller is vulnerable and connect it to quantities to measure on a real device.
Results to retain
Policy-by-condition table and tracking plot for a vulnerable condition.
Record location: In the existing while loop in stress_test, immediately after each step.
Values to preserve: env.t*0.1, env.omega, env.reference. Distinguish by policy, condition, and seed.
Plot: For the vulnerable condition selected in the table, show the tracking responses of both policies and the target line using the existing seed=100.
Axes: Time [s]–Angular velocity [rad/s]. Use only existing evaluation records.
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
Choose one priority among physical parameters, sensor noise, and delays to identify.
Create a table of nominal values, measurement ranges, training ranges, and separate evaluation conditions.
If measured data are available, describe the estimation method; otherwise, state the minimum observations needed.
Results to retain
Experiment plan table for domain randomization or system identification.
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?