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:
MaEtUgR
2018-07-24 15:03:53 +02:00
committed by ChristophTobler
parent 7d4fcccf83
commit 12290c27e6
2 changed files with 7 additions and 2 deletions
+6 -2
View File
@@ -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.
+1
View File
@@ -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>