Tustin Pilot Model — Robotics/Pilot Models
Robotics/Pilot_Models/Tustin_Pilot_Model · 2 input / 1 output port(s) at insert · exports to Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text
Description#
The block's own DESCRIPTION_HTML, rendered verbatim — the same text the config dialog's info panel and the library navigator show. Fix a wrong sentence in the block's .cpp (R-D9), never here.
Tustin Pilot Model
Robotics / Pilot Models
A human pilot closing one control loop, after A. Tustin (1947): a proportional-plus-integral operator acting on the tracking error after a reaction delay,
u = Kp·(T·s + 1)/s · e−sτ · (xcom − x)
that is, with w the error delayed by τ, u = Kp·(T·w + ∫w dt). The name is the author's, not the discretization rule's: nothing here is bilinear.
Ports
- x com – the commanded value of the controlled quantity, a scalar.
- x – the controlled element's actual output, a scalar. The error is x com − x, so the two inputs are not interchangeable: swapping them negates the output.
- u – the pilot's control input to the controlled element, a scalar.
Parameters
- Pilot Gain – Kp, a scalar. Defaults to 1.
- Pilot Time Delay (s) – τ, a scalar, and it must be greater than zero. Defaults to 0.1. It need not be a whole number of samples: a fractional delay is realized exactly, not rounded (see Notes).
- Pilot Lead Constant – T in seconds, a scalar. Defaults to 5.
- Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.
Code export
All ten targets: Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog and PLC Structured Text. Every one emits the same recursion the simulation runs: a delay line of past errors and the exactly discretized filter, with every coefficient computed at export time from the parameters and the sampling time and printed at 17 significant digits. The parameters are therefore inlined, not tunable: retuning the pilot means re-exporting.
The three hardware targets are genuine Q16.16 fixed point – a shift register for the delay and one multiply-accumulate row per state – and round rather than truncate at every shift back, because the integrator accumulates every sample.
Simulink bridge
Import and export, mapped to Aerospace Blockset's
aerolibpilot/Tustin Pilot Model: Pilot Gain →
Kp, Pilot Time Delay (s) → time_delay,
Pilot Lead Constant → T. The mask's pade
field has no counterpart and is left at its default: it is the delay's Padé
order for linearization only and changes nothing a simulation computes.
The Simulink block defines no SampleTime parameter,
measured with set_param, so the rate stays on the ICore side.
Notes
- Stateful: one integrator state and a line of past errors as long as the delay. Both start at zero, as Simulink's do.
- Sampled: the block runs at its sampling time, and its filter is the exact zero-order-hold discretization of the continuous model for an error held between samples – so at the sample instants it equals the continuous model. A fractional delay is realized exactly too: the held error then changes part-way through an interval, and the recursion integrates both parts.
- No state space: a pure delay has no finite A/B/C/D, so model reduction correctly refuses the block rather than merging it with its delay dropped. The output never depends on the input at the same instant, so a loop closed through the pilot is not algebraic.
- When the delay is a whole number of samples, Simulink's continuous delay still emits its initial output at exactly t = τ, where a sampled line already emits the first error; the two differ on that one sample by Kp·T times the first error, and agree everywhere else.
Code facts#
| Fact | Value |
|---|---|
| registered type | Robotics/Pilot_Models/Tustin_Pilot_Model |
| family | Robotics/Pilot_Models |
| solver environment class | ICoreBlock_0_Robotics_1_Pilot_Models_2_Tustin_Pilot_Model |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Robotics/Pilot_Models/Tustin_Pilot_Model/ICoreBlock_0_Robotics_1_Pilot_Models_2_Tustin_Pilot_Model.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Robotics/Pilot_Models/Tustin_Pilot_Model/ICoreBlock_0_Robotics_1_Pilot_Models_2_Tustin_Pilot_Model.h |
| default size on canvas | 120 × 80 px |
| ports at insert | 2 in, 1 out |
| code generators implemented | Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text |
Ports#
| # | Direction | Signal type | Description label |
|---|---|---|---|
| 1 | in | ICoreDouble | x com |
| 2 | in | ICoreDouble | x |
| 3 | out | ICoreDouble | u |
Ports the constructor creates. A block whose port list changes with its configuration adds or removes ports at load time; the count above is the one a freshly inserted block has.
Configuration variables#
| Config variable | Default | Simulink parameter |
|---|---|---|
Pilot Gain | 1 | Kp |
Pilot Time Delay (s) | 0.1 | time_delay |
Pilot Lead Constant | 5 | T |
Every block also carries Sampling Time (s) from ICoreBlockSolverEnvironment: zero or less inherits the solver's rate, a positive value runs the block at that period.
Simulink bridge#
| support | Support::Both |
| Simulink path | aerolibpilot/Tustin Pilot Model |
| port-count rule | PortsParam::None |
SampleTime parameter | no — the counterpart defines none; the rate stays on the ICore side |
| ICore config | Simulink parameter | Value translation |
|---|---|---|
Pilot Gain | Kp | passes through |
Pilot Time Delay (s) | time_delay | passes through |
Pilot Lead Constant | T | passes through |
Caveat (shown to the user): The mask's pade field is the delay's Pade order for LINEARIZATION only and has no counterpart here: this block realizes the true delay, so an imported pade value changes nothing a simulation computes. This block is sampled: at its sampling time it equals the continuous Simulink model for an input held between samples, and with a delay that is a whole number of samples the two differ on the one sample at t = delay, where Simulink's continuous Transport Delay still emits its initial output
Catalog contract: src/ICoreBlocks/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h
Description vs code#
The lists agree. check_block_descriptions.py finds no disagreement between the description's Ports, Parameters, Code export and Simulink bridge lists and the code's.
The verdict above is
tools/docs/check_block_descriptions.py(P7.1), which compares LISTS. It cannot read a sentence: "stateless" on a block with a state, an initial-value semantic the recursion does not implement, a "not synthesizable" caveat the HDL banner contradicts. That is the agent audit (P7.3) on BLOCK_DESCRIPTION_AUDIT.md, and this tool's green is not a substitute for one.
File banner (developer view)#
The top comment of the block's .cpp — the maths, the realization and the export strategy, addressed to whoever changes it. It must not contradict the description above (P7.5).
Tustin Pilot Model — a proportional-plus-integral pilot behind a reaction delay u = Kp * (T*s + 1)/s * e^(-s*tau) * (x_com - x)
MEASURED IN R2026a, reading the masked subsystem aerolibpilot/Tustin Pilot Model block by block (the mask's callback is a .p file, so the subsystem is the only readable source):
x com, x -> Sum
|-+(x com minus x) -> Transport Delay (DelayTime = time_delay, InitialOutput 0, PadeOrder = pade) -> Gain Kp -> Lead Lag Filter (num1 = T, num2 = 1, den1 = 1, den2 = 0) -> u⚠ THE LEAD LAG FILTER'S den2 IS ZERO, which is what makes this a PI and not a lead-lag: its "D" gain den2/num2 vanishes, so the inner integrator is a pure one and the filter is (T*s + 1)/s = T + 1/s. The name is Arnold Tustin's (1947), not the bilinear transform's -- nothing in the block is discretized by Tustin's rule.
⚠ THE PADE ORDER IS NOT A MODEL PARAMETER. It is the Transport Delay's "Pade order (for linearization)", which touches linmod and nothing a simulation computes; this block realizes the true delay, so it has no config for it.
Checked against a real sim of the block at Kp 1.3, T 3.7, tau 0.13 before a line of C++ existed: the exact-ZOH recursion ICorePilotModelBlockBase realizes matched it everywhere except the ONE sample at t = tau, where Simulink's continuous delay still emits its initial output (|error| 0.367 = Kp*T*e(0), exactly the direct term's share). A delay that is not a whole number of samples has no such sample.
Everything but the filter lives in ICorePilotModelBlockBase -- read that header first.
Sample results#
| t | in ICoreDouble-Out-0 | in ICoreDouble-Out-0 | out ICoreDouble-Out-0 |
|---|---|---|---|
| 0 | -2 | -2 | 0 |
| 0.4 | 0.5 | 0.5 | 0 |
| 0.8 | -2 | -2 | 0 |
| 1.2 | 0.5 | 0.5 | 0 |
| 1.6 | -2 | -2 | 0 |
| 2 | 0.5 | 0.5 | 0 |
| 2.4 | -2 | -2 | 0 |
| 2.8 | 0.5 | 0.5 | 0 |
| 3.2 | -2 | -2 | 0 |
| 3.6 | 0.5 | 0.5 | 0 |
| 4 | -2 | -2 | 0 |
| 4.4 | 0.5 | 0.5 | 0 |
| 4.8 | -2 | -2 | 0 |
| 5.2 | 0.5 | 0.5 | 0 |
Every 4th of 60 samples, from the table stimulus.
The same rig also ran:
| Stimulus | What it is | Output range |
|---|---|---|
impulse | Impulse: one sample of 1 at k = 5, 0 elsewhere (Repeating Sequence Stair) | 0 … 0 |
ramp | Ramp: slope 1 from t = 0 | 0 … 0 |
sine | Sine Wave: amplitude 1, 2 rad/s, no phase, no bias | 0 … 0 |
step | Step: 0 -> 1 at t = 1 s | 0 … 0 |
Plotted: table — Repeating Sequence Stair: [-2 -1 -0.5 0 0.5 1 2 3], one entry per sample
Category static · sample time 0.1 · 60 steps · commit 383c0ecf1501cf1d43d89b8f688fc2fcad5e9b52 · produced by docsSample --out <folder> --blocks Ideal_Airspeed_Correction WGS84_Gravity_Model Linear_Regression_Predictor Linear_Classifier_Predictor Crossover_Pilot_Model Precision_Pilot_Model Tustin_Pilot_Model FIR_Least_Squares_Design FIR_Equiripple_Design Cartesian_To_Keplerian_Elements Keplerian_Elements_To_Cartesian --steps 60 · data docs/generated/samples/Robotics__Pilot_Models__Tustin_Pilot_Model.json · the SVG is generated from those numbers by tools/docs/plot_svg.py, so it is a run and not a drawing (R-D10).