review comments

Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
RomanBapst
2023-09-06 13:27:44 +03:00
parent ab1da27ebb
commit f847586b10
3 changed files with 13 additions and 6 deletions
@@ -106,10 +106,12 @@ float FixedwingPositionControl::getMaximumClimbRate()
float climbrate_max = _param_fw_t_clmb_max.get();
if (_param_density_min.get() > 0.0f) {
const float min_density = math::max(_param_density_min.get(), AIR_DENSITY_STANDARD_ATMOS_5000_AMSL);
const float density_min = _param_density_min.get();
if (density_min < AIR_DENSITY_STANDARD_ATMOS_1000_AMSL
&& density_min > AIR_DENSITY_STANDARD_ATMOS_5000_AMSL) {
const float density_gradient = (_param_fw_t_clmb_max.get() - CLIMBRATE_MIN) / (CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C -
min_density);
density_min);
const float delta_rho = _air_density - CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C;
climbrate_max = _param_fw_t_clmb_max.get() + density_gradient * delta_rho;
}
@@ -150,6 +150,9 @@ static constexpr float MAX_WEIGHT_RATIO = 2.0f;
// air density of standard athmosphere at 5000m above mean sea level [kg/m^3]
static constexpr float AIR_DENSITY_STANDARD_ATMOS_5000_AMSL = 0.7363f;
// air density of standard athmosphere at 1000m above mean sea level [kg/m^3]
static constexpr float AIR_DENSITY_STANDARD_ATMOS_1000_AMSL = 1.112f;
// climbrate defining the service ceiling, used to compensate max climbrate based on air density
static constexpr float CLIMBRATE_MIN = 0.5f; // [m/s]
@@ -1099,12 +1099,14 @@ PARAM_DEFINE_FLOAT(FW_THR_ASPD_MAX, 0.f);
* Service ceiling density
*
* Air density at which the vehicle in normal configuration is able to achieve a maximum climb rate of
* 0.5m/s at maximum throttle (FW_THR_MAX). Used to compensate for air density in FW_CLMB_MAX.
* Set < 0 to disable compensation of (FW_T_CLMB_MAX) based on air density.
* 0.5m/s at maximum throttle (FW_THR_MAX). Used to compensate for air density in FW_T_CLMB_MAX.
* Will only have an effect if value is between 0.7363 (5000m) and 1.112 (1000m).
*
* @min 0.7363
* @max 1.225
* @unit kg/m^3
* @decimal 2
* @increment 0.01
* @group FW TECS
*/
PARAM_DEFINE_FLOAT(FW_DENSITY_MIN, -1.0f);
PARAM_DEFINE_FLOAT(FW_DENSITY_MIN, 1.225);