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 pub peak_joint_accel: f64,
32 pub peak_joint_jerk: f64,
37}
38
39impl fmt::Display for LinearRetimerDiagnostic {
40 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
41 write!(
42 f,
43 "retimer: {} samples over {:.3}s, {:.4}m, commanded {:.4} m/s, peak {:.4} m/s",
44 self.output_samples,
45 self.duration.as_secs_f64(),
46 self.arc_length,
47 self.commanded_speed,
48 self.peak_speed
49 )
50 }
51}
52
53#[derive(Clone, Debug)]
55pub struct RedundantDiagnostic {
56 pub samples: usize,
57 pub min_manipulability: f64,
58 pub yaw_range: (f64, f64),
60}
61
62impl fmt::Display for RedundantDiagnostic {
63 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
64 write!(
65 f,
66 "redundant: {} samples, min manipulability {:.3e}, yaw ∈ [{:.1}°, {:.1}°]",
67 self.samples,
68 self.min_manipulability,
69 self.yaw_range.0.to_degrees(),
70 self.yaw_range.1.to_degrees()
71 )
72 }
73}