mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 07:28:54 +08:00
fix(sensor_airspeed_sim): match SimulatorMavlink rounding
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user