1use std::{
2 convert::Infallible,
3 fmt::{Debug, Display},
4};
5
6pub use glam;
7pub use wide;
8
9mod fk;
10mod fk_dynamic;
11mod path;
12mod q;
13mod validator;
14mod validator_dynamic;
15
16pub use fk::{DHChain, DHJoint, FKChain, HPChain, HPJoint, URDFChain, URDFJoint};
17pub use fk_dynamic::{BoxFK, DynamicDHChain, DynamicHPChain, DynamicURDFChain};
18pub use path::RobotPath;
19pub use q::{RobotQ, SRobotQ};
20pub use validator::{JointValidator, Validator, ValidatorAnd, ValidatorNot, ValidatorOr};
21pub use validator_dynamic::DynamicJointValidator;
22
23#[derive(Debug, Clone)]
24pub enum DekeError {
25 ShapeMismatch { expected: usize, found: usize },
26 JointsNonFinite,
27 SelfCollison(i16, i16),
28 EnvironmentCollision(i16, i16),
29 ExceedJointLimits,
30 OutOfIterations,
31 SuperError,
32}
33
34impl From<Infallible> for DekeError {
35 fn from(_: Infallible) -> Self {
36 unreachable!()
37 }
38}
39
40pub type DekeResult<T> = Result<T, DekeError>;
41
42pub trait Planner<const N: usize>: Sized + Clone + Debug + Send + Sync + 'static {
43 type Diagnostic: Display + Send + Sync;
44
45 fn plan<
46 E: Into<DekeError>,
47 A: TryInto<SRobotQ<N>, Error = E>,
48 B: TryInto<SRobotQ<N>, Error = E>,
49 >(
50 &self,
51 start: A,
52 goal: B,
53 validators: &mut impl Validator<N>,
54 ) -> (DekeResult<RobotPath>, Self::Diagnostic);
55}