mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 15:04:06 +08:00
autom. trigger baro calib on boot
This commit is contained in:
parent
68b349be2f
commit
aeb2a1afff
@ -37,6 +37,7 @@
|
||||
#include <px4_platform_common/events.h>
|
||||
#include <lib/geo/geo.h>
|
||||
#include <lib/atmosphere/atmosphere.h>
|
||||
#include <uORB/topics/vehicle_command.h>
|
||||
|
||||
namespace sensors
|
||||
{
|
||||
@ -293,6 +294,26 @@ void VehicleAirData::Run()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!_calibration_done) {
|
||||
// allow all drivers to start up
|
||||
_calibration_delay = _calibration_delay == 0 ? time_now_us : _calibration_delay;
|
||||
|
||||
if (time_now_us - _calibration_delay > 1_s) {
|
||||
_calibration_done = true;
|
||||
uORB::Publication<vehicle_command_s> _vehicle_command_sub{ORB_ID(vehicle_command)};
|
||||
vehicle_command_s vcmd{};
|
||||
vcmd.command = vehicle_command_s::VEHICLE_CMD_PREFLIGHT_CALIBRATION;
|
||||
vcmd.param1 = 0;
|
||||
vcmd.param2 = 0;
|
||||
vcmd.param3 = 1;
|
||||
vcmd.param4 = 0;
|
||||
vcmd.param5 = 0;
|
||||
vcmd.param6 = 0;
|
||||
vcmd.param7 = 0;
|
||||
_vehicle_command_sub.publish(vcmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!parameter_update) {
|
||||
|
||||
@ -123,6 +123,9 @@ private:
|
||||
|
||||
float _air_temperature_celsius{20.f}; // initialize with typical 20degC ambient temperature
|
||||
|
||||
bool _calibration_done{false};
|
||||
uint64_t _calibration_delay{0};
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamFloat<px4::params::SENS_BARO_QNH>) _param_sens_baro_qnh,
|
||||
(ParamFloat<px4::params::SENS_BARO_RATE>) _param_sens_baro_rate
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user