Plane: Qstabilize: mode functions to ModeQStabilize

This commit is contained in:
Iampete1 2021-08-14 19:59:06 +01:00 committed by Andrew Tridgell
parent 44e63861ce
commit baf2b4a3d8
2 changed files with 20 additions and 21 deletions

View File

@ -10,6 +10,12 @@ bool ModeQStabilize::_enter()
return true; return true;
} }
// init quadplane stabilize mode
void ModeQStabilize::init()
{
quadplane.throttle_wait = false;
}
void ModeQStabilize::update() void ModeQStabilize::update()
{ {
// set nav_roll and nav_pitch using sticks // set nav_roll and nav_pitch using sticks
@ -38,6 +44,20 @@ void ModeQStabilize::update()
} }
} }
// quadplane stabilize mode
void ModeQStabilize::run()
{
// special check for ESC calibration in QSTABILIZE
if (quadplane.esc_calibration != 0) {
quadplane.run_esc_calibration();
return;
}
// normal QSTABILIZE mode
float pilot_throttle_scaled = quadplane.get_pilot_throttle();
quadplane.hold_stabilize(pilot_throttle_scaled);
}
// set the desired roll and pitch for a tailsitter // set the desired roll and pitch for a tailsitter
void ModeQStabilize::set_tailsitter_roll_pitch(const float roll_input, const float pitch_input) void ModeQStabilize::set_tailsitter_roll_pitch(const float roll_input, const float pitch_input)
{ {

View File

@ -845,13 +845,6 @@ void QuadPlane::run_esc_calibration(void)
} }
} }
// init quadplane stabilize mode
void ModeQStabilize::init()
{
quadplane.throttle_wait = false;
}
/* /*
when doing a forward transition of a tilt-vectored quadplane we use when doing a forward transition of a tilt-vectored quadplane we use
euler angle control to maintain good yaw. This updates the yaw euler angle control to maintain good yaw. This updates the yaw
@ -997,20 +990,6 @@ void QuadPlane::hold_stabilize(float throttle_in)
} }
} }
// quadplane stabilize mode
void ModeQStabilize::run()
{
// special check for ESC calibration in QSTABILIZE
if (quadplane.esc_calibration != 0) {
quadplane.run_esc_calibration();
return;
}
// normal QSTABILIZE mode
float pilot_throttle_scaled = quadplane.get_pilot_throttle();
quadplane.hold_stabilize(pilot_throttle_scaled);
}
// run the multicopter Z controller // run the multicopter Z controller
void QuadPlane::run_z_controller(void) void QuadPlane::run_z_controller(void)
{ {