Copter: acro uses 0 to 1 throttle and sets desired spool state

This commit is contained in:
Leonard Hall 2016-01-18 14:36:44 +09:00 committed by Randy Mackay
parent f56ff4d564
commit 2180514dde
1 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,7 @@
bool Copter::acro_init(bool ignore_checks)
{
// if landed and the mode we're switching from does not have manual throttle and the throttle stick is too high
if (motors.armed() && ap.land_complete && !mode_has_manual_throttle(control_mode) && (g.rc_3.control_in > get_non_takeoff_throttle())) {
if (motors.armed() && ap.land_complete && !mode_has_manual_throttle(control_mode) && (get_pilot_desired_throttle(channel_throttle->control_in) > get_non_takeoff_throttle())) {
return false;
}
// set target altitude to zero for reporting
@ -24,10 +24,11 @@ bool Copter::acro_init(bool ignore_checks)
void Copter::acro_run()
{
float target_roll, target_pitch, target_yaw;
int16_t pilot_throttle_scaled;
float pilot_throttle_scaled;
// if motors not running reset angle targets
if(!motors.armed() || ap.throttle_zero) {
// if not armed set throttle to zero and exit immediately
if (!motors.armed() || ap.throttle_zero || !motors.get_interlock()) {
motors.set_desired_spool_state(AP_MotorsMulticopter::DESIRED_SPIN_WHEN_ARMED);
attitude_control.set_throttle_out_unstabilized(0,true,g.throttle_filt);
// slow start if landed
if (ap.land_complete) {
@ -36,6 +37,8 @@ void Copter::acro_run()
return;
}
motors.set_desired_spool_state(AP_MotorsMulticopter::DESIRED_THROTTLE_UNLIMITED);
// convert the input to the desired body frame rate
get_pilot_desired_angle_rates(channel_roll->control_in, channel_pitch->control_in, channel_yaw->control_in, target_roll, target_pitch, target_yaw);