Commit 96ed9f80 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

Comply with qjs-wrapper 2.1

parent b5a42f83
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
#include <future> #include <future>
#include <memory> #include <memory>
#include <thread> #include <thread>
#include "autopilot_wrapper.h" #include "dronedge_protocol.h"
#include "autopilot_API.h"
using namespace mavsdk; using namespace mavsdk;
using std::chrono::seconds; using std::chrono::seconds;
...@@ -226,16 +227,19 @@ void updateLogAndProjection(void) { ...@@ -226,16 +227,19 @@ void updateLogAndProjection(void) {
if(mavsdk_started) { if(mavsdk_started) {
metrics = telemetry->fixedwing_metrics(); metrics = telemetry->fixedwing_metrics();
oss << current_position[4] << ";" oss << current_position[TIMESTAMP] << ";"
<< current_position[0] << ";" << current_position[1] << ";" << current_position[LATITUDE] << ";"
<< current_position[2] << ";" << current_position[3] << ";" << current_position[LONGITUDE] << ";"
<< current_position[ABS_ALTITUDE] << ";"
<< current_position[REL_ALTITUDE] << ";"
<< telemetry->attitude_euler().yaw_deg << ";" << telemetry->attitude_euler().yaw_deg << ";"
<< metrics.airspeed_m_s << ";" << metrics.climb_rate_m_s; << metrics.airspeed_m_s << ";" << metrics.climb_rate_m_s;
log(oss.str()); log(oss.str());
if (first_coordinate_entered) { if (first_coordinate_entered) {
if (do_projection) { if (do_projection) {
updateProjection(current_position[0], current_position[1]); updateProjection(current_position[LATITUDE],
current_position[LONGITUDE]);
} else { } else {
doReposition_async( doReposition_async(
(float)targeted_destination.latitude, (float)targeted_destination.latitude,
...@@ -294,11 +298,11 @@ int start(const char * ip, int port, const char * log_file, int timeout) { ...@@ -294,11 +298,11 @@ int start(const char * ip, int port, const char * log_file, int timeout) {
if (timestamp_difference == 0) if (timestamp_difference == 0)
timestamp_difference = getTimestamp() - position.time_boot_ms; timestamp_difference = getTimestamp() - position.time_boot_ms;
current_position[0] = position.lat; current_position[LATITUDE] = position.lat;
current_position[1] = position.lon; current_position[LONGITUDE] = position.lon;
current_position[2] = position.alt; current_position[ABS_ALTITUDE] = position.alt;
current_position[3] = position.relative_alt; current_position[REL_ALTITUDE] = position.relative_alt;
current_position[4] = position.time_boot_ms + timestamp_difference; current_position[TIMESTAMP] = position.time_boot_ms + timestamp_difference;
}); });
telemetry->subscribe_landed_state([](const Telemetry::LandedState landed_state) { telemetry->subscribe_landed_state([](const Telemetry::LandedState landed_state) {
...@@ -458,9 +462,9 @@ float *getSpeedArray(void) { ...@@ -458,9 +462,9 @@ float *getSpeedArray(void) {
Telemetry::FixedwingMetrics metrics = telemetry->fixedwing_metrics(); Telemetry::FixedwingMetrics metrics = telemetry->fixedwing_metrics();
float *speedArray = float *speedArray =
(float*) malloc(SPEED_ARRAY_SIZE * sizeof(float)); (float*) malloc(SPEED_ARRAY_SIZE * sizeof(float));
speedArray[0] = getYaw(); speedArray[YAW] = getYaw();
speedArray[1] = metrics.airspeed_m_s; speedArray[SPEED] = metrics.airspeed_m_s;
speedArray[2] = metrics.climb_rate_m_s; speedArray[CLIMB_RATE] = metrics.climb_rate_m_s;
return speedArray; return speedArray;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment