pub struct FPDispatch<const N: usize, FK32, FK64>{ /* private fields */ }Expand description
FK chain wrapper that holds both an f32 and an f64 representation of
the same kinematic chain and dispatches to the correct precision when an
FKChain<N, F> method is invoked.
The two inner chains are expected to describe the same robot — typically
the f64 is canonical and the f32 is derived from it (see
FPDispatch::from_f64). Callers that already have both built can use
FPDispatch::new.
Use this when the same robot needs to be consumed by stages with different
precision requirements: e.g. an RRT planner runs on f32 for SIMD speed,
while a TOPP retimer runs on f64 for solver stability. A single
FPDispatch can be passed to both — each picks up the precision-correct
FKChain impl via type inference.
use deke_types::{DHChain, DHJoint, FKChain, FPDispatch, SRobotQ};
// Author the robot once in f64 (e.g. from a const URDF table).
const ARM: DHChain<2, f64> = DHChain::<2, f64>::new_f64([
DHJoint { a: 1.0, alpha: 0.0, d: 0.0, theta_offset: 0.0 },
DHJoint { a: 1.0, alpha: 0.0, d: 0.0, theta_offset: 0.0 },
]);
// Derive the f32 chain via the cheap From cast and bundle them.
let dispatch: FPDispatch<2, DHChain<2, f32>, DHChain<2, f64>> =
FPDispatch::from_f64(ARM);
// f32 consumers get the SIMD path:
let q32 = SRobotQ::<2, f32>::from_array([0.5, -0.3]);
let _ = <FPDispatch<_, _, _> as FKChain<2, f32>>::fk_end(&dispatch, &q32).unwrap();
// f64 consumers get the precise path:
let q64 = SRobotQ::<2, f64>::from_array([0.5, -0.3]);
let _ = <FPDispatch<_, _, _> as FKChain<2, f64>>::fk_end(&dispatch, &q64).unwrap();Implementations§
Source§impl<const N: usize, FK32, FK64> FPDispatch<N, FK32, FK64>
impl<const N: usize, FK32, FK64> FPDispatch<N, FK32, FK64>
Source§impl<const N: usize, FK32, FK64> FPDispatch<N, FK32, FK64>
impl<const N: usize, FK32, FK64> FPDispatch<N, FK32, FK64>
Trait Implementations§
Source§impl<const N: usize, FK32, FK64> Clone for FPDispatch<N, FK32, FK64>
impl<const N: usize, FK32, FK64> Clone for FPDispatch<N, FK32, FK64>
Source§fn clone(&self) -> FPDispatch<N, FK32, FK64>
fn clone(&self) -> FPDispatch<N, FK32, FK64>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const N: usize, FK32, FK64> Debug for FPDispatch<N, FK32, FK64>
impl<const N: usize, FK32, FK64> Debug for FPDispatch<N, FK32, FK64>
Source§impl<const N: usize, FK32, FK64> FKChain<N> for FPDispatch<N, FK32, FK64>
impl<const N: usize, FK32, FK64> FKChain<N> for FPDispatch<N, FK32, FK64>
type Error = <FK32 as FKChain<N>>::Error
Source§fn base_tf(&self) -> f32::AAffine3
fn base_tf(&self) -> f32::AAffine3
Configuration-independent transform from the robot’s base frame to the
world frame. Defaults to identity; wrappers that install a static
prefix (e.g.
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.Source§fn max_reach(&self) -> Result<f32, Self::Error>
fn max_reach(&self) -> Result<f32, Self::Error>
Theoretical maximum reach: sum of link lengths (upper bound, ignores joint limits).
fn fk(&self, q: &SRobotQ<N, f32>) -> Result<[f32::AAffine3; N], Self::Error>
fn fk_end(&self, q: &SRobotQ<N, f32>) -> Result<f32::AAffine3, Self::Error>
Source§fn all_fk(
&self,
q: &SRobotQ<N, f32>,
) -> Result<(f32::AAffine3, [f32::AAffine3; N], f32::AAffine3), Self::Error>
fn all_fk( &self, q: &SRobotQ<N, f32>, ) -> Result<(f32::AAffine3, [f32::AAffine3; N], f32::AAffine3), Self::Error>
Source§fn joint_axes_positions(
&self,
q: &SRobotQ<N, f32>,
) -> Result<([f32::AVec3; N], [f32::AVec3; N], f32::AVec3), Self::Error>
fn joint_axes_positions( &self, q: &SRobotQ<N, f32>, ) -> Result<([f32::AVec3; N], [f32::AVec3; N], f32::AVec3), Self::Error>
Returns joint rotation axes and axis-origin positions in world frame at
configuration
q, plus the end-effector position.Source§fn jacobian(&self, q: &SRobotQ<N, f32>) -> Result<[[f32; N]; 6], Self::Error>
fn jacobian(&self, q: &SRobotQ<N, f32>) -> Result<[[f32; N]; 6], Self::Error>
Geometric Jacobian (6×N) at configuration
q.
Rows 0–2: linear velocity, rows 3–5: angular velocity.Source§fn jacobian_dot(
&self,
q: &SRobotQ<N, f32>,
qdot: &SRobotQ<N, f32>,
) -> Result<[[f32; N]; 6], Self::Error>
fn jacobian_dot( &self, q: &SRobotQ<N, f32>, qdot: &SRobotQ<N, f32>, ) -> Result<[[f32; N]; 6], Self::Error>
First time-derivative of the geometric Jacobian.
Source§fn jacobian_ddot(
&self,
q: &SRobotQ<N, f32>,
qdot: &SRobotQ<N, f32>,
qddot: &SRobotQ<N, f32>,
) -> Result<[[f32; N]; 6], Self::Error>
fn jacobian_ddot( &self, q: &SRobotQ<N, f32>, qdot: &SRobotQ<N, f32>, qddot: &SRobotQ<N, f32>, ) -> Result<[[f32; N]; 6], Self::Error>
Second time-derivative of the geometric Jacobian.
fn dof(&self) -> usize
Source§impl<const N: usize, FK32, FK64> FKChain<N, f64> for FPDispatch<N, FK32, FK64>
impl<const N: usize, FK32, FK64> FKChain<N, f64> for FPDispatch<N, FK32, FK64>
type Error = <FK64 as FKChain<N, f64>>::Error
Source§fn base_tf(&self) -> f64::AAffine3
fn base_tf(&self) -> f64::AAffine3
Configuration-independent transform from the robot’s base frame to the
world frame. Defaults to identity; wrappers that install a static
prefix (e.g.
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.Source§fn max_reach(&self) -> Result<f64, Self::Error>
fn max_reach(&self) -> Result<f64, Self::Error>
Theoretical maximum reach: sum of link lengths (upper bound, ignores joint limits).
fn fk(&self, q: &SRobotQ<N, f64>) -> Result<[f64::AAffine3; N], Self::Error>
fn fk_end(&self, q: &SRobotQ<N, f64>) -> Result<f64::AAffine3, Self::Error>
Source§fn all_fk(
&self,
q: &SRobotQ<N, f64>,
) -> Result<(f64::AAffine3, [f64::AAffine3; N], f64::AAffine3), Self::Error>
fn all_fk( &self, q: &SRobotQ<N, f64>, ) -> Result<(f64::AAffine3, [f64::AAffine3; N], f64::AAffine3), Self::Error>
Source§fn joint_axes_positions(
&self,
q: &SRobotQ<N, f64>,
) -> Result<([f64::AVec3; N], [f64::AVec3; N], f64::AVec3), Self::Error>
fn joint_axes_positions( &self, q: &SRobotQ<N, f64>, ) -> Result<([f64::AVec3; N], [f64::AVec3; N], f64::AVec3), Self::Error>
Returns joint rotation axes and axis-origin positions in world frame at
configuration
q, plus the end-effector position.Source§fn jacobian(&self, q: &SRobotQ<N, f64>) -> Result<[[f64; N]; 6], Self::Error>
fn jacobian(&self, q: &SRobotQ<N, f64>) -> Result<[[f64; N]; 6], Self::Error>
Geometric Jacobian (6×N) at configuration
q.
Rows 0–2: linear velocity, rows 3–5: angular velocity.Source§fn jacobian_dot(
&self,
q: &SRobotQ<N, f64>,
qdot: &SRobotQ<N, f64>,
) -> Result<[[f64; N]; 6], Self::Error>
fn jacobian_dot( &self, q: &SRobotQ<N, f64>, qdot: &SRobotQ<N, f64>, ) -> Result<[[f64; N]; 6], Self::Error>
First time-derivative of the geometric Jacobian.
Source§fn jacobian_ddot(
&self,
q: &SRobotQ<N, f64>,
qdot: &SRobotQ<N, f64>,
qddot: &SRobotQ<N, f64>,
) -> Result<[[f64; N]; 6], Self::Error>
fn jacobian_ddot( &self, q: &SRobotQ<N, f64>, qdot: &SRobotQ<N, f64>, qddot: &SRobotQ<N, f64>, ) -> Result<[[f64; N]; 6], Self::Error>
Second time-derivative of the geometric Jacobian.
fn dof(&self) -> usize
Auto Trait Implementations§
impl<const N: usize, FK32, FK64> Freeze for FPDispatch<N, FK32, FK64>
impl<const N: usize, FK32, FK64> RefUnwindSafe for FPDispatch<N, FK32, FK64>where
FK32: RefUnwindSafe,
FK64: RefUnwindSafe,
impl<const N: usize, FK32, FK64> Send for FPDispatch<N, FK32, FK64>
impl<const N: usize, FK32, FK64> Sync for FPDispatch<N, FK32, FK64>
impl<const N: usize, FK32, FK64> Unpin for FPDispatch<N, FK32, FK64>
impl<const N: usize, FK32, FK64> UnsafeUnpin for FPDispatch<N, FK32, FK64>where
FK32: UnsafeUnpin,
FK64: UnsafeUnpin,
impl<const N: usize, FK32, FK64> UnwindSafe for FPDispatch<N, FK32, FK64>where
FK32: UnwindSafe,
FK64: UnwindSafe,
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
Mutably borrows from an owned value. Read more