pub struct Pose { /* private fields */ }Expand description
Use Frame::add_pose to create a new pose.
Implementations§
Source§impl Pose
impl Pose
Sourcepub fn frame(&self) -> Option<Frame>
pub fn frame(&self) -> Option<Frame>
Returns the parent frame of this pose.
§Returns
Some(Frame) if the parent frame is still valid, or None if the frame
has been dropped or no longer exists.
§Example
use cartesian_tree::Frame;
use nalgebra::{Vector3, UnitQuaternion};
let frame = Frame::new_origin("base");
let pose = frame.add_pose(Vector3::new(0.0, 0.0, 0.0), UnitQuaternion::identity());
assert_eq!(pose.frame().unwrap().name(), "base");Sourcepub const fn transformation(&self) -> Isometry3<f64>
pub const fn transformation(&self) -> Isometry3<f64>
Returns the transformation from this pose to its parent frame.
§Returns
The transformation of the pose in its parent frame.
Sourcepub const fn position(&self) -> Vector3<f64>
pub const fn position(&self) -> Vector3<f64>
Returns the position of this pose relative to its parent frame.
§Returns
The position of the pose in its parent frame.
Sourcepub fn orientation(&self) -> Rotation
pub fn orientation(&self) -> Rotation
Returns the orientation of this pose relative to its parent frame.
§Returns
The orientation of the pose in its parent frame.
Sourcepub fn set(&mut self, position: Vector3<f64>, orientation: impl Into<Rotation>)
pub fn set(&mut self, position: Vector3<f64>, orientation: impl Into<Rotation>)
Sets the pose’s transformation relative to its parent.
§Arguments
position: A 3D vector representing the new translational offset from the parent.orientation: An orientation convertible into a unit quaternion for new orientational offset from the parent.
§Example
use cartesian_tree::Frame;
use nalgebra::{Vector3, UnitQuaternion};
let root = Frame::new_origin("root");
let mut pose = root.add_pose(Vector3::new(0.0, 0.0, 1.0), UnitQuaternion::identity());
pose.set(Vector3::new(1.0, 0.0, 0.0), UnitQuaternion::identity());Sourcepub fn apply_in_parent_frame(&mut self, isometry: &Isometry3<f64>)
pub fn apply_in_parent_frame(&mut self, isometry: &Isometry3<f64>)
Applies the provided isometry interpreted in the parent frame to the pose.
§Arguments
isometry: The isometry (describing a motion in the parent frame coordinates) to apply to the current transformation.
§Example
use cartesian_tree::Frame;
use nalgebra::{Isometry3, Translation3, Vector3, UnitQuaternion};
let root = Frame::new_origin("root");
let mut pose = root.add_pose(Vector3::new(0.0, 0.0, 1.0), UnitQuaternion::identity());
pose.apply_in_parent_frame(&Isometry3::from_parts(Translation3::new(1.0, 0.0, 0.0), UnitQuaternion::identity()));Sourcepub fn apply_in_local_frame(&mut self, isometry: &Isometry3<f64>)
pub fn apply_in_local_frame(&mut self, isometry: &Isometry3<f64>)
Applies the provided isometry interpreted in the body frame to this pose.
§Arguments
isometry: The isometry (describing a motion in the body frame coordinates) to apply to the current transformation.
§Example
use cartesian_tree::Frame;
use nalgebra::{Isometry3, Translation3, Vector3, UnitQuaternion};
let root = Frame::new_origin("root");
let mut pose = root.add_pose(Vector3::new(0.0, 0.0, 1.0), UnitQuaternion::identity());
pose.apply_in_local_frame(&Isometry3::from_parts(Translation3::new(1.0, 0.0, 0.0), UnitQuaternion::identity()));Sourcepub fn in_frame(&self, target: &Frame) -> Result<Self, CartesianTreeError>
pub fn in_frame(&self, target: &Frame) -> Result<Self, CartesianTreeError>
Transforms this pose into the coordinate system of the given target frame.
§Arguments
target- The frame to express this pose in.
§Returns
A new Pose, expressed in the target frame.
§Errors
Returns a CartesianTreeError if:
- The frame hierarchy cannot be resolved (e.g., due to dropped frames).
- There is no common ancestor between
selfandtarget.
§Example
use cartesian_tree::Frame;
use nalgebra::{Vector3, UnitQuaternion};
let root = Frame::new_origin("root");
let pose = root.add_pose(Vector3::new(0.0, 0.0, 1.0), UnitQuaternion::identity());
let new_frame = root.add_child("child", Vector3::new(1.0, 0.0, 0.0), UnitQuaternion::identity()).unwrap();
let pose_in_new_frame = pose.in_frame(&new_frame);Trait Implementations§
Source§impl Add<LazyTranslation> for &Pose
impl Add<LazyTranslation> for &Pose
Source§impl Mul<LazyRotation> for &Pose
impl Mul<LazyRotation> for &Pose
Auto Trait Implementations§
impl Freeze for Pose
impl !RefUnwindSafe for Pose
impl !Send for Pose
impl !Sync for Pose
impl Unpin for Pose
impl !UnwindSafe for Pose
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.