Skip to main content

PathEvaluator2nd

Trait PathEvaluator2nd 

Source
pub trait PathEvaluator2nd: Send + Sync {
    // Required methods
    fn dim(&self) -> usize;
    fn evaluate_up_to_2nd(
        &self,
        s: &[f64],
        q: &mut [f64],
        dq: &mut [f64],
        ddq: &mut [f64],
    ) -> Result<(), PathError>;

    // Provided method
    fn evaluate_q(&self, s: &[f64], q: &mut [f64]) -> Result<(), PathError> { ... }
}
Expand description

User-provided path evaluator with explicit derivatives up to second order.

Implement this trait when path derivatives are already available from an external model, library, or hand-written analytic formula. Unlike Path::from_parametric, no automatic differentiation is performed: the evaluator writes q, dq, and ddq directly into pre-allocated column-major buffers.

Buffer layout is always dim x s.len() in column-major order: buffer[row + col * dim] corresponds to path dimension row at sample s[col]. Empty s slices are valid no-ops.

See Path::from_evaluator_2nd for a complete constructor example.

Required Methods§

Source

fn dim(&self) -> usize

Return the path dimension.

The dimension must remain stable for the lifetime of the evaluator and must be greater than zero.

Source

fn evaluate_up_to_2nd( &self, s: &[f64], q: &mut [f64], dq: &mut [f64], ddq: &mut [f64], ) -> Result<(), PathError>

Evaluate q, dq, and ddq at all supplied path parameters.

All output buffers have length dim() * s.len() and use column-major layout.

Provided Methods§

Source

fn evaluate_q(&self, s: &[f64], q: &mut [f64]) -> Result<(), PathError>

Evaluate position only.

The default implementation calls PathEvaluator2nd::evaluate_up_to_2nd with temporary derivative buffers. Override this method if computing only q is substantially cheaper for the evaluator.

Implementors§