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

component/qjs-wrapper: v↑ qjs-wrapper (1.2 -> 1.3)

parent e5be76da
......@@ -9,8 +9,8 @@ parts = qjs-wrapper
[qjs-wrapper]
recipe = slapos.recipe.cmmi
configure-command = true
url = https://lab.nexedi.com/nexedi/qjs-wrapper/-/archive/v1.2/qjs-wrapper-v1.2.tar.gz
md5sum = e335fc2251610c09dde3e74787317d98
url = https://lab.nexedi.com/nexedi/qjs-wrapper/-/archive/v1.3/qjs-wrapper-v1.3.tar.gz
md5sum = 5f63356c6a10bf227e2641ea4f78c7a2
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
......
......@@ -18,7 +18,7 @@ md5sum = 360b58007c25727b7bd8a9154d5cafd4
[instance-default]
filename = instance-default.cfg
md5sum = b26633b118cddd7c7b8dfd61b360999c
md5sum = 903939308701b11b1ff751784a9be110
[instance-drone]
filename = instance-drone.cfg
......@@ -26,7 +26,7 @@ md5sum = 1ff50063f5a54712a0bc0ff38fa74630
[main]
filename = main.js
md5sum = 2118d7908a909c585e03531147b1d540
md5sum = d0bfcc79cdd7c1e5b8f5d264cc59074e
[pubsub]
filename = pubsub.js
......@@ -34,4 +34,4 @@ md5sum = 1555496ad591a31a845f33488d5c335d
[worker]
filename = worker.js
md5sum = 3893fb9228603e8c74f803476ec64dec
md5sum = e4b4ca3bde1a21f1dbfc4ff7fa3b872c
{% set autopilot_ip = slapparameter_dict.get('autopilotIp', '192.168.27.1') -%}
{% set autopilot_port = slapparameter_dict.get('autopilotPort', 7909) -%}
{% set flight_script = slapparameter_dict.get('flightScript', 'https://lab.nexedi.com/nexedi/flight-scripts/raw/master/default.js') -%}
{% set is_a_simulation = slapparameter_dict.get('isASimulation', False) -%}
{% set multicast_ip = slapparameter_dict.get('multicastIp', 'ff15::1111') -%}
......@@ -25,6 +26,7 @@ software-type = drone
return = instance-path
sla-computer_guid = {{ guid }}
config-autopilotIp = {{ autopilot_ip }}
config-autopilotPort = {{ dumps(autopilot_port) }}
config-numberOfPeers = {{ dumps(nb_peer) }}
config-id = {{ dumps(id) }}
config-isASimulation = {{ dumps(is_a_simulation) }}
......
......@@ -9,6 +9,11 @@
"description": "IP used to create a connection with the autopilot.",
"type": "string"
},
"autopilotPort": {
"title": "Port of the drone's autopilot",
"description": "Port on which autopilot service is running.",
"type": "integer"
},
"numberOfPeers": {
"title": "Number of Peers",
"description": "Number of drones and subscribers in the swarm",
......
......@@ -10,6 +10,12 @@
"type": "string",
"default": "192.168.27.1"
},
"autopilotPort": {
"title": "Port of the drone's autopilot",
"description": "Port on which autopilot service is running.",
"type": "integer",
"default": "7909"
},
"droneGuidList": {
"title": "List of drones computer ID",
"description": "List of computer ID of drones in the swarm",
......
......@@ -18,7 +18,6 @@ import { open, exit } from "std";
var CONF_PATH = {{ json_module.dumps(configuration) }},
conf_file = open(CONF_PATH, "r"),
configuration = JSON.parse(conf_file.readAsString()),
URL = "udp://" + configuration.autopilotIp + ":7909",
LOG_FILE = "{{ log_dir }}/mavsdk-log",
pubsubWorker,
worker,
......@@ -53,8 +52,12 @@ import { open, exit } from "std";
}
function connect() {
console.log("Will connect to", URL);
exitOnFail(start(URL, LOG_FILE, 60), "Failed to connect to " + URL);
var address = configuration.autopilotIp + ":" + configuration.autopilotPort;
console.log("Will connect to", address);
exitOnFail(
start(configuration.autopilotIp, configuration.autopilotPort, LOG_FILE, 60),
"Failed to connect to " + address
);
}
if (configuration.isADrone) {
......
......@@ -255,6 +255,7 @@ class JSDroneTestCase(SlapOSInstanceTestCase):
json.loads(self.get_partition('drone').getInstanceParameterDict()['_']),
{
'autopilotIp': '192.168.27.1',
'autopilotPort': 7909,
'id': 0,
'isASimulation': False,
'isADrone': False,
......
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */
/*global console, getAltitude, getAltitudeRel, getInitialAltitude, getLatitude,
getLongitude, getYaw, execUserScript, initPubsub, isInManualMode, landed,
loiter, setAirspeed, setAltitude, setManualControlInput, setMessage,
setTargetCoordinates, std, triggerParachute, Drone, Worker*/
getLongitude, getYaw, execUserScript, initPubsub, landed, loiter, setAirspeed,
setMessage, setTargetCoordinates, std, triggerParachute, Drone, Worker*/
import {
Drone,
triggerParachute,
......@@ -15,12 +14,9 @@ import {
getLongitude,
getYaw,
initPubsub,
isInManualMode,
landed,
loiter,
setAirspeed,
setAltitude,
setManualControlInput,
setMessage,
setTargetCoordinates
} from {{ json_module.dumps(qjs_wrapper) }};
......@@ -28,10 +24,9 @@ import * as std from "std";
import { Worker } from "os";
(function (console, getAltitude, getAltitudeRel, getInitialAltitude,
getLatitude, getLongitude, getYaw, initPubsub, isInManualMode,
landed, loiter, setAirspeed, setAltitude, setManualControlInput,
setMessage, setTargetCoordinates, std, triggerParachute, Drone,
Worker) {
getLatitude, getLongitude, getYaw, initPubsub, landed, loiter,
setAirspeed, setMessage, setTargetCoordinates, std, triggerParachute,
Drone, Worker) {
// Every script is evaluated per drone
"use strict";
......@@ -70,7 +65,6 @@ import { Worker } from "os";
setMessage(JSON.stringify({ content: msg, dest_id: id }));
},
setAirspeed: setAirspeed,
setAltitude: setAltitude,
setTargetCoordinates: setTargetCoordinates
};
conf_file.close();
......@@ -123,9 +117,6 @@ import { Worker } from "os";
});
// Call the drone onStart function
if (user_me.hasOwnProperty("onUpdate")) {
if (configuration.isADrone && isInManualMode()) {
setManualControlInput();
}
user_me.onUpdate(evt.data.timestamp);
}
parent.postMessage({type: "updated"});
......@@ -145,6 +136,5 @@ import { Worker } from "os";
}
};
}(console, getAltitude, getAltitudeRel, getInitialAltitude, getLatitude,
getLongitude, getYaw, initPubsub, isInManualMode, landed, loiter, setAirspeed,
setAltitude, setManualControlInput, setMessage, setTargetCoordinates, std,
triggerParachute, Drone, Worker));
getLongitude, getYaw, initPubsub, landed, loiter, setAirspeed, setMessage,
setTargetCoordinates, std, triggerParachute, Drone, Worker));
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