Generated reference › Gyro Quaternion Integration — Robotics/Orientation 3D
kind: generated#block#robotics-orientation-3d

Gyro Quaternion Integration — Robotics/Orientation 3D

Robotics/Orientation_3D/Gyro_Quaternion_Integration · 1 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.

Gyro Quaternion Integration

Robotics / Orientation 3D

Integrates body angular rates into an attitude quaternion – the core of every IMU orientation filter:

q[k+1] = normalize( q[k] + (Ts/2) · q[k] ⊗ (0, ω[k]) )

with q scalar-first [4,1] and ω the body rates in rad/s. The update is forward Euler, which is stated as the contract rather than hidden: it is what a microcontroller ships, and at IMU rates its error is far below the gyro's own.

Ports

  • omega – body angular rates [3,1], in rad/s, ordered x, ωy, ωz) about the body axes.
  • q – the attitude [4,1], [w x y z]T, always of unit length. Its size is fixed, not inherited from the input.

Parameters

  • Initial Quaternion – the attitude at t = 0, a [4,1] column [w x y z]T. It is normalized on load, so any non-zero direction is accepted; the default [1; 0; 0; 0] is the identity rotation. A seed of all zeros cannot be normalized and is rejected with a message.
  • 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. The seed and the step Ts/2 are baked into the generated body at export time rather than exposed as tunable parameters.

The three HDL targets are simulation-only: they carry the arithmetic in real and quantize only at the port boundary. The per-step renormalization is a square root and a division, neither of which has a Q16.16 form – unlike this family's other three blocks, which are genuinely synthesizable.

Simulink bridge

None, measured rather than assumed: the attitude-integration blocks ship in the Aerospace Blockset, the Sensor Fusion and Tracking Toolbox and the Robotics System Toolbox, none of which is installed on this machine.

Notes

  • Stateful and inherently discrete. The state is the attitude itself.
  • The output is the attitude at the START of the step, published before the update. So the first sample is exactly the configured seed, and ω[k] first appears in the output at k+1 – the same one-sample convention Unit Delay uses.
  • The renormalization is per step, and it is what keeps the output a rotation. Forward Euler grows the norm slightly on every sample; without the normalize the quaternion would drift off the unit sphere and the rotation it represents would gain a scale.
  • Scalar-first (w, x, y, z), Hamilton convention, as in Quaternion Multiply, whose product this reuses with the rate quaternion's scalar part set to zero.
  • Nonlinear, so deliberately no state space.
  • A zero rate holds the attitude exactly – the update term vanishes and the normalize is a no-op on an already-unit quaternion.

Code facts#

FactValue
registered typeRobotics/Orientation_3D/Gyro_Quaternion_Integration
familyRobotics/Orientation_3D
solver environment classICoreBlock_0_Robotics_1_Orientation_3D_2_Gyro_Quaternion_Integration
sourcesrc/ICoreSDK/ICoreBlockLibrary/Blocks/Robotics/Orientation_3D/Gyro_Quaternion_Integration/ICoreBlock_0_Robotics_1_Orientation_3D_2_Gyro_Quaternion_Integration.cpp
headersrc/ICoreSDK/ICoreBlockLibrary/Blocks/Robotics/Orientation_3D/Gyro_Quaternion_Integration/ICoreBlock_0_Robotics_1_Orientation_3D_2_Gyro_Quaternion_Integration.h
default size on canvas140 × 84 px
ports at insert1 in, 1 out
code generators implementedPython, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text

Ports#

#DirectionSignal typeDescription label
1inICoreDoubleomega
2outICoreDoubleq

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 variableDefaultSimulink parameter
Initial Quaternion[1; 0; 0; 0]

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.

supportSupport::None
Simulink path
port-count rulePortsParam::None
SampleTime parameteryes

Caveat (shown to the user): no Simulink equivalent available: attitude integration ships in the Aerospace Blockset, the Sensor Fusion and Tracking Toolbox and the Robotics System Toolbox, none of which is installed. Rebuild it on the Simulink side from a Discrete-Time Integrator and the product expansion, keeping the scalar-first (w, x, y, z) Hamilton convention this block uses

Catalog contract: src/ICoreSDK/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h

Description vs code#

The checker has a blind spot here — it could not resolve something (a grouped port bullet, a computed config name), which is reported and never counted as a pass. A reader has to settle it:

  • B0 every stimulus in the sample errored — cross-checks skipped

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).

Gyro Quaternion Integration — body rates to attitude q[k+1] = normalize( q[k] + (Ts/2) * q[k] (x) (0, omega[k]) )

Quaternion_Multiply plus a state and a norm. With the second operand's scalar part ZERO the Hamilton product's sixteen terms collapse to twelve, and those twelve are the OMEGA_TERMS table below - derived from that block's verified table, not re-derived by hand.

The output is the attitude at the START of the step (published before the update), the seed is config and never the live member, and the three HDL targets are simulation-only real because of the normalize. All three are explained in the header.

Sample results#

No stimulus produced a sampled output in this rig — Invalid input size at Gyro Quaternion Integration block: ICore Blocks/Home/Gyro Quaternion Integration. That is a fact about the single-block rig, not a verdict on the block: an offline batch fit, a block whose output only appears at onSolverFinish, or one that needs a driven environment cannot be exercised alone.

Category unsampled · sample time 0.1 · 60 steps · commit ccf005c8 · produced by docsSample --out <folder> --steps 60

Sample data: docs/generated/samples/Robotics__Orientation_3D__Gyro_Quaternion_Integration.json