mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Fix simulated gimbal behavior with zero velocity (#25217)
* fix simulated gimbal behavior with zero velocity * check for PX4_ISFINITE before checking for magnitude
This commit is contained in:
parent
8dd14d9aaa
commit
13122c29c0
@ -240,6 +240,11 @@ float GZGimbal::computeJointSetpoint(const float att_stp, const float rate_stp,
|
||||
{
|
||||
|
||||
if (PX4_ISFINITE(rate_stp)) {
|
||||
if (math::abs_t(rate_stp) < FLT_EPSILON) {
|
||||
// Handle zero velocity by sending the last target angle
|
||||
return last_stp;
|
||||
}
|
||||
|
||||
const float rate_diff = dt * rate_stp;
|
||||
const float stp_from_rate = last_stp + rate_diff;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user