mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 17:58:52 +08:00
FlightTask: update global reference
For the geo.h C library to convert between global and local frame we need an up to date global reference which is currently inside the vehicle_local_position message.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "FlightTask.hpp"
|
||||
#include <mathlib/mathlib.h>
|
||||
#include <lib/ecl/geo/geo.h>
|
||||
|
||||
constexpr uint64_t FlightTask::_timeout;
|
||||
// First index of empty_setpoint corresponds to time-stamp and requires a finite number.
|
||||
@@ -101,8 +102,11 @@ bool FlightTask::_evaluateVehicleLocalPosition()
|
||||
_dist_to_bottom = _sub_vehicle_local_position->get().dist_bottom;
|
||||
}
|
||||
|
||||
// estimator specified vehicle limits
|
||||
|
||||
// global frame reference coordinates to enable conversions
|
||||
if (_sub_vehicle_local_position->get().xy_global && _sub_vehicle_local_position->get().z_global) {
|
||||
globallocalconverter_init(_sub_vehicle_local_position->get().ref_lat, _sub_vehicle_local_position->get().ref_lon,
|
||||
_sub_vehicle_local_position->get().ref_alt, _sub_vehicle_local_position->get().ref_timestamp);
|
||||
}
|
||||
|
||||
// We don't check here if states are valid or not.
|
||||
// Validity checks are done in the sub-classes.
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <px4_module_params.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
#include <matrix/matrix/math.hpp>
|
||||
#include <uORB/Subscription.hpp>
|
||||
#include <uORB/topics/vehicle_local_position.h>
|
||||
#include <uORB/topics/vehicle_local_position_setpoint.h>
|
||||
#include <uORB/topics/vehicle_command.h>
|
||||
|
||||
Reference in New Issue
Block a user