diff --git a/README.md b/README.md index 2ceeb66..7470d36 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,11 @@ Simply wrap the `Register` in a ROS node, subscribing to pose updates and publis - `source venv/bin/activate` (Linux/Mac) or `venv\Scripts\activate` (Windows) - Install package with dev and test dependencies - `pip install -e '.[dev,test]'` + +# Implementation Details + +- Transforms are stored as a tree starting from the world frame (provided at `Registry` initialization). +- To optimize run-time performance, the paths between all pairs of frames are eagerly precomputed and stored when a frame is added. + - Therefore, the runtime complexity on request is proportional to the shortest path, instead of all frames in the case of a full graph search. +- Transitive transforms themselves are only computed on-demand because an intermediate transform can change. + - This is preferred because poses often change more often than they are requested. diff --git a/frame_transforms/transforms.py b/frame_transforms/transforms.py index 37a0e47..164ba33 100644 --- a/frame_transforms/transforms.py +++ b/frame_transforms/transforms.py @@ -80,7 +80,7 @@ def __matmul__(self, other: TransformTarget_t) -> TransformTarget_t: or a 4x4 homogeneous transformation matrix. """ if isinstance(other, Transform): - # Correct transformation composition: rotate other's translation, then add this translation + # Rotate other's translation, then add this translation new_translation = self._translation + self._rotation.apply( other.translation ) @@ -95,7 +95,7 @@ def __matmul__(self, other: TransformTarget_t) -> TransformTarget_t: case (4, 4): return self.as_matrix() @ other case (3,): - # Correct vector transformation: rotate first, then translate + # Rotate first, then translate return np.array(self._rotation.apply(other) + self._translation) # type: ignore[return-value] case _: raise ValueError( @@ -181,8 +181,8 @@ class Registry(Generic[FrameID_T]): """ Registry of coordinate frames and corresponding transforms. - Automatically computes transitive tramsforms between frames if possible by - maintaining a directed acyclic graph (DAG) of relationships. + Automatically computes transitive transforms between frames if possible by + maintaining a tree of relationships. Made for use with 4x4 3D transformation matrices. """ diff --git a/pyproject.toml b/pyproject.toml index e9da53f..f1c81ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "frame-transforms" -version = "0.3.0" +version = "0.3.1" readme = "README.md" python = "^3.10"