Rotation 2D — Robotics/Coordinate Transforms
Robotics/Coordinate_Transforms/Rotation_2D · 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.
Rotation 2D
Robotics / Coordinate Transforms
Rotates a planar vector by an angle supplied on a port, y = R(θ)·u:
- y₀ = cosθ·u₀ − sinθ·u₁
- y₁ = sinθ·u₀ + cosθ·u₁
The rotation is active and counter-clockwise: a positive θ turns the vector within a fixed frame, so R(+90°) sends (1, 0) to (0, 1). For the opposite reading – re-expressing a fixed vector in a rotated frame – negate θ.
Ports
- u – the vector to rotate, a [2,1] column (x, y).
- theta – the rotation angle in radians, a scalar. It may be any value; nothing is wrapped, and cos/sin are periodic, so a raw accumulated heading is fine.
- y – the rotated vector, [2,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 – the angle arrives on a port.
The three HDL targets are simulation-only: they carry the arithmetic in
real and quantize only at the port boundary. A sine and a cosine per sample have no
Q16.16 form, so offering them as synthesizable would be a claim the generated core could not
keep.
Simulink bridge
None, measured rather than assumed: the planar rotation blocks ship in the Robotics System Toolbox and the Aerospace Blockset, neither of which is installed on this machine. The same rotation is easy to rebuild there from Trigonometric Function and Product blocks – keeping the active, counter-clockwise sense this block uses.
Notes
- Algebraic and stateless.
- Bilinear, so deliberately no state space – linear in u for a fixed θ, but θ is a signal, so the pair is nonlinear.
- θ is not wrapped, deliberately: cos and sin are periodic, so a heading that has been accumulating for hours rotates correctly. Angle Wrap exists for when the angle itself must be bounded.
- For a 3-D rotation use Quaternion Rotate Vector, or Quaternion To Rotation Matrix with Matrix Multiply.
Code facts#
| Fact | Value |
|---|---|
| registered type | Robotics/Coordinate_Transforms/Rotation_2D |
| family | Robotics/Coordinate_Transforms |
| solver environment class | ICoreBlock_0_Robotics_1_Coordinate_Transforms_2_Rotation_2D |
| source | src/ICoreSDK/ICoreBlockLibrary/Blocks/Robotics/Coordinate_Transforms/Rotation_2D/ICoreBlock_0_Robotics_1_Coordinate_Transforms_2_Rotation_2D.cpp |
| header | src/ICoreSDK/ICoreBlockLibrary/Blocks/Robotics/Coordinate_Transforms/Rotation_2D/ICoreBlock_0_Robotics_1_Coordinate_Transforms_2_Rotation_2D.h |
| default size on canvas | 126 × 84 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 | u |
| 2 | in | ICoreDouble | theta |
| 3 | out | ICoreDouble | y |
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::None |
| Simulink path | — |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
Caveat (shown to the user): no Simulink equivalent available: planar rotation blocks ship in the Robotics System Toolbox and the Aerospace Blockset, neither of which is installed. Rebuild it from Trigonometric Function and Product blocks, keeping the active, counter-clockwise 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:
B0every 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).
Rotation 2D — y = R(theta) * u, active and counter-clockwise y0 = cos(theta)*u0 - sin(theta)*u1 y1 = sin(theta)*u0 + cos(theta)*u1
Verified against the convention when written, since nothing downstream can: R(+90 deg) applied to (1, 0) gives (0, 1). The transposed matrix is equally self-consistent and would pass every row of every suite here - see the header.
cos and sin are emitted INLINE twice each rather than shared through a scratch, because VHDL supplies no real process variable (§4 gives
acc,acc2andiacc, all fixed-point or integer). Same shape in all eleven implementations.
Sample results#
No stimulus produced a sampled output in this rig — Invalid input size at Rotation 2D block: ICore Blocks/Home/Rotation 2D. 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__Coordinate_Transforms__Rotation_2D.json