deke_linear/
diagnostic.rs1use std::fmt;
2use std::time::Duration;
3
4#[derive(Clone, Debug)]
6pub struct LinearPlannerDiagnostic {
7 pub samples: usize,
8 pub min_manipulability: f64,
9 pub total_cost: f64,
10}
11
12impl fmt::Display for LinearPlannerDiagnostic {
13 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14 write!(
15 f,
16 "planner: {} samples, min manipulability {:.3e}, route cost {:.3}",
17 self.samples, self.min_manipulability, self.total_cost
18 )
19 }
20}
21
22#[derive(Clone, Debug)]
24pub struct LinearRetimerDiagnostic {
25 pub output_samples: usize,
26 pub duration: Duration,
27 pub arc_length: f64,
28 pub commanded_speed: f64,
29 pub peak_speed: f64,
30}
31
32impl fmt::Display for LinearRetimerDiagnostic {
33 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34 write!(
35 f,
36 "retimer: {} samples over {:.3}s, {:.4}m, commanded {:.4} m/s, peak {:.4} m/s",
37 self.output_samples,
38 self.duration.as_secs_f64(),
39 self.arc_length,
40 self.commanded_speed,
41 self.peak_speed
42 )
43 }
44}
45
46#[derive(Clone, Debug)]
48pub struct RedundantDiagnostic {
49 pub samples: usize,
50 pub min_manipulability: f64,
51 pub yaw_range: (f64, f64),
53}
54
55impl fmt::Display for RedundantDiagnostic {
56 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
57 write!(
58 f,
59 "redundant: {} samples, min manipulability {:.3e}, yaw ∈ [{:.1}°, {:.1}°]",
60 self.samples,
61 self.min_manipulability,
62 self.yaw_range.0.to_degrees(),
63 self.yaw_range.1.to_degrees()
64 )
65 }
66}