Commit 4174385c authored by Roque's avatar Roque

Drone simulator API refactoring

See merge request nexedi/erp5!1803
parents 720d86ee 0b781233
Pipeline #29234 failed with stage
in 0 seconds
......@@ -43,9 +43,8 @@ var DroneLogAPI = /** @class */ (function () {
return log_entry_list;
}
var log = this._drone_info.log_content, entry_1, entry_2, interval,
map_dict = this._mapManager.getMapInfo(),
min_height = 15, converted_log_point_list = [],
i, splitted_log_entry, x, y, position, lat, lon, height, timestamp,
i, splitted_log_entry, position, lat, lon, height, timestamp,
time_offset = 1, log_entry_list = getLogEntries(log);
//XXX: Patch to determine log time format (if this is standarized, drop it)
if (log_entry_list[0] && log_entry_list[1]) {
......@@ -208,6 +207,9 @@ var DroneLogAPI = /** @class */ (function () {
DroneLogAPI.prototype.exit = function (drone) {
return;
};
DroneLogAPI.prototype.set_loiter_mode = function (loiter) {
return;
};
return DroneLogAPI;
}());
\ No newline at end of file
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1006.43901.65103.9898</string> </value>
<value> <string>1009.38419.20212.62293</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1677599947.8</float>
<float>1688635412.87</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -226,7 +226,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1006.36731.10993.50739</string> </value>
<value> <string>1009.59163.16294.47701</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1677169724.0</float>
<float>1690395852.2</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -31,7 +31,6 @@ var DroneManager = /** @class */ (function () {
this._scene = scene;
this._canUpdate = true;
this._id = id;
this._leader_id = 0;
this._API = API; // var API created on AI evel
// Create the control mesh
this._controlMesh = BABYLON.Mesh.CreateBox(
......@@ -61,11 +60,6 @@ var DroneManager = /** @class */ (function () {
// swap y and z axis so z axis represents altitude
return new BABYLON.Vector3(vector.x, vector.z, vector.y);
};
Object.defineProperty(DroneManager.prototype, "leader_id", {
get: function () { return this._leader_id; },
enumerable: true,
configurable: true
});
Object.defineProperty(DroneManager.prototype, "drone_dict", {
get: function () { return this._API._drone_dict_list; },
enumerable: true,
......@@ -140,16 +134,21 @@ var DroneManager = /** @class */ (function () {
* Set a target point to move
*/
DroneManager.prototype.setTargetCoordinates = function (x, y, z) {
if (!this._canPlay) {
return;
}
//convert real geo-coordinates to virtual x-y coordinates
this._targetCoordinates = this._API.processCoordinates(x, y, z);
return this._API.internal_setTargetCoordinates(
this,
this._targetCoordinates
);
this._internal_setTargetCoordinates(x, y, z);
};
DroneManager.prototype._internal_setTargetCoordinates =
function (x, y, z, radius) {
if (!this._canPlay) {
return;
}
//convert real geo-coordinates to virtual x-y coordinates
this._targetCoordinates = this._API.processCoordinates(x, y, z);
return this._API.internal_setTargetCoordinates(
this,
this._targetCoordinates,
radius
);
};
DroneManager.prototype.internal_update = function (delta_time) {
var context = this;
if (this._controlMesh) {
......@@ -194,7 +193,7 @@ var DroneManager = /** @class */ (function () {
}
return this._API.setStartingPosition(this, x, y, z);
};
DroneManager.prototype.setSpeed = function (speed) {
DroneManager.prototype.setAirSpeed = function (speed) {
if (!this._canPlay) {
return;
}
......@@ -292,20 +291,11 @@ var DroneManager = /** @class */ (function () {
}
return null;
};
DroneManager.prototype.setAltitude = function (altitude) {
if (!this._canPlay) {
return;
}
return this._API.setAltitude(this, altitude);
};
/**
* Make the drone loiter (circle with a set radius)
*/
DroneManager.prototype.loiter = function (radius) {
if (!this._canPlay) {
return;
}
this._API.set_loiter_mode(radius);
DroneManager.prototype.loiter = function (x, y, z, radius) {
this._internal_setTargetCoordinates(x, y, z, radius);
};
DroneManager.prototype.getFlightParameters = function () {
if (this._API.getFlightParameters) {
......@@ -316,7 +306,7 @@ var DroneManager = /** @class */ (function () {
DroneManager.prototype.getYaw = function () {
return this._API.getYaw(this);
};
DroneManager.prototype.getSpeed = function () {
DroneManager.prototype.getAirSpeed = function () {
return this._speed;
};
DroneManager.prototype.getGroundSpeed = function () {
......@@ -591,13 +581,13 @@ var GameManager = /** @class */ (function () {
(0 < _this.waiting_update_count)) {
_this.ongoing_update_promise = _this._update(TIME_DELTA, fullscreen)
.push(function () {
_this.waiting_update_count -= 1;
_this.ongoing_update_promise = null;
triggerUpdateIfPossible();
}).push(undefined, function (error) {
console.log("ERROR on Game Manager update:", error);
_this.finish_deferred.reject.bind(_this.finish_deferred);
});
_this.waiting_update_count -= 1;
_this.ongoing_update_promise = null;
triggerUpdateIfPossible();
}).push(undefined, function (error) {
console.log("ERROR on Game Manager update:", error);
_this.finish_deferred.reject.bind(_this.finish_deferred);
});
}
}
try {
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1009.7345.31305.44339</string> </value>
<value> <string>1009.36979.45339.6075</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1687455790.77</float>
<float>1688635184.98</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -438,10 +438,10 @@
["my_map_height"]]
], [
"right",
[["my_start_AMSL"], ["my_drone_min_speed"], ["my_drone_speed"], ["my_drone_max_speed"],
["my_drone_max_acceleration"], ["my_drone_max_deceleration"],
["my_drone_max_roll"], ["my_drone_min_pitch"], ["my_drone_max_pitch"],
["my_drone_max_sink_rate"], ["my_drone_max_climb_rate"]]
[["my_start_AMSL"], ["my_drone_min_speed"], ["my_drone_speed"],
["my_drone_max_speed"], ["my_drone_max_acceleration"],
["my_drone_max_deceleration"], ["my_drone_max_roll"], ["my_drone_min_pitch"],
["my_drone_max_pitch"], ["my_drone_max_sink_rate"], ["my_drone_max_climb_rate"]]
], [
"bottom",
[["my_script"]]
......
......@@ -232,7 +232,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
<value> <unicode>zope</unicode> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -246,7 +246,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1006.23748.49086.52309</string> </value>
<value> <string>1009.22574.47206.13909</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>1677179158.33</float>
<float>1687785962.67</float>
<string>UTC</string>
</tuple>
</state>
......
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