1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
use std::{ops::RangeInclusive, sync::Arc};

use thiserror::Error;

#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
    #[error("arci: {:?}", .0)]
    InterpolationError(String),
    #[error("arci: Collision {} {}", .0, .1)]
    CollisionError(String, String),
    #[error(
        "arci: Timeout {:?}: {} is larger than {}",
        timeout,
        allowable_total_diff,
        err
    )]
    Timeout {
        timeout: std::time::Duration,
        allowable_total_diff: f64,
        err: f64,
    },
    #[error("arci: Length mismatch (model = {}, input = {})", model, input)]
    LengthMismatch { model: usize, input: usize },
    #[error("arci: No Joint={} is found.", .0)]
    NoJoint(String),
    #[error(
        "arci: Joint Names Mismatch : left = {:?}, right = {:?}",
        partial,
        full
    )]
    JointNamesMismatch {
        partial: Vec<String>,
        full: Vec<String>,
    },
    #[error("arci: CopyJointError {:?} {:?} : {:?} {:?}", .0, .1, .2, .3)]
    CopyJointError(Vec<String>, Vec<f64>, Vec<String>, Vec<f64>),
    #[error(
        "arci: Wait timeout target={:?}, cur={:?} is_reached={:?}",
        target,
        current,
        is_reached
    )]
    TimeoutWithDiff {
        target: Vec<f64>,
        current: Vec<f64>,
        is_reached: Vec<bool>,
    },
    #[error("arci: Uninitialized : {}", message)]
    Uninitialized { message: String },
    #[error("arci: Connection error : {}", message)]
    Connection { message: String },
    #[error("arci: Canceled : {}", message)]
    Canceled { message: String },
    #[error(
        "arci: Out of limit: joint={}, position={}, limit={:?}",
        name,
        position,
        limit
    )]
    OutOfLimit {
        name: String,
        position: f64,
        limit: RangeInclusive<f64>,
    },
    #[error("arci: Failed to construct instance: {}", .0)]
    Lazy(Arc<Error>),
    #[error("arci: urdf: {:?}", .0)]
    Urdf(#[from] urdf_rs::UrdfError),
    #[error("arci: Other: {:?}", .0)]
    Other(#[from] anyhow::Error),
}