Commit 4174385c authored by Roque's avatar Roque

Drone simulator API refactoring

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