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