Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Wing: Compensate minimum sink rate based on weight ratio and air density #22049

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/modules/fw_pos_control/FixedwingPositionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,21 @@ FixedwingPositionControl::init()
return true;
}

float FixedwingPositionControl::getMaximumClimbRate()
float FixedwingPositionControl::getWeightRatio()
{

float weight_factor = 1.0f;

if (_param_weight_base.get() > 0.0f && _param_weight_gross.get() > 0.0f) {
weight_factor = math::constrain(_param_weight_base.get() / _param_weight_gross.get(), MIN_WEIGHT_RATIO,
weight_factor = math::constrain(_param_weight_gross.get() / _param_weight_base.get(), MIN_WEIGHT_RATIO,
MAX_WEIGHT_RATIO);
}

return weight_factor;
}

float FixedwingPositionControl::getMaximumClimbRate()
{
float climbrate_max = _param_fw_t_clmb_max.get();

const float density_min = _param_density_min.get();
Expand All @@ -116,7 +121,12 @@ float FixedwingPositionControl::getMaximumClimbRate()
climbrate_max = _param_fw_t_clmb_max.get() + density_gradient * delta_rho;
}

return climbrate_max * weight_factor;
return climbrate_max / getWeightRatio();
}

float FixedwingPositionControl::getMinimumSinkRate()
{
return _param_fw_t_sink_min.get() * sqrtf(getWeightRatio() * CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C / _air_density);
}

int
Expand Down
17 changes: 17 additions & 0 deletions src/modules/fw_pos_control/FixedwingPositionControl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,24 @@ class FixedwingPositionControl final : public ModuleBase<FixedwingPositionContro
*/
float get_terrain_altitude_takeoff(float takeoff_alt);

/**
* @brief Return the maximum climb rate achievable under the current conditions.
* @return Maximum climbrate.
*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for writing a brief - can you list the conditions that are considered, and can you add units to the @return?

float getMaximumClimbRate();

/**
* @brief Return the minimum sink rate achievable under the current conditions.
* @return Minimum sink rate.
*/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment

float getMinimumSinkRate();

/**
* @brief Return the ratio of actual vehicle weight to vehicle base weight.
* @return Weight ratio.
*/
float getWeightRatio();

/**
* @brief Maps the manual control setpoint (pilot sticks) to height rate commands
*
Expand Down