cu_transform
This library provides spatial transformation functionality for the Copper framework, including both pose (position and orientation) transformations and velocity transformations.
Features
- Efficient representation of 3D transformations using homogeneous matrices
- Time-stamped transforms for tracking movements through time
- Transform tree for managing parent-child relationships between coordinate frames
- Velocity transformations for motion planning and control
- High-performance caching for both transforms and velocity transforms
- Interpolation between transforms
- allocation free for real time operations
Usage
Transform Tree
The transform tree maintains a hierarchical relationship between coordinate frames:
use ;
use CuDuration;
Velocity Transforms
The cu_transform library also supports calculating and transforming velocities:
use ;
use CuDuration;
Velocity Transformation
Computing Velocity
Velocity is computed by differentiating transformations over time:
Frame Transformation
Velocities can be transformed between coordinate frames:
use ;
Technical Details
Velocity Transform Implementation
The velocity transformation follows the standard rigid body motion equations:
- Linear velocity transformation: v_b = R * v_a + ω × (R * p)
- Angular velocity transformation: ω_b = R * ω_a
Where:
- v_a is the linear velocity in frame A
- ω_a is the angular velocity in frame A
- R is the rotation matrix from A to B
- p is the position vector where velocity is measured
- × is the cross product
Transform Chain
When looking up velocity across multiple frames, the transform tree handles the chain of transformations properly, accumulating both linear and angular velocities correctly.
Caching Mechanism
Both transforms and velocity transforms utilize a high-performance caching system to accelerate repeated lookups:
The velocity cache significantly improves performance for:
- Real-time applications with frequent velocity lookups
- Applications with many coordinate frames
- Complex transform chains that would otherwise require expensive recalculation
The cache keys include frame IDs, timestamp, and a hash of the transform path, ensuring correctness when the transform tree structure changes.