Skip to content

Commit 0e60218

Browse files
petercorkeclaude
andauthored
docs: fix the math block in the tr2adjoint and tr2adjoint2 docstrings (#260)
## Problem The math block in the `tr2adjoint` and `tr2adjoint2` docstrings has never rendered, and would not have rendered correctly if it had: ```rst .. math: Ad(\mat{T}) \vec{X} X = \vee \left( \mat{T} \skew{\vec{X} \mat{T}^{-1} \right) ``` - **Single colon:** `.. math:` is not the directive (`.. math::` is). reST treats it as a comment, so the whole block was swallowed and nothing showed in the docs. - **Undefined macro:** `\skew` is not defined in `docs/source/conf.py`. The macros there are `\sk`, `\skx` and `\vex`. - **Unbalanced braces:** `\skew{...` was never closed. - **Stray `X`:** there is an extra trailing `X`, and `Ad` was set in italic, so it read as `A·d`. The inline `\mat{T} \in \SE3` below it only worked because `\SE` takes one argument, so `\SE3` parses as `\SE` applied to `3`. The docs elsewhere write `\SE{3}`. The 2D docstring was a copy of the 3D one, so both carried the same errors. The 3D text also named `tr2jac` and gave only the 6x6 size. ## Change - The block is now `.. math::` with `\mathrm{Ad}(\mat{T})\,\vec{X} = \vex{\mat{T}\,\sk{\vec{X}}\,\mat{T}^{-1}}`, written with the macros already defined in `conf.py`. No change to `conf.py` was needed. - `\SE3` and `\SE2` are now `\SE{3}` and `\SE{2}`. - The 3D text names `tr2adjoint` and gives 6x6 for SE(3), 3x3 for SO(3). Docstrings only, so no behavior change. ## Verification - Parsing each docstring with docutils: math-block nodes went from 0 to 1 for both functions. - Every macro in the formula is defined in `conf.py`, and the braces balance. - Searched the package for other single-colon `.. math:` directives and for `\skew`, `\SE3` or `\SO3`; none remain. - Full suite: 380 passed, 3 skipped. - Merge simulations against #225, #246, #248, #249, #258 and #259 are all clean. This PR and #259 both edit the `tr2adjoint2` docstring, but in separate hunks. **Not verified:** I have not looked at it rendered in a browser. MathJax runs client-side, so a docs build would show only the raw TeX. A quick look at the built page before merging would be worthwhile. Related: #259, which fixed the other 2D-specific text in `tr2adjoint2`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent 13cef32 commit 0e60218

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎spatialmath/base/transforms2d.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -790,11 +790,11 @@ def tr2adjoint2(T):
790790
791791
Computes an adjoint matrix that maps the Lie algebra between frames.
792792
793-
.. math:
793+
.. math::
794794
795-
Ad(\mat{T}) \vec{X} X = \vee \left( \mat{T} \skew{\vec{X} \mat{T}^{-1} \right)
795+
\mathrm{Ad}(\mat{T})\,\vec{X} = \vex{\mat{T}\,\sk{\vec{X}}\,\mat{T}^{-1}}
796796
797-
where :math:`\mat{T} \in \SE2`.
797+
where :math:`\mat{T} \in \SE{2}`.
798798
799799
``tr2adjoint2(T)`` is an adjoint matrix (3x3 for SE(2), 1x1 for SO(2)) that
800800
maps spatial velocity or differential motion between frame {B} to frame {A}

‎spatialmath/base/transforms3d.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,15 +2732,15 @@ def tr2adjoint(T):
27322732
27332733
Computes an adjoint matrix that maps the Lie algebra between frames.
27342734
2735-
.. math:
2735+
.. math::
27362736
2737-
Ad(\mat{T}) \vec{X} X = \vee \left( \mat{T} \skew{\vec{X} \mat{T}^{-1} \right)
2737+
\mathrm{Ad}(\mat{T})\,\vec{X} = \vex{\mat{T}\,\sk{\vec{X}}\,\mat{T}^{-1}}
27382738
2739-
where :math:`\mat{T} \in \SE3`.
2739+
where :math:`\mat{T} \in \SE{3}`.
27402740
2741-
``tr2jac(T)`` is an adjoint matrix (6x6) that maps spatial velocity or
2742-
differential motion between frame {B} to frame {A} which are attached to the
2743-
same moving body. The pose of {B} relative to {A} is represented by the
2741+
``tr2adjoint(T)`` is an adjoint matrix (6x6 for SE(3), 3x3 for SO(3)) that
2742+
maps spatial velocity or differential motion between frame {B} to frame {A}
2743+
which are attached to the same moving body. The pose of {B} relative to {A} is represented by the
27442744
homogeneous transform T = :math:`{}^A {\bf T}_B`.
27452745
27462746
.. runblock:: pycon

0 commit comments

Comments
 (0)