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

component/qjs-wrapper: use Position class

Use Position class to retrive drone's current position instead of using various
getters.
parent 2bc6eca1
......@@ -83,7 +83,7 @@ CMAKE_CFLAGS=-I${tinyxml2:location}/include
recipe = slapos.recipe.cmmi
configure-command = true
url = https://lab.nexedi.com/nexedi/mavsdk-wrapper/-/archive/update_set_target_coordinates/mavsdk-wrapper-update_set_target_coordinates.tar.gz
md5sum = f138398a48367632ede1001ac72a7aa6
md5sum = 4be34ba1e3632c254ddfa650f8c92b02
environment =
CPLUS_INCLUDE_PATH=${autopilot-wrapper-header:location}:${mavsdk:location}/include:${mavsdk:location}/include/mavsdk
LDFLAGS=-L${mavsdk:location}/lib -Wl,-rpath=${mavsdk:location}/lib
......@@ -41,12 +41,9 @@ DLL_PUBLIC int setTargetCoordinates(double la, double lo, float a);
// Information functions
DLL_PUBLIC float getAltitude(void);
DLL_PUBLIC float getAltitudeRel(void);
DLL_PUBLIC float getInitialAltitude(void);
DLL_PUBLIC double getInitialLatitude(void);
DLL_PUBLIC double getInitialLongitude(void);
DLL_PUBLIC double getLatitude(void);
DLL_PUBLIC double getLongitude(void);
DLL_PUBLIC double *getPositionArray(void);
DLL_PUBLIC float *getSpeedArray(void);
DLL_PUBLIC double getTakeOffAltitude(void);
......
......@@ -10,7 +10,7 @@ parts = qjs-wrapper
recipe = slapos.recipe.cmmi
configure-command = true
url = https://lab.nexedi.com/nexedi/qjs-wrapper/-/archive/update_settarget/qjs-wrapper-update_settarget.tar.gz
md5sum = 1487b2f30b99e5c2870d0fa955b2bb23
md5sum = 912c21c7d7e0117e234fc5dd20688ec5
environment =
C_INCLUDE_PATH=include:${open62541:location}/include:${open62541:location}/deps:${open62541:location}/src/pubsub:${quickjs:location}/include:${autopilot-wrapper-header:location}
LDFLAGS=-L${open62541:location}/lib -Wl,-rpath=${open62541:location}/lib -L${mavsdk-wrapper:location}/lib -Wl,-rpath=${mavsdk-wrapper:location}/lib
......@@ -14,4 +14,4 @@
# not need these here).
[autopilot-wrapper-header]
filename = autopilot_wrapper.h
md5sum = 16347f35ac6803e1f225bd98c5b92f2c
md5sum = 08359de87499908b30f72ca2b8ace966
......@@ -42,4 +42,4 @@ md5sum = 0d51149929f3cbcaac966b815bb1fb0b
[worker]
_update_hash_filename_ = drone-scripts/worker.js.jinja
md5sum = 4af40990337396ad41decb6f143ca443
md5sum = c6fb16fccd429ac0e6cff99c66d9debb
......@@ -8,12 +8,10 @@ import {
triggerParachute,
getAirspeed,
getAltitude,
getAltitudeRel,
getClimbRate,
getInitialAltitude,
getLatitude,
getLongitude,
getLog,
getPosition,
getYaw,
initPubsub,
loiter,
......@@ -36,10 +34,9 @@ import {
import { evalScript, fdopen, loadFile, open } from "std";
(function (Drone, SIGTERM, WNOHANG, Worker, close, console, evalScript, exec,
fdopen, getAltitude, getAltitudeRel, getInitialAltitude,
getLatitude, getLongitude, getLog, getYaw, initPubsub, kill,
loadFile, loiter, open, pipe, setAirSpeed, setMessage,
setReadHandler, setTargetCoordinates, triggerParachute,
fdopen, getAltitude, getInitialAltitude, getLog, getPosition, getYaw,
initPubsub, kill, loadFile, loiter, open, pipe, setAirSpeed,
setMessage, setReadHandler, setTargetCoordinates, triggerParachute,
updateLogAndProjection, waitpid) {
// Every script is evaluated per drone
"use strict";
......@@ -62,13 +59,7 @@ import { evalScript, fdopen, loadFile, open } from "std";
drone_dict: {},
exit: exitWorker,
getAltitudeAbs: getAltitude,
getCurrentPosition: function () {
return {
x: getLatitude(),
y: getLongitude(),
z: getAltitudeRel()
};
},
getCurrentPosition: getPosition,
getInitialAltitude: getInitialAltitude,
getYaw: getYaw,
getSpeed: getAirspeed,
......@@ -280,7 +271,7 @@ import { evalScript, fdopen, loadFile, open } from "std";
}
};
}(Drone, SIGTERM, WNOHANG, Worker, close, console, evalScript, exec,
fdopen, getAltitude, getAltitudeRel, getInitialAltitude,
getLatitude, getLongitude, getLog, getYaw, initPubsub, kill, loadFile,
loiter, open, pipe, setAirSpeed, setMessage, setReadHandler,
setTargetCoordinates, triggerParachute, updateLogAndProjection, waitpid));
fdopen, getAltitude, getInitialAltitude, getLog, getPosition, getYaw,
initPubsub, kill, loadFile, loiter, open, pipe, setAirSpeed, setMessage,
setReadHandler, setTargetCoordinates, triggerParachute,
updateLogAndProjection, waitpid));
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