use std::io;
use thiserror::Error;
#[derive(Debug)]
pub enum UnfeasibleTrajectoryPoint {
Start,
WayPoint,
Goal,
}
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("{}", error)]
Other { error: String },
#[error("Node name {} not found", .0)]
NotFound(String),
#[error("Collision error: {collision_link_names:?} is colliding ({point:?})")]
Collision {
point: UnfeasibleTrajectoryPoint,
collision_link_names: Vec<String>,
},
#[error("Self Collision error: {collision_link_names:?} is colliding ({point:?})")]
SelfCollision {
point: UnfeasibleTrajectoryPoint,
collision_link_names: Vec<(String, String)>,
},
#[error("Interpolation error: {:?}", .0)]
InterpolationError(String),
#[error("IO error {:?}", source)]
Io {
#[from]
source: io::Error,
},
#[error("DoF mismatch {} != {}", .0, .1)]
DofMismatch(usize, usize),
#[error("URDF error: {:?}", source)]
Urdf {
#[from]
source: urdf_rs::UrdfError,
},
#[error("Path not found {}", .0)]
PathPlanFail(String),
#[error("Kinematics error: {:?}", source)]
KinematicsError {
#[from]
source: k::Error,
},
#[error("failed to parse {}", .0)]
ParseError(String),
#[error("Mesh error {}", .0)]
MeshError(String),
#[error("Reference robot is not set to {}", .0)]
ReferenceRobot(String),
}
pub type Result<T> = ::std::result::Result<T, Error>;