Skip to main content

stable_flight/guidance/vtol/lift/
params.rs

1//! [`LiftTransitionConfig`]'s params; the names and units are tabled in [`crate::params`].
2//! Fields that mean what a [`TransitionConfig`](super::super::TransitionConfig) field means
3//! share its name.
4
5use super::LiftTransitionConfig;
6use crate::params::{Param, ParamTable, param};
7
8impl ParamTable for LiftTransitionConfig {
9    const PARAMS: &'static [Param<Self>] = &[
10        param!("TRAN_ASPD_MIN", min_airspeed_mps),
11        param!("TRAN_FW_RAMP", lift_ramp_s),
12        param!("TRAN_TIMEOUT", timeout_s),
13        param!("TRAN_MIN_HGT", min_height_m),
14        param!("TRAN_FW_MIN_HGT", plane_min_height_m),
15        param!("TRAN_VT_RAMP", back_ramp_s),
16        param!("TRAN_VT_SPD", back_speed_mps),
17        param!("TRAN_VT_TIMEOUT", back_timeout_s),
18        param!("TRAN_VT_DEC", back_decel_mps2),
19        param!("TRAN_VT_DEC_I", back_decel_i),
20        param!("TRAN_FW_THR", forward_thrust),
21        param!("TRAN_PSH_SLEW", pusher_slew_per_s),
22        param!(deg "TRAN_FW_PIT_MAX", forward_pitch_max_rad),
23        param!("TRAN_HANDOFF", handoff_s),
24        param!(deg "TRAN_ROLL_MAX", roll_limit_rad),
25    ];
26}
27
28#[cfg(feature = "param-metadata")]
29mod metadata {
30    use super::LiftTransitionConfig;
31    use crate::params::metadata::{ParamMeta, ParamMetadata};
32
33    const FORWARD: ParamMeta = ParamMeta::in_group("Transition", "Forward");
34    const BACK: ParamMeta = ParamMeta::in_group("Transition", "Back");
35    const LIMITS: ParamMeta = ParamMeta::in_group("Transition", "Limits");
36
37    impl ParamMetadata for LiftTransitionConfig {
38        const METADATA: &'static [ParamMeta] = &[
39            FORWARD
40                .param("TRAN_ASPD_MIN", "Airspeed that starts the lift ramp-down")
41                .with_units("m/s")
42                .at_least(0.0),
43            FORWARD
44                .param(
45                    "TRAN_FW_RAMP",
46                    "Time the lift rotors take to hand the lift to the wing",
47                )
48                .with_units("s")
49                .above(0.0),
50            LIMITS
51                .param(
52                    "TRAN_TIMEOUT",
53                    "Longest wait on airspeed before the forward transition reverts",
54                )
55                .with_units("s")
56                .above(0.0),
57            LIMITS
58                .param(
59                    "TRAN_MIN_HGT",
60                    "Height above arming a forward transition needs",
61                )
62                .with_units("m")
63                .at_least(0.0),
64            LIMITS
65                .param(
66                    "TRAN_FW_MIN_HGT",
67                    "Height above arming plane flight falls back below (0: off)",
68                )
69                .with_units("m")
70                .at_least(0.0),
71            BACK.param(
72                "TRAN_VT_RAMP",
73                "Time the lift rotors take to take the lift back",
74            )
75            .with_units("s")
76            .above(0.0),
77            BACK.param(
78                "TRAN_VT_SPD",
79                "Forward speed below which the back transition completes",
80            )
81            .with_units("m/s")
82            .at_least(0.0),
83            BACK.param(
84                "TRAN_VT_TIMEOUT",
85                "Longest back transition before it completes",
86            )
87            .with_units("s")
88            .above(0.0),
89            BACK.param(
90                "TRAN_VT_DEC",
91                "Deceleration the back transition pitches up to hold",
92            )
93            .with_units("m/s/s")
94            .at_least(0.0),
95            BACK.param(
96                "TRAN_VT_DEC_I",
97                "How fast the back transition's pitch-up grows (0: off)",
98            )
99            .with_units("rad*s/m")
100            .at_least(0.0),
101            FORWARD
102                .param(
103                    "TRAN_FW_THR",
104                    "Pusher thrust through the forward transition",
105                )
106                .at_least(0.0)
107                .at_most(1.0),
108            FORWARD
109                .param(
110                    "TRAN_PSH_SLEW",
111                    "Fastest the pusher's thrust rises going forward",
112                )
113                .with_units("1/s")
114                .above(0.0),
115            FORWARD
116                .param(
117                    "TRAN_FW_PIT_MAX",
118                    "Most pitch waiting on airspeed; twice it plus 2 deg on the ramp",
119                )
120                .with_units("deg")
121                .above(0.0)
122                .below(90.0),
123            LIMITS
124                .param(
125                    "TRAN_HANDOFF",
126                    "Pusher thrust blend time at the handoff to plane",
127                )
128                .with_units("s")
129                .at_least(0.0),
130            LIMITS
131                .param("TRAN_ROLL_MAX", "Bank that cuts a transition short")
132                .with_units("deg")
133                .above(0.0)
134                .at_most(180.0),
135        ];
136    }
137}