fix(sensor_airspeed_sim): match SimulatorMavlink rounding

This commit is contained in:
Balduin
2026-04-09 16:14:15 +02:00
parent 1762c2db0b
commit 4bbaff0131
2 changed files with 3 additions and 2 deletions
@@ -184,8 +184,8 @@ void SensorAirspeedSim::check_failure_injection()
bool handled = false; bool handled = false;
bool supported = false; bool supported = false;
const int failure_unit = static_cast<int>(vehicle_command.param1 + 0.5f); const int failure_unit = static_cast<int>(std::lround(vehicle_command.param1));
const int failure_type = static_cast<int>(vehicle_command.param2 + 0.5f); const int failure_type = static_cast<int>(std::lround(vehicle_command.param2));
if (failure_unit == vehicle_command_s::FAILURE_UNIT_SENSOR_AIRSPEED) { if (failure_unit == vehicle_command_s::FAILURE_UNIT_SENSOR_AIRSPEED) {
@@ -34,6 +34,7 @@
#pragma once #pragma once
#include <lib/perf/perf_counter.h> #include <lib/perf/perf_counter.h>
#include <math.h>
#include <mathlib/mathlib.h> #include <mathlib/mathlib.h>
#include <px4_platform_common/defines.h> #include <px4_platform_common/defines.h>
#include <px4_platform_common/module.h> #include <px4_platform_common/module.h>