mirror of https://github.com/ArduPilot/ardupilot
Tracker: correct scan mode pitch clamping
This commit is contained in:
parent
1c3287160e
commit
a8e2923774
|
@ -45,15 +45,19 @@ void Mode::update_scan(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nav_status.manual_control_pitch) {
|
if (!nav_status.manual_control_pitch) {
|
||||||
float pitch_delta = g.scan_speed_pitch * 0.02f;
|
const float pitch_delta = g.scan_speed_pitch * 0.02f;
|
||||||
nav_status.pitch += pitch_delta * (nav_status.scan_reverse_pitch?-1:1);
|
if (nav_status.scan_reverse_pitch) {
|
||||||
if (nav_status.pitch < g.pitch_min && nav_status.scan_reverse_pitch) {
|
nav_status.pitch -= pitch_delta;
|
||||||
|
if (nav_status.pitch < g.pitch_min) {
|
||||||
nav_status.scan_reverse_pitch = false;
|
nav_status.scan_reverse_pitch = false;
|
||||||
}
|
}
|
||||||
if (nav_status.pitch > g.pitch_max && !nav_status.scan_reverse_pitch) {
|
} else {
|
||||||
|
nav_status.pitch += pitch_delta;
|
||||||
|
if (nav_status.pitch > g.pitch_max) {
|
||||||
nav_status.scan_reverse_pitch = true;
|
nav_status.scan_reverse_pitch = true;
|
||||||
}
|
}
|
||||||
nav_status.pitch = constrain_float(nav_status.pitch, -g.pitch_min, g.pitch_max);
|
}
|
||||||
|
nav_status.pitch = constrain_float(nav_status.pitch, g.pitch_min, g.pitch_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_auto();
|
update_auto();
|
||||||
|
|
Loading…
Reference in New Issue