pub struct URDFChain<const N: usize, F: FKScalar = f32> { /* private fields */ }Expand description
FK chain using exact URDF joint transforms.
Accumulation works directly on columns:
- Translation:
t += fx·c0 + fy·c1 + fz·c2 - Fixed rotation:
(c0,c1,c2) = (c0,c1,c2) * fixed_rot - Joint rotation: 2D rotation on the appropriate column pair
When fixed_rot is identity (RPY = 0, the common case), step 2 is
skipped entirely, making per-joint cost a single 2D column rotation
plus translation — cheaper than DH.
Implementations§
Source§impl<const N: usize> URDFChain<N, f32>
impl<const N: usize> URDFChain<N, f32>
Sourcepub const fn new(joints: [URDFJoint; N]) -> Result<Self, URDFBuildError>
pub const fn new(joints: [URDFJoint; N]) -> Result<Self, URDFBuildError>
Build a chain from exactly N actuated (revolute) joints. Returns
URDFBuildError::JointTypeMismatch if any entry is Fixed or
Prismatic. For a slice that mixes fixed joints in, use
URDFChain::from_urdf instead.
Sourcepub const fn from_urdf(joints: &[URDFJoint]) -> Result<Self, URDFBuildError>
pub const fn from_urdf(joints: &[URDFJoint]) -> Result<Self, URDFBuildError>
Build a chain from a flat URDF joint list (any mix of Fixed,
Revolute, and/or Prismatic). The list must describe a single
branch in parent→child order.
- Leading
Fixedjoints become the prefix (applied before joint 0). - Trailing
Fixedjoints become the suffix (applied after the last actuated joint). Fixedjoints sandwiched between actuated joints are folded into the origin of the next actuated joint so the kinematics are preserved exactly.- The number of
Revolutejoints must equalN.
Returns URDFBuildError::JointTypeMismatch if a Prismatic joint
appears (not handled by URDFChain itself — wrap the result in
PrismaticFK for a prismatic joint at the start
or end), or URDFBuildError::RevoluteCountMismatch if the revolute
count doesn’t match N.
Sourcepub const fn with_fixed_prefix(
self,
joints: &[URDFJoint],
) -> Result<Self, URDFBuildError>
pub const fn with_fixed_prefix( self, joints: &[URDFJoint], ) -> Result<Self, URDFBuildError>
Bake a sequence of URDF fixed-joint origins (parent→child order) into the base side of the chain.
Sourcepub const fn with_fixed_suffix(
self,
joints: &[URDFJoint],
) -> Result<Self, URDFBuildError>
pub const fn with_fixed_suffix( self, joints: &[URDFJoint], ) -> Result<Self, URDFBuildError>
Bake a sequence of URDF fixed-joint origins (parent→child order) into the tool side of the chain.
Sourcepub const fn with_fixed_joints(
self,
prefix: &[URDFJoint],
suffix: &[URDFJoint],
) -> Result<Self, URDFBuildError>
pub const fn with_fixed_joints( self, prefix: &[URDFJoint], suffix: &[URDFJoint], ) -> Result<Self, URDFBuildError>
Convenience: set both a fixed-joint prefix and suffix in one call.
Source§impl<const N: usize> URDFChain<N, f64>
impl<const N: usize> URDFChain<N, f64>
Sourcepub const fn new_f64(joints: [URDFJoint; N]) -> Result<Self, URDFBuildError>
pub const fn new_f64(joints: [URDFJoint; N]) -> Result<Self, URDFBuildError>
const-evaluable f64 analogue of URDFChain::<N, f32>::new.
Sourcepub const fn from_urdf_f64(joints: &[URDFJoint]) -> Result<Self, URDFBuildError>
pub const fn from_urdf_f64(joints: &[URDFJoint]) -> Result<Self, URDFBuildError>
const-evaluable f64 analogue of URDFChain::<N, f32>::from_urdf.
Sourcepub const fn with_fixed_prefix_f64(
self,
joints: &[URDFJoint],
) -> Result<Self, URDFBuildError>
pub const fn with_fixed_prefix_f64( self, joints: &[URDFJoint], ) -> Result<Self, URDFBuildError>
const-evaluable f64 analogue of URDFChain::<N, f32>::with_fixed_prefix.
Sourcepub const fn with_fixed_suffix_f64(
self,
joints: &[URDFJoint],
) -> Result<Self, URDFBuildError>
pub const fn with_fixed_suffix_f64( self, joints: &[URDFJoint], ) -> Result<Self, URDFBuildError>
const-evaluable f64 analogue of URDFChain::<N, f32>::with_fixed_suffix.
Sourcepub const fn with_fixed_joints_f64(
self,
prefix: &[URDFJoint],
suffix: &[URDFJoint],
) -> Result<Self, URDFBuildError>
pub const fn with_fixed_joints_f64( self, prefix: &[URDFJoint], suffix: &[URDFJoint], ) -> Result<Self, URDFBuildError>
Convenience: set both a fixed-joint prefix and suffix in one call (f64).
Trait Implementations§
Source§impl<const N: usize, F: FKScalar> FKChain<N, F> for URDFChain<N, F>
impl<const N: usize, F: FKScalar> FKChain<N, F> for URDFChain<N, F>
type Error = DekeError
Source§fn base_tf(&self) -> F::AAffine3
fn base_tf(&self) -> F::AAffine3
TransformedFK with a prefix set, or URDFChain
with fixed leading joints baked in) override this so downstream
consumers (collision validators, visualizers) can place the static
base body at the correct pose.fn fk(&self, q: &SRobotQ<N, F>) -> Result<[F::AAffine3; N], Self::Error>
fn fk_end(&self, q: &SRobotQ<N, F>) -> Result<F::AAffine3, Self::Error>
Source§fn all_fk(
&self,
q: &SRobotQ<N, F>,
) -> Result<(F::AAffine3, [F::AAffine3; N], F::AAffine3), Self::Error>
fn all_fk( &self, q: &SRobotQ<N, F>, ) -> Result<(F::AAffine3, [F::AAffine3; N], F::AAffine3), Self::Error>
Source§fn joint_axes_positions(
&self,
q: &SRobotQ<N, F>,
) -> Result<([F::AVec3; N], [F::AVec3; N], F::AVec3), Self::Error>
fn joint_axes_positions( &self, q: &SRobotQ<N, F>, ) -> Result<([F::AVec3; N], [F::AVec3; N], F::AVec3), Self::Error>
q, plus the end-effector position.fn dof(&self) -> usize
Source§fn max_reach(&self) -> Result<F, Self::Error>
fn max_reach(&self) -> Result<F, Self::Error>
Source§fn jacobian(&self, q: &SRobotQ<N, F>) -> Result<[[F; N]; 6], Self::Error>
fn jacobian(&self, q: &SRobotQ<N, F>) -> Result<[[F; N]; 6], Self::Error>
q.
Rows 0–2: linear velocity, rows 3–5: angular velocity.