File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ void ModeQHover::run()
37
37
quadplane.relax_attitude_control ();
38
38
pos_control->relax_z_controller (0 );
39
39
} else {
40
+ plane.quadplane .assign_tilt_to_fwd_thr ();
40
41
quadplane.hold_hover (quadplane.get_pilot_desired_climb_rate_cms ());
41
42
}
42
43
Original file line number Diff line number Diff line change @@ -35,11 +35,6 @@ void ModeQStabilize::update()
35
35
plane.nav_roll_cd = roll_input * plane.quadplane .aparm .angle_max ;
36
36
plane.nav_pitch_cd = pitch_input * plane.quadplane .aparm .angle_max ;
37
37
}
38
-
39
- if (plane.control_mode ->mode_number () == Mode::Number::QSTABILIZE) {
40
- // protect against this function running twice
41
- plane.quadplane .assign_tilt_to_fwd_thr ();
42
- }
43
38
}
44
39
45
40
// quadplane stabilize mode
@@ -52,6 +47,8 @@ void ModeQStabilize::run()
52
47
return ;
53
48
}
54
49
50
+ plane.quadplane .assign_tilt_to_fwd_thr ();
51
+
55
52
// special check for ESC calibration in QSTABILIZE
56
53
if (quadplane.esc_calibration != 0 ) {
57
54
quadplane.run_esc_calibration ();
Original file line number Diff line number Diff line change @@ -2972,6 +2972,9 @@ QuadPlane::ActiveFwdThr QuadPlane::get_vfwd_method(void) const
2972
2972
return ActiveFwdThr::NONE;
2973
2973
}
2974
2974
2975
+ /*
2976
+ map from pitch tilt to fwd throttle when enabled
2977
+ */
2975
2978
void QuadPlane::assign_tilt_to_fwd_thr (void ) {
2976
2979
2977
2980
const auto fwd_thr_active = get_vfwd_method ();
@@ -2991,7 +2994,8 @@ void QuadPlane::assign_tilt_to_fwd_thr(void) {
2991
2994
if (is_positive (fwd_tilt_range_cd)) {
2992
2995
// rate limit the forward tilt change to slew between the motor good and motor failed
2993
2996
// value over 10 seconds
2994
- const float fwd_pitch_lim_cd_tgt = plane.quadplane .pos_control ->get_fwd_pitch_is_limited () ? (float )aparm.angle_max : 100 .0f * q_fwd_pitch_lim;
2997
+ const bool fwd_limited = plane.quadplane .pos_control ->is_active_xy () and plane.quadplane .pos_control ->get_fwd_pitch_is_limited ();
2998
+ const float fwd_pitch_lim_cd_tgt = fwd_limited ? (float )aparm.angle_max : 100 .0f * q_fwd_pitch_lim;
2995
2999
const float delta_max = 0 .1f * fwd_tilt_range_cd * plane.G_Dt ;
2996
3000
q_fwd_pitch_lim_cd += constrain_float ((fwd_pitch_lim_cd_tgt - q_fwd_pitch_lim_cd), -delta_max, delta_max);
2997
3001
// Don't let the forward pitch limit be more than the forward pitch demand before limiting to
You can’t perform that action at this time.
0 commit comments