mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 19:00:34 +08:00
Fix float and uint64_t comparison (#23199)
fix: ControlAllocator float and int comparison bug There was an incorrect comparison between a float variable `dt` and a `uint64_t` value representing 5 milliseconds (`5_ms`). As a result, `do_update` could never become true even if the last torque setpoint was received more than 5 milliseconds before. To solve this, the `5_ms` value has been converted to seconds (0.005f) for the comparison with `dt`.
This commit is contained in:
committed by
GitHub
parent
de0e73d505
commit
a8617cf681
@@ -393,7 +393,7 @@ ControlAllocator::Run()
|
||||
if (_vehicle_thrust_setpoint_sub.update(&vehicle_thrust_setpoint)) {
|
||||
_thrust_sp = matrix::Vector3f(vehicle_thrust_setpoint.xyz);
|
||||
|
||||
if (dt > 5_ms) {
|
||||
if (dt > 0.005f) {
|
||||
do_update = true;
|
||||
_timestamp_sample = vehicle_thrust_setpoint.timestamp_sample;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user