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

Quaternion Rotate Vector — Robotics/Orientation 3D

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

Quaternion Rotate Vector

Robotics / Orientation 3D

Rotates a 3-vector by a quaternion: v′ = q ⊗ (0, v) ⊗ q*, with q a scalar-first [4,1] quaternion and v a [3,1] column. The rotation is active and right-handed: a 90° rotation about +z sends to .

This is the block that turns an attitude estimate into a world-frame vector – body accelerations into navigation frame, a body-frame lever arm into world coordinates.

Ports

  • q – the rotation, a [4,1] column [w x y z]T.
  • v – the vector to rotate, [3,1].
  • v_rot – the rotated vector, [3,1]. Its size is fixed, not inherited.

Parameters

  • 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. There is no tunable parameter, because the block has no parameter at all – both operands arrive on ports.

The three HDL targets are genuinely synthesizable Q16.16: the conjugation is expanded into products and sums, with no division, square root or trigonometry anywhere.

Simulink bridge

None, measured rather than assumed: the quaternion rotation blocks ship in the Aerospace Blockset and the Robotics System Toolbox, neither of which is installed on this machine. A model carrying this block exports with the block reported rather than silently dropped.

Notes

  • Algebraic and stateless.
  • Scalar-first (w, x, y, z), Hamilton convention – the same as Quaternion Multiply and Quaternion To Rotation Matrix, and not the JPL convention.
  • Identical to Quaternion To Rotation Matrix followed by Matrix Multiply. Use this block when the matrix itself is not wanted; use the pair when the same rotation is applied to several vectors, since the nine entries are then computed once.
  • The quaternion is assumed to be a UNIT quaternion, and the block does not normalize it. The formula as written is the contract for a non-unit q too – that is what keeps a square root and a division out of every target, the fixed-point ones included. Put Normalizer (L2 mode) upstream when the source cannot guarantee it.
  • Bilinear in (q, v) and quadratic in q, so deliberately no state space.
  • A vector PARALLEL to the quaternion's axis comes back unchanged – that is the rotation being correct, not the block doing nothing, but it does make such a pair useless as a test of it.

Code facts#

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

Ports#

#DirectionSignal typeDescription label
1inICoreDoubleq
2inICoreDoublev
3outICoreDoublev_rot

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#

No config variable beyond the Sampling Time (s) every block carries.

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: quaternion rotation ships in the Aerospace Blockset and the Robotics System Toolbox, neither of which is installed. Rebuild it on the Simulink side from Product and Sum blocks, keeping the scalar-first (w, x, y, z) Hamilton convention and the active sense 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).

Quaternion Rotate Vector — v' = q (x) (0, v) (x) q* Expanded to v' = R(q)*v, with R's nine entries built exactly as Quaternion_To_Rotation_Matrix builds them. See the header for why the R-form rather than the textbook t = 2(u x v) form: the latter needs three fixed-point intermediates live at once and VHDL supplies two, so it is not expressible without changing the shared HDL base.

⚠ The coefficient rule is duplicated from Quaternion_To_Rotation_Matrix rather than shared through a header - the same way Cartesian_To_Polar reuses Trigonometric_Function's atan2 solutions verbatim - because blocks in this library are self-contained translation units.

⚠ AND NO SUITE CAN CATCH THE TWO COPIES DRIFTING APART. Export verification compares each block against ICore's own simulation of THAT block, so if this file's coefficients were transposed and the matrix block's were not, both rigs would still be 10/10 green - the same blind spot as a vacuous rig. Nor would Simulink parity help: neither block has a counterpart. So the equality is held by two checks made by hand when the pair was written (2026-08-13), and anyone editing either copy owes them again:

  1. The shared region - RotCoeff, coeffAt, coeffValue, coeffExpr - is byte-identical in the

two .cpp files. Diff it; it was 23 lines and matched exactly.

  1. The rule itself was checked against q (x) (0, v) (x) q* built from Quaternion_Multiply's

own verified term table, over 100 (q, v) pairs: worst |difference| 8.9e-16, with R'R = I to 4.4e-16 and Rz(90 deg) * x_hat = y_hat confirming the active, right-handed sense. That is what actually rules out a transposed R.

Sample results#

No stimulus produced a sampled output in this rig — Invalid input size at Quaternion Rotate Vector block: ICore Blocks/Home/Quaternion Rotate Vector. 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__Quaternion_Rotate_Vector.json