1/*
2Copyright 2017 Takashi Ogura
34Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
78 http://www.apache.org/licenses/LICENSE-2.0
910Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
1617use std::io;
1819use thiserror::Error;
2021#[derive(Debug)]
22pub enum UnfeasibleTrajectoryPoint {
23 Start,
24 WayPoint,
25 Goal,
26}
2728/// Error for `openrr_planner`
29#[derive(Debug, Error)]
30#[non_exhaustive]
31pub enum Error {
32#[error("{}", error)]
33Other { error: String },
34#[error("Node name {} not found", .0)]
35NotFound(String),
36#[error("Collision error: {collision_link_names:?} is colliding ({point:?})")]
37Collision {
38 point: UnfeasibleTrajectoryPoint,
39 collision_link_names: Vec<String>,
40 },
41#[error("Self Collision error: {collision_link_names:?} is colliding ({point:?})")]
42SelfCollision {
43 point: UnfeasibleTrajectoryPoint,
44 collision_link_names: Vec<(String, String)>,
45 },
46#[error("Interpolation error: {:?}", .0)]
47InterpolationError(String),
48#[error("IO error {:?}", source)]
49Io {
50#[from]
51source: io::Error,
52 },
53#[error("DoF mismatch {} != {}", .0, .1)]
54DofMismatch(usize, usize),
55#[error("URDF error: {:?}", source)]
56Urdf {
57#[from]
58source: urdf_rs::UrdfError,
59 },
60#[error("Path not found {}", .0)]
61PathPlanFail(String),
62#[error("Kinematics error: {:?}", source)]
63KinematicsError {
64#[from]
65source: k::Error,
66 },
67#[error("failed to parse {}", .0)]
68ParseError(String),
69#[error("Mesh error {}", .0)]
70MeshError(String),
71#[error("Reference robot is not set to {}", .0)]
72ReferenceRobot(String),
73}
7475/// Result for `openrr_planner`
76pub type Result<T> = ::std::result::Result<T, Error>;