Quaternion Conjugate — Robotics/Orientation 3D
Robotics/Orientation_3D/Quaternion_Conjugate · 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.
Quaternion Conjugate
Robotics / Orientation 3D
The conjugate of a quaternion stored scalar-first as [w x y z]T: the scalar part is kept and all three vector components change sign.
- q* = [w −x −y −z]T
For a unit quaternion the conjugate is the inverse, which is why rotation code reaches for it: conjugating the quaternion that carries a rotation gives the rotation back the other way. For a quaternion that is not unit the two differ – q* ⊗ q = |q|2 rather than 1 – and Quaternion Inverse is the block that divides that out.
Ports
- q – the quaternion to conjugate, a [4,1] column [w x y z]T. The size is fixed: a quaternion is four numbers.
- q* – the conjugate, also [4,1]. Its size does not follow the input, because there is only one size a quaternion can have.
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 – the quaternion arrives on a port and the three signs are structural.
The three HDL targets are genuinely synthesizable Q16.16, and this is the one block of its family where that costs nothing: a conjugate is one copy and three two's-complement negations, with no multiply, division, square root or trigonometry, so nothing rounds and the fixed-point export is bit-exact against the reference rather than merely close.
Simulink bridge
Both directions, onto
aerolibutil/Quaternion Conjugate in the Aerospace
Blockset. The block has no configuration, so no parameter pairs cross.
Two things about that path are worth knowing, both measured rather than
assumed. Its name is drawn on two lines, so the real path carries an
embedded newline between Quaternion and
Conjugate; the flattened one-line spelling resolves to nothing.
And the block defines no SampleTime parameter – its
dialog has no parameters at all – so the rate stays on the ICore side, and
a block configured with an explicit positive rate reports that the rate did not
cross.
Notes
- Algebraic and stateless: the output depends only on the current input, so the block cannot break an algebraic loop.
- Scalar-first (w, x, y, z), Hamilton convention – the PyTorch/Eigen/textbook order, not the JPL convention, which stores the scalar last. Nothing in a signal says which convention it carries, so a quaternion wired in from elsewhere has to be checked at its source: under the scalar-last reading this block would negate w, x, y and keep z, which is a plausible-looking quaternion and the wrong one.
- Deliberately no state space. The map is linear – it is multiplication by diag(1, −1, −1, −1) – so a feed-through form could be fabricated; it is not, because model reduction merges only SISO blocks and this one is 4×4. A Gain carrying that same diagonal matrix is the block to reach for when a mergeable form is what you want.
- The conjugate is an involution: applying it twice returns the original quaternion exactly, in every one of the ten backends, because negation is exact in both floating point and Q16.16.
Code facts#
| Fact | Value |
|---|---|
| registered type | Robotics/Orientation_3D/Quaternion_Conjugate |
| family | Robotics/Orientation_3D |
| solver environment class | ICoreBlock_0_Robotics_1_Orientation_3D_2_Quaternion_Conjugate |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Robotics/Orientation_3D/Quaternion_Conjugate/ICoreBlock_0_Robotics_1_Orientation_3D_2_Quaternion_Conjugate.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Robotics/Orientation_3D/Quaternion_Conjugate/ICoreBlock_0_Robotics_1_Orientation_3D_2_Quaternion_Conjugate.h |
| default size on canvas | 112 × 70 px |
| ports at insert | 1 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 | q |
| 2 | out | ICoreDouble | q* |
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.
Simulink bridge#
| support | Support::Both |
| Simulink path | aerolibutil/Quaternion\nConjugate |
| port-count rule | PortsParam::None |
SampleTime parameter | no — the counterpart defines none; the rate stays on the ICore side |
Caveat (shown to the user): the Aerospace Blockset block is a masked subsystem with no dialog parameters at all, so nothing but the signal crosses. Note it defines no SampleTime parameter: an ICore rate set explicitly stays on this side and is reported
Catalog contract: src/ICoreBlocks/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:
B0no sample under docs/generated/samples/ — nothing to cross-check (P8.1)
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 Conjugate — q* = [w, -x, -y, -z], scalar-first [4,1] The scalar part is kept; all three vector components are negated. That is the whole block.
MEASURED against aerolibutil/Quaternion Conjugate (R2026a, 2026-09-09): q = [0.3 0.5 -0.7 0.2] answers [0.3 -0.5 0.7 -0.2]. The Simulink block accepts a [4,1] COLUMN as readily as a row -- also measured -- so this block's column convention crosses without a reshape.
⚠ THE SIMULINK COUNTERPART HAS NO SampleTime PARAMETER. Probed with get_param(..., 'DialogParameters'), which comes back with no fields at all: aerolibutil's masked subsystems expose none. set_param on a parameter a block does not define is a HARD MATLAB error that aborts the whole generated script, so the catalog entry sets hasSampleTimeParam = false and the testbench passes no 'SampleTime' either.
⚠ AND ITS LIBRARY PATH CARRIES AN EMBEDDED NEWLINE. The block's name is drawn on two lines, so the add_block path is "aerolibutil/Quaternion\nConjugate" -- one character different from the flattened spelling, which resolves to nothing. The raw form is in toolbox_block_enumeration.tsv, which is the authority for it.
No config of any kind, so no loadBlockConfig() call is needed anywhere: the generators bake in no constant and read no config map.
Sample results#
No sample run is committed for this block. Samples come from the headless harness (DOCS_PLAN.md P8.1) into docs/generated/samples/; until one exists this block's behaviour is witnessed by the parity and export-verification suites, not by a plot here.