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!("TRAN_HANDOFF", handoff_s),
23        param!(deg "TRAN_ROLL_MAX", roll_limit_rad),
24    ];
25}
26
27#[cfg(feature = "param-metadata")]
28mod metadata {
29    use super::LiftTransitionConfig;
30    use crate::params::metadata::{ParamMeta, ParamMetadata};
31
32    const FORWARD: ParamMeta = ParamMeta::in_group("Transition", "Forward");
33    const BACK: ParamMeta = ParamMeta::in_group("Transition", "Back");
34    const LIMITS: ParamMeta = ParamMeta::in_group("Transition", "Limits");
35
36    impl ParamMetadata for LiftTransitionConfig {
37        const METADATA: &'static [ParamMeta] = &[
38            FORWARD
39                .param("TRAN_ASPD_MIN", "Airspeed that starts the lift ramp-down")
40                .with_units("m/s")
41                .at_least(0.0),
42            FORWARD
43                .param(
44                    "TRAN_FW_RAMP",
45                    "Time the lift rotors take to hand the lift to the wing",
46                )
47                .with_units("s")
48                .above(0.0),
49            LIMITS
50                .param(
51                    "TRAN_TIMEOUT",
52                    "Longest wait on airspeed before the forward transition reverts",
53                )
54                .with_units("s")
55                .above(0.0),
56            LIMITS
57                .param(
58                    "TRAN_MIN_HGT",
59                    "Height above arming a forward transition needs",
60                )
61                .with_units("m")
62                .at_least(0.0),
63            LIMITS
64                .param(
65                    "TRAN_FW_MIN_HGT",
66                    "Height above arming plane flight falls back below (0: off)",
67                )
68                .with_units("m")
69                .at_least(0.0),
70            BACK.param(
71                "TRAN_VT_RAMP",
72                "Time the lift rotors take to take the lift back",
73            )
74            .with_units("s")
75            .above(0.0),
76            BACK.param(
77                "TRAN_VT_SPD",
78                "Forward speed below which the back transition completes",
79            )
80            .with_units("m/s")
81            .at_least(0.0),
82            BACK.param(
83                "TRAN_VT_TIMEOUT",
84                "Longest back transition before it completes",
85            )
86            .with_units("s")
87            .above(0.0),
88            BACK.param(
89                "TRAN_VT_DEC",
90                "Deceleration the back transition pitches up to hold",
91            )
92            .with_units("m/s/s")
93            .at_least(0.0),
94            BACK.param(
95                "TRAN_VT_DEC_I",
96                "How fast the back transition's pitch-up grows (0: off)",
97            )
98            .with_units("rad*s/m")
99            .at_least(0.0),
100            FORWARD
101                .param(
102                    "TRAN_FW_THR",
103                    "Pusher thrust through the forward transition",
104                )
105                .at_least(0.0)
106                .at_most(1.0),
107            FORWARD
108                .param(
109                    "TRAN_PSH_SLEW",
110                    "Fastest the pusher's thrust rises going forward",
111                )
112                .with_units("1/s")
113                .above(0.0),
114            LIMITS
115                .param(
116                    "TRAN_HANDOFF",
117                    "Pusher thrust blend time at the handoff to plane",
118                )
119                .with_units("s")
120                .at_least(0.0),
121            LIMITS
122                .param("TRAN_ROLL_MAX", "Bank that cuts a transition short")
123                .with_units("deg")
124                .above(0.0)
125                .at_most(180.0),
126        ];
127    }
128}