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

component/qjs-wrapper: use manual control to fly

Manual control is used under the hood to set course to coordinates
parent 61c1d268
......@@ -10,8 +10,8 @@ parts = qjs-wrapper
recipe = slapos.recipe.cmmi
shared = true
configure-command = true
url = https://lab.nexedi.com/nexedi/qjs-wrapper/-/archive/v0.2/qjs-wrapper-v0.2.tar.gz
md5sum = fa78424e5314d6d3f76e9b0ec28f7878
url = https://lab.nexedi.com/nexedi/qjs-wrapper/-/archive/v0.3/qjs-wrapper-v0.3.tar.gz
md5sum = 850b9d5b8530521635a08baa1a2aa9e0
environment =
C_INCLUDE_PATH=include:${open62541:location}/include:${open62541:location}/deps:${open62541:location}/src/pubsub:${quickjs:location}/include
CPLUS_INCLUDE_PATH=include:${mavsdk:location}/include:${mavsdk:location}/include/mavsdk
......
......@@ -14,7 +14,7 @@
# not need these here).
[instance-profile]
filename = instance.cfg
md5sum = 6529287d0d5438aa6be0fc58602e996f
md5sum = ec3dad4513c8587300f1ad64266a4887
[main]
filename = main.js
......@@ -26,4 +26,4 @@ md5sum = d8798c3206f129e8715afd3ca23afa1a
[worker]
filename = worker.js
md5sum = 4d0ec5e300385bcd3078724ddd8993b4
md5sum = 926094ffa8f32cc62c991d8528543cc7
......@@ -97,3 +97,4 @@ inline = {{ script }}
extra-context =
key drone_id_list drone:drone-id-list
key id drone:id
key is_publisher drone:is-publisher
/*global console*/
import {
Drone,
doParachute,
triggerParachute,
getAltitude,
getAltitudeRel,
getInitialAltitude,
......@@ -9,11 +9,13 @@ import {
getLongitude,
getYaw,
initPubsub,
isInManualMode,
landed,
loiter,
setAirspeed,
setAltitude,
setCheckpoint,
setManualControlInput,
setTargetCoordinates
} from "{{ qjs_wrapper }}";
import { Worker } from "os"
......@@ -23,7 +25,8 @@ import * as std from "std";
// Every script is evaluated per drone
"use strict";
const drone_dict = {},
drone_id_list = {{ drone_id_list }};
drone_id_list = {{ drone_id_list }},
IS_PUBLISHER = {{ 'true' if is_publisher else 'false' }};
var parent = Worker.parent,
user_me = {
......@@ -33,7 +36,7 @@ import * as std from "std";
//to move into user script
setCheckpoint: setCheckpoint,
//required to fly
doParachute: doParachute,
triggerParachute: triggerParachute,
drone_dict: {},
exit: function(exit_code) {
parent.postMessage({type: "exited", exit: exit_code});
......@@ -98,7 +101,10 @@ import * as std from "std";
parent.postMessage({type: "loaded"});
} else if (type === 'update') {
// Call the drone onStart function
if (user_me.hasOwnProperty('onUpdate')) {
if (user_me.hasOwnProperty("onUpdate")) {
if (IS_PUBLISHER && isInManualMode()) {
setManualControlInput();
}
user_me.onUpdate(evt.data.timestamp);
}
parent.postMessage({type: "updated"});
......
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