Repository navigation
feat: Add Rotation * Pose and Pose * Rotation transformations - #127
Open
vamshidharre wants to merge 1 commit into
Open
vamshidharre wants to merge 1 commit into
vamshidharre wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In spatial applications, robotics, and aerospace navigation, transforming an object's pose across coordinate frames related by a pure rotation (such as NED to ENU, or body-axis rotations) is a common requirement.
Previously in
sguaba::engineering,Pose<In>only implementedMulwithRigidBodyTransform, but notRotation. Every other spatial primitive (Coordinate,Vector,Bearing,Orientation) supported multiplication with bothRotationandRigidBodyTransform. As a result, users wanting to transform aPoseusing aRotationwere forced to either manually decompose and reconstruct the pose (Pose::new(pose.position() * rot, pose.orientation() * rot)) or wrap the rotation in anunsafeRigidBodyTransform::new.This PR completes the algebra:
Mul<Rotation<From, To>> for Pose<From>(Pose * Rotation -> Pose<To>).Mul<Pose<To>> for Rotation<From, To>(Rotation * Pose -> Pose<From>).Rotation::transform(pose)andRotation::inverse_transform(pose)via existingMulbounds.Pose::origin()&Pose::aligned():Pose::origin()andPose::aligned()constructors returning an object atCoordinate::origin()withOrientation::aligned(), matchingCoordinate::origin()andOrientation::aligned().AbsDiffEq&RelativeEqforOrientationandPose:approx::{AbsDiffEq, RelativeEq}forOrientation<In>andPose<In>under#[cfg(any(test, feature = "approx"))], delegating directly to their underlyingRotationandRigidBodyTransformrepresentations. This brings complete uniformity withCoordinate,Vector,Rotation, andRigidBodyTransform.pose_rotation_transform_round_tripverifying NED <-> ENU transformations.pose_arbitrary_rotation_round_tripacross arbitrary 3D Tait-Bryan rotations, verifying invariance ofdistance_from_origin(), component-wise identity, and round-trip consistency.Verification
cargo test --all-targetspassed (248 tests).cargo test --docpassed (48 doctests + 16 compile-fail tests).cargo clippy --all-featurespassed with zero warnings.cargo check --no-default-features --features libmpassed (#![no_std]compatibility).cargo fmt -- --checkclean.