mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 07:31:36 +08:00
tiltrotor tilt support: fix thrust compensation constraining
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
@@ -395,11 +395,10 @@ void Tiltrotor::fill_actuator_outputs()
|
|||||||
|
|
||||||
float Tiltrotor::thrust_compensation_for_tilt()
|
float Tiltrotor::thrust_compensation_for_tilt()
|
||||||
{
|
{
|
||||||
|
|
||||||
// only compensate for tilt angle up to 0.5 * max tilt
|
// only compensate for tilt angle up to 0.5 * max tilt
|
||||||
float compensated_tilt = math::constrain(_tilt_control, 0.0f, 0.5f);
|
float compensated_tilt = math::constrain(_tilt_control, 0.0f, 0.5f);
|
||||||
|
|
||||||
// increase vertical thrust by 1/cos(tilt), limmit to [0,1]
|
// increase vertical thrust by 1/cos(tilt), limmit to [-1,0]
|
||||||
return math::constrain(_v_att_sp->thrust_body[2] / cosf(compensated_tilt * M_PI_2_F), 0.0f, 1.0f);
|
return math::constrain(_v_att_sp->thrust_body[2] / cosf(compensated_tilt * M_PI_2_F), -1.0f, 0.0f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user