arci/
error.rs

1use std::{ops::RangeInclusive, sync::Arc};
2
3use thiserror::Error;
4
5#[derive(Debug, Error)]
6#[non_exhaustive]
7pub enum Error {
8    #[error("arci: {:?}", .0)]
9    InterpolationError(String),
10    #[error("arci: Collision {} {}", .0, .1)]
11    CollisionError(String, String),
12    #[error(
13        "arci: Timeout {:?}: {} is larger than {}",
14        timeout,
15        allowable_total_diff,
16        err
17    )]
18    Timeout {
19        timeout: std::time::Duration,
20        allowable_total_diff: f64,
21        err: f64,
22    },
23    #[error("arci: Length mismatch (model = {}, input = {})", model, input)]
24    LengthMismatch { model: usize, input: usize },
25    #[error("arci: No Joint={} is found.", .0)]
26    NoJoint(String),
27    #[error(
28        "arci: Joint Names Mismatch : left = {:?}, right = {:?}",
29        partial,
30        full
31    )]
32    JointNamesMismatch {
33        partial: Vec<String>,
34        full: Vec<String>,
35    },
36    #[error("arci: CopyJointError {:?} {:?} : {:?} {:?}", .0, .1, .2, .3)]
37    CopyJointError(Vec<String>, Vec<f64>, Vec<String>, Vec<f64>),
38    #[error(
39        "arci: Wait timeout target={:?}, cur={:?} is_reached={:?}",
40        target,
41        current,
42        is_reached
43    )]
44    TimeoutWithDiff {
45        target: Vec<f64>,
46        current: Vec<f64>,
47        is_reached: Vec<bool>,
48    },
49    #[error("arci: Uninitialized : {}", message)]
50    Uninitialized { message: String },
51    #[error("arci: Connection error : {}", message)]
52    Connection { message: String },
53    #[error("arci: Canceled : {}", message)]
54    Canceled { message: String },
55    #[error(
56        "arci: Out of limit: joint={}, position={}, limit={:?}",
57        name,
58        position,
59        limit
60    )]
61    OutOfLimit {
62        name: String,
63        position: f64,
64        limit: RangeInclusive<f64>,
65    },
66    #[error("arci: Failed to construct instance: {}", .0)]
67    Lazy(Arc<Error>),
68    #[error("arci: urdf: {:?}", .0)]
69    Urdf(#[from] urdf_rs::UrdfError),
70    #[error("arci: Other: {:?}", .0)]
71    Other(#[from] anyhow::Error),
72}