Commit b1351508 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾 Committed by Roque

erp5_officejs_drone_simulator: fix altitude related functions

- fix setAltitude:
  - Update `_last_target` when calling `setAltitude` otherwise `loiter` is broken.
  - Convert altitude parameter from absolute to relative value.

- fix getInitialAltitude
  - return absolute altitude

- fix getAltitudeAbs
parent 720d86ee
......@@ -262,7 +262,8 @@ var FixedWingDroneAPI = /** @class */ (function () {
};
FixedWingDroneAPI.prototype.setAltitude = function (drone, altitude) {
drone._targetCoordinates.z = altitude;
drone._targetCoordinates.z = altitude - this._map_dict.start_AMSL;
this._last_target = drone._targetCoordinates;
};
FixedWingDroneAPI.prototype.setSpeed = function (drone, speed) {
......@@ -526,10 +527,10 @@ var FixedWingDroneAPI = /** @class */ (function () {
return;
};
FixedWingDroneAPI.prototype.getInitialAltitude = function () {
return 0;
return this._map_dict.start_AMSL;
};
FixedWingDroneAPI.prototype.getAltitudeAbs = function (altitude) {
return altitude;
return altitude + this._map_dict.start_AMSL;
};
FixedWingDroneAPI.prototype.getMinHeight = function () {
return 0;
......
......@@ -240,7 +240,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1006.36731.10993.50739</string> </value>
<value> <string>1007.12617.23470.24132</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1677169724.0</float>
<float>1679396042.23</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