Skip to main content

stable_flight/guidance/vtol/
params.rs

1//! [`TransitionConfig`]'s params; the names and units are tabled in [`crate::params`].
2
3use super::TransitionConfig;
4use crate::params::{Param, ParamTable, param};
5
6impl ParamTable for TransitionConfig {
7    const PARAMS: &'static [Param<Self>] = &[
8        param!(deg "TRAN_FW_RATE", forward_rate_radps),
9        param!(deg "TRAN_FW_DONE", forward_done_rad),
10        param!(deg "TRAN_FW_MAX", forward_max_tilt_rad),
11        param!("TRAN_ASPD_MIN", min_airspeed_mps),
12        param!(deg "TRAN_VT_RATE", back_rate_radps),
13        param!(deg "TRAN_VT_DONE", back_done_rad),
14        param!("TRAN_TIMEOUT", timeout_s),
15        param!("TRAN_MIN_HGT", min_height_m),
16        param!("TRAN_FW_MIN_HGT", plane_min_height_m),
17        param!("TRAN_FW_THR", forward_thrust),
18        param!("TRAN_VT_THR", back_thrust),
19        param!("TRAN_VT_SINK_LIM", back_sink_limit_mps),
20        param!("TRAN_VT_SINK_GN", back_sink_gain),
21        param!("TRAN_HANDOFF", handoff_s),
22        param!(deg "TRAN_ROLL_MAX", roll_limit_rad),
23    ];
24}
25
26#[cfg(feature = "param-metadata")]
27mod metadata {
28    use super::TransitionConfig;
29    use crate::params::metadata::{ParamMeta, ParamMetadata};
30
31    const FORWARD: ParamMeta = ParamMeta::in_group("Transition", "Forward");
32    const BACK: ParamMeta = ParamMeta::in_group("Transition", "Back");
33    const LIMITS: ParamMeta = ParamMeta::in_group("Transition", "Limits");
34
35    impl ParamMetadata for TransitionConfig {
36        const METADATA: &'static [ParamMeta] = &[
37            FORWARD
38                .param("TRAN_FW_RATE", "Nose-down rate of the forward ramp")
39                .with_units("deg/s")
40                .above(0.0),
41            FORWARD
42                .param(
43                    "TRAN_FW_DONE",
44                    "Tilt from vertical that completes the forward transition",
45                )
46                .with_units("deg")
47                .above(0.0)
48                .below(90.0),
49            FORWARD
50                .param(
51                    "TRAN_FW_MAX",
52                    "Tilt where the forward ramp waits on airspeed",
53                )
54                .with_units("deg")
55                .above(0.0)
56                .at_most(90.0),
57            FORWARD
58                .param(
59                    "TRAN_ASPD_MIN",
60                    "Airspeed the forward transition needs (0: off)",
61                )
62                .with_units("m/s")
63                .at_least(0.0),
64            BACK.param("TRAN_VT_RATE", "Nose-up rate of the back ramp")
65                .with_units("deg/s")
66                .above(0.0),
67            BACK.param(
68                "TRAN_VT_DONE",
69                "Tilt from vertical that completes the back transition",
70            )
71            .with_units("deg")
72            .above(0.0)
73            .below(90.0),
74            LIMITS
75                .param(
76                    "TRAN_TIMEOUT",
77                    "Longest transition: forward reverts, back completes",
78                )
79                .with_units("s")
80                .above(0.0),
81            LIMITS
82                .param(
83                    "TRAN_MIN_HGT",
84                    "Height above arming a forward transition needs",
85                )
86                .with_units("m")
87                .at_least(0.0),
88            LIMITS
89                .param(
90                    "TRAN_FW_MIN_HGT",
91                    "Height above arming plane flight falls back below (0: off)",
92                )
93                .with_units("m")
94                .at_least(0.0),
95            FORWARD
96                .param("TRAN_FW_THR", "Least thrust through the forward transition")
97                .at_least(0.0)
98                .at_most(1.0),
99            BACK.param("TRAN_VT_THR", "Thrust through the back transition")
100                .at_least(0.0)
101                .at_most(1.0),
102            BACK.param(
103                "TRAN_VT_SINK_LIM",
104                "Sink past which the back transition adds thrust (0: off)",
105            )
106            .with_units("m/s")
107            .at_least(0.0),
108            BACK.param(
109                "TRAN_VT_SINK_GN",
110                "Thrust added per m/s of sink past TRAN_VT_SINK_LIM",
111            )
112            .with_units("s/m")
113            .at_least(0.0),
114            LIMITS
115                .param("TRAN_HANDOFF", "Thrust blend time at a controller handoff")
116                .with_units("s")
117                .at_least(0.0),
118            LIMITS
119                .param("TRAN_ROLL_MAX", "Roll error that cuts a transition short")
120                .with_units("deg")
121                .above(0.0)
122                .at_most(180.0),
123        ];
124    }
125}