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 @@
#include <future>
#include <memory>
#include <thread>
#include "autopilot_wrapper.h"
#include "dronedge_protocol.h"
#include "autopilot_API.h"
using namespace mavsdk;
using std::chrono::seconds;
......@@ -226,16 +227,19 @@ void updateLogAndProjection(void) {
if(mavsdk_started) {
metrics = telemetry->fixedwing_metrics();
oss << current_position[4] << ";"
<< current_position[0] << ";" << current_position[1] << ";"
<< current_position[2] << ";" << current_position[3] << ";"
oss << current_position[TIMESTAMP] << ";"
<< current_position[LATITUDE] << ";"
<< current_position[LONGITUDE] << ";"
<< current_position[ABS_ALTITUDE] << ";"
<< current_position[REL_ALTITUDE] << ";"
<< telemetry->attitude_euler().yaw_deg << ";"
<< metrics.airspeed_m_s << ";" << metrics.climb_rate_m_s;
log(oss.str());
if (first_coordinate_entered) {
if (do_projection) {
updateProjection(current_position[0], current_position[1]);
updateProjection(current_position[LATITUDE],
current_position[LONGITUDE]);
} else {
doReposition_async(
(float)targeted_destination.latitude,
......@@ -294,11 +298,11 @@ int start(const char * ip, int port, const char * log_file, int timeout) {
if (timestamp_difference == 0)
timestamp_difference = getTimestamp() - position.time_boot_ms;
current_position[0] = position.lat;
current_position[1] = position.lon;
current_position[2] = position.alt;
current_position[3] = position.relative_alt;
current_position[4] = position.time_boot_ms + timestamp_difference;
current_position[LATITUDE] = position.lat;
current_position[LONGITUDE] = position.lon;
current_position[ABS_ALTITUDE] = position.alt;
current_position[REL_ALTITUDE] = position.relative_alt;
current_position[TIMESTAMP] = position.time_boot_ms + timestamp_difference;
});
telemetry->subscribe_landed_state([](const Telemetry::LandedState landed_state) {
......@@ -458,9 +462,9 @@ float *getSpeedArray(void) {
Telemetry::FixedwingMetrics metrics = telemetry->fixedwing_metrics();
float *speedArray =
(float*) malloc(SPEED_ARRAY_SIZE * sizeof(float));
speedArray[0] = getYaw();
speedArray[1] = metrics.airspeed_m_s;
speedArray[2] = metrics.climb_rate_m_s;
speedArray[YAW] = getYaw();
speedArray[SPEED] = metrics.airspeed_m_s;
speedArray[CLIMB_RATE] = metrics.climb_rate_m_s;
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