mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-18 06:38:29 -04:00
AP_Motors: style formatting MotorsHeli_RSC.cpp
This commit is contained in:
parent
1c9b4a8ac3
commit
a209bd15eb
@ -275,7 +275,7 @@ void AP_MotorsHeli_RSC::output(RotorControlState state)
|
||||
_last_update_us = now;
|
||||
}
|
||||
|
||||
switch (state){
|
||||
switch (state) {
|
||||
case ROTOR_CONTROL_STOP:
|
||||
// set rotor ramp to decrease speed to zero, this happens instantly inside update_rotor_ramp()
|
||||
update_rotor_ramp(0.0f, dt);
|
||||
@ -306,13 +306,13 @@ void AP_MotorsHeli_RSC::output(RotorControlState state)
|
||||
_governor_fault = false;
|
||||
if (_in_autorotation) {
|
||||
// if in autorotation and using an external governor, set the output to tell the governor to use bailout ramp
|
||||
_idle_throttle = constrain_float( _ext_gov_arot_pct/100.0f , 0.0f, 0.4f);
|
||||
if(!_autorotating){
|
||||
_idle_throttle = constrain_float( _ext_gov_arot_pct/100.0f, 0.0f, 0.4f);
|
||||
if (!_autorotating) {
|
||||
gcs().send_text(MAV_SEVERITY_CRITICAL, "Autorotation");
|
||||
_autorotating =true;
|
||||
}
|
||||
} else {
|
||||
if(_autorotating){
|
||||
if (_autorotating) {
|
||||
gcs().send_text(MAV_SEVERITY_CRITICAL, "Autorotation Stopped");
|
||||
_autorotating =false;
|
||||
}
|
||||
@ -324,7 +324,7 @@ void AP_MotorsHeli_RSC::output(RotorControlState state)
|
||||
gcs().send_text(MAV_SEVERITY_INFO, "Turbine startup");
|
||||
_starting = false;
|
||||
}
|
||||
} else{
|
||||
} else {
|
||||
if (_cooldown_time > 0) {
|
||||
_idle_throttle = get_idle_output() * 1.5f;
|
||||
_fast_idle_timer += dt;
|
||||
@ -398,13 +398,13 @@ void AP_MotorsHeli_RSC::update_rotor_ramp(float rotor_ramp_input, float dt)
|
||||
|
||||
// ramp output upwards towards target
|
||||
if (_rotor_ramp_output < rotor_ramp_input) {
|
||||
if (_use_bailout_ramp){
|
||||
if(!_bailing_out){
|
||||
if (_use_bailout_ramp) {
|
||||
if (!_bailing_out) {
|
||||
gcs().send_text(MAV_SEVERITY_CRITICAL, "bailing_out");
|
||||
_bailing_out = true;
|
||||
}
|
||||
_rotor_ramp_output += (dt / bailout_time);
|
||||
}else{
|
||||
} else {
|
||||
_rotor_ramp_output += (dt / ramp_time);
|
||||
}
|
||||
if (_rotor_ramp_output > rotor_ramp_input) {
|
||||
@ -412,7 +412,7 @@ void AP_MotorsHeli_RSC::update_rotor_ramp(float rotor_ramp_input, float dt)
|
||||
_bailing_out = false;
|
||||
_use_bailout_ramp = false;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
// ramping down happens instantly
|
||||
_rotor_ramp_output = rotor_ramp_input;
|
||||
}
|
||||
@ -441,7 +441,7 @@ void AP_MotorsHeli_RSC::update_rotor_runup(float dt)
|
||||
if (_rotor_runup_output > _rotor_ramp_output) {
|
||||
_rotor_runup_output = _rotor_ramp_output;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
_rotor_runup_output -= runup_increment;
|
||||
if (_rotor_runup_output < _rotor_ramp_output) {
|
||||
_rotor_runup_output = _rotor_ramp_output;
|
||||
@ -456,7 +456,7 @@ void AP_MotorsHeli_RSC::update_rotor_runup(float dt)
|
||||
// update run-up complete flag
|
||||
|
||||
// if control mode is disabled, then run-up complete always returns true
|
||||
if ( _control_mode == ROTOR_CONTROL_MODE_DISABLED ){
|
||||
if ( _control_mode == ROTOR_CONTROL_MODE_DISABLED ) {
|
||||
_runup_complete = true;
|
||||
return;
|
||||
}
|
||||
@ -471,7 +471,11 @@ void AP_MotorsHeli_RSC::update_rotor_runup(float dt)
|
||||
_runup_complete = false;
|
||||
}
|
||||
// if rotor estimated speed is zero, then spooldown has been completed
|
||||
if (get_rotor_speed() <= 0.0f) { _spooldown_complete = true; } else { _spooldown_complete = false; }
|
||||
if (get_rotor_speed() <= 0.0f) {
|
||||
_spooldown_complete = true;
|
||||
} else {
|
||||
_spooldown_complete = false;
|
||||
}
|
||||
}
|
||||
|
||||
// get_rotor_speed - gets rotor speed either as an estimate, or (ToDO) a measured value
|
||||
@ -485,7 +489,7 @@ float AP_MotorsHeli_RSC::get_rotor_speed() const
|
||||
// servo_out parameter is of the range 0 ~ 1
|
||||
void AP_MotorsHeli_RSC::write_rsc(float servo_out)
|
||||
{
|
||||
if (_control_mode == ROTOR_CONTROL_MODE_DISABLED){
|
||||
if (_control_mode == ROTOR_CONTROL_MODE_DISABLED) {
|
||||
// do not do servo output to avoid conflicting with other output on the channel
|
||||
// ToDo: We should probably use RC_Channel_Aux to avoid this problem
|
||||
return;
|
||||
@ -494,7 +498,7 @@ void AP_MotorsHeli_RSC::write_rsc(float servo_out)
|
||||
}
|
||||
}
|
||||
|
||||
// calculate_throttlecurve - uses throttle curve and collective input to determine throttle setting
|
||||
// calculate_throttlecurve - uses throttle curve and collective input to determine throttle setting
|
||||
float AP_MotorsHeli_RSC::calculate_throttlecurve(float collective_in)
|
||||
{
|
||||
const float inpt = collective_in * 4.0f + 1.0f;
|
||||
|
Loading…
Reference in New Issue
Block a user