Contents — find the section you need
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.
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.