Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 5 additions & 3 deletions src/modules/vtol_att_control/standard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,17 @@ void Standard::update_transition_state()
roll_body = Eulerf(Quatf(_fw_virtual_att_sp->q_d)).phi();
}

const float transition_throttle = getFrontTransitionThrottle();

if (_param_vt_psher_slew.get() <= FLT_EPSILON) {
// just set the final target throttle value
_pusher_throttle = _param_vt_f_trans_thr.get();
_pusher_throttle = transition_throttle;

} else if (_pusher_throttle <= _param_vt_f_trans_thr.get()) {
} else if (_pusher_throttle <= transition_throttle) {
// ramp up throttle to the target throttle value
const float dt = math::min((now - _last_time_pusher_transition_update) / 1e6f, 0.05f);
_pusher_throttle = math::min(_pusher_throttle +
_param_vt_psher_slew.get() * dt, _param_vt_f_trans_thr.get());
_param_vt_psher_slew.get() * dt, transition_throttle);

_last_time_pusher_transition_update = now;
}
Expand Down
1 change: 1 addition & 0 deletions src/modules/vtol_att_control/vtol_att_control_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ parameters:
VT_F_TRANS_THR:
description:
short: Target throttle value for the transition to fixed-wing flight
long: Scaled by the square root of the weight ratio (WEIGHT_GROSS / WEIGHT_BASE).
type: float
default: 1.0
min: 0.0
Expand Down
28 changes: 22 additions & 6 deletions src/modules/vtol_att_control/vtol_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,21 +539,26 @@ float VtolType::pusher_assist()

float VtolType::getFrontTransitionTimeFactor() const
{
// assumptions: transition_time = transition_true_airspeed / average_acceleration (thrust)
// transition_true_airspeed ~ sqrt(rho0 / rh0)
// assumptions:
// transition_time = transition_true_airspeed / average_acceleration (thrust)
// transition_true_airspeed ~ sqrt(rho0 / rh0) * sqrt(weight_ratio)
// average_acceleration ~ rho / rho0
// transition_time ~ sqrt(rho0/rh0) * rho0 / rho
// independent of weight: standard VTOL throttle is weight scaled,
// tiltrotor and tailsitter weight scale via hover thrust
// transition_time ~ sqrt(rho0/rh0) * rho0 / rho * sqrt(weight_ratio)

// low value: hot day at 4000m AMSL with some margin
// high value: cold day at 0m AMSL with some margin
const float rho = math::constrain(_attc->getAirDensity(), 0.7f, 1.5f);

float density_factor = 1.0f;

if (PX4_ISFINITE(rho)) {
float rho0_over_rho = atmosphere::kAirDensitySeaLevelStandardAtmos / rho;
return sqrtf(rho0_over_rho) * rho0_over_rho;
density_factor = sqrtf(rho0_over_rho) * rho0_over_rho;
}

return 1.0f;
return density_factor * sqrtf(getWeightRatio());
}

float VtolType::getMinimumFrontTransitionTime() const
Expand All @@ -574,15 +579,26 @@ float VtolType::getTransitionAirspeed() const
{
// Since the stall airspeed increases with vehicle weight, we increase the transition airspeed
// by the same factor.
return sqrtf(getWeightRatio()) * _param_vt_arsp_trans.get();
}

float VtolType::getFrontTransitionThrottle() const
{
// Thrust needs to scale with weight_ratio to keep the acceleration weight-independent. Assuming
// a quadratic throttle -> thrust map, this requires scaling the throttle by sqrt(weight_ratio).
return math::min(sqrtf(getWeightRatio()) * _param_vt_f_trans_thr.get(), 1.0f);
}

float VtolType::getWeightRatio() const
{
float weight_ratio = 1.0f;

if (_param_weight_base.get() > FLT_EPSILON && _param_weight_gross.get() > FLT_EPSILON) {
weight_ratio = math::constrain(_param_weight_gross.get() /
_param_weight_base.get(), kMinWeightRatio, kMaxWeightRatio);
}

return sqrtf(weight_ratio) * _param_vt_arsp_trans.get();
return weight_ratio;
}

float VtolType::getBlendAirspeed() const
Expand Down
19 changes: 15 additions & 4 deletions src/modules/vtol_att_control/vtol_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,17 @@ class VtolType : public ModuleParams
mode get_mode() {return _common_vtol_mode;}

/**
* @return Minimum front transition time scaled for air density (if available) [s]
* @return Minimum front transition time scaled for air density (if available) and vehicle weight [s]
*/
float getMinimumFrontTransitionTime() const;

/**
* @return Front transition timeout scaled for air density (if available) [s]
* @return Front transition timeout scaled for air density (if available) and vehicle weight [s]
*/
float getFrontTransitionTimeout() const;

/**
* @return Minimum open-loop front transition time scaled for air density (if available) [s]
* @return Minimum open-loop front transition time scaled for air density (if available) and vehicle weight [s]
*/
float getOpenLoopFrontTransitionTime() const;

Expand All @@ -249,6 +249,12 @@ class VtolType : public ModuleParams
*/
float getTransitionAirspeed() const;

/**
*
* @return The target front transition throttle scaled for vehicle weight
*/
float getFrontTransitionThrottle() const;

virtual void parameters_update() = 0;


Expand Down Expand Up @@ -366,10 +372,15 @@ class VtolType : public ModuleParams
void stopBlendingThrottleAfterFrontTransition() { _throttle_blend_start_ts = 0; }

/**
* @return Transition time scale factor for density.
* @return Transition time scale factor for density and vehicle weight.
*/
float getFrontTransitionTimeFactor() const;

/**
* @return Gross weight over base weight ratio, constrained to sane limits.
*/
float getWeightRatio() const;

};

#endif
Loading