Contents — find the section you need
Change parameters and verify
Open the panel, then press Run to load Python. You can stop execution and reset parameters. Results are computed on this device. No Python installation is required.
Local execution steps below are optional for reproducing the source results; they are not required for the browser experiment.
Background and reading guide
Background Vectors and matrix multiplication.
Fundamentals · Follow the worked examples and checks under the stated conditions.
Browser experiment conditions
Use the experiment above to change rotation, the world coordinates of frame B's origin, and the input point in local coordinates. World frame A and local frame B use column vectors: p_A = R_AB p_B + t_AB. Positive angles are counterclockwise and distances are metres. Defaults reproduce the example below: 90° rotation, translation (1, 2) m and local point (2, 0) m give world point (1, 4) m.
Every plotted position is expressed in world frame A, with equal x/y scale. Arrows show the positive frame axes (1 m long); the blue segment runs from B's origin to the transformed point. Local input coordinates are not plotted as though they were world coordinates. The inverse R_AB^T (p_A - t_AB) recovers the input; round-trip error is the Euclidean distance between the recovered and original local point.
Save a result as A and run another condition for an overlay. Comparison case A/B names are separate from coordinate frame A/B names. This is an ideal two-dimensional rigid transform without noise or timestamp offsets; it does not execute three-dimensional quaternions or ROS TF.
Download the same entrypoint and rotation kernel used in the browser. Local reproduction below is optional.
Start a coordinate transform by stating which frame describes the input point and which frame should describe the output. Correct matrix arithmetic with the direction reversed still places objects incorrectly.
Read subscripts as direction
Let R_AB map B coordinates into A coordinates, and t_AB be B's origin expressed in A. We use column vectors:
Columns of the rotation matrix are B's axes expressed in A. Translation is also expressed in A. Points receive translation; free vectors such as directions only rotate. Applying identical handling to every three-element array confuses these meanings.
A sensor rotated by ninety degrees
In 2D, place B's origin at (1, 2) m in A and point B's x-axis along A's y-axis. A point (2, 0) m in B becomes:
The transforms function in the Python script checks this result and its inverse. It was executed with Python 3.12.3, NumPy 1.26.4 and Matplotlib 3.6.3. Run python3 engineering_labs.py to regenerate the figure and results.
To regenerate, save the linked script as engineering_labs.py in a new directory and run it there. Outputs go to the working directory: this figure is transforms.svg, and the checked coordinates are under transform in engineering-results.json. The same script also generates Kalman, ICP, frequency-response and aliasing figures and CSVs. Use an empty working directory because existing output files are overwritten.
Inverting requires more than negating translation
A rotation matrix's inverse is its transpose:
Subtract (1, 2) from (1, 4), then rotate −90° to recover (2, 0). Inverse translation is (−2, 1), not simply (−1, −2). Round-trip arbitrary points to detect direction mistakes.
Compose homogeneous transforms
In 3D, a 4×4 matrix combines rotation and translation:
The rightmost transform acts first. With map A, body B and sensor C, a point moves sensor→body→map. Matrix multiplication generally cannot be reordered. Matching the intermediate B also helps variable naming.
Quaternions represent the same rotation
For unit axis u and angle θ, ROS component order (x, y, z, w) gives:
A 90° rotation around z is (0, 0, 0.7071, 0.7071). Some libraries use (w, x, y, z), so verify ordering before copying arrays. q and −q encode the same rotation; component subtraction alone is not a rotation-error metric. Check normalization too.
REP-103 defines ROS right-handed SI conventions, body x-forward/y-left/z-up and optical z-forward/x-right/y-down. Check conventions first when camera geometry appears rotated.
TF also depends on time
Read a parent/child transform as the child's pose expressed in its parent, matching T_AB above. Point-transform APIs require careful target/source frame selection. A fixed mounting transform differs from a time-varying vehicle pose.
REP-105 distinguishes globally corrected map, which can jump, from continuous but drifting odom. Correct matrices at the wrong timestamp still misplace moving-sensor points. Continue with sensor-fusion debugging to check direction and timing together.
Comments
Please log in to post a comment
No comments yet.