Commit cf7bf78a authored by Roque's avatar Roque

erp5_officejs_drone_simulator: log ground speed instead of air speed

See merge request nexedi/erp5!1744
parents 111c030b 77e628d0
...@@ -507,6 +507,13 @@ var FixedWingDroneAPI = /** @class */ (function () { ...@@ -507,6 +507,13 @@ var FixedWingDroneAPI = /** @class */ (function () {
FixedWingDroneAPI.prototype.getClimbRate = function (drone) { FixedWingDroneAPI.prototype.getClimbRate = function (drone) {
return drone.worldDirection.y * drone.getSpeed(); return drone.worldDirection.y * drone.getSpeed();
}; };
FixedWingDroneAPI.prototype.getGroundSpeed = function (drone) {
var direction = drone.worldDirection;
return Math.sqrt(
Math.pow(direction.x * drone.getSpeed(), 2)
+ Math.pow(direction.z * drone.getSpeed(), 2)
);
};
FixedWingDroneAPI.prototype.triggerParachute = function (drone) { FixedWingDroneAPI.prototype.triggerParachute = function (drone) {
var drone_pos = drone.getCurrentPosition(); var drone_pos = drone.getCurrentPosition();
drone.setTargetCoordinates(drone_pos.x, drone_pos.y, 5); drone.setTargetCoordinates(drone_pos.x, drone_pos.y, 5);
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1006.23750.47435.55654</string> </value> <value> <string>1006.36731.10993.50739</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1676554628.54</float> <float>1677169724.0</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -319,6 +319,9 @@ var DroneManager = /** @class */ (function () { ...@@ -319,6 +319,9 @@ var DroneManager = /** @class */ (function () {
DroneManager.prototype.getSpeed = function () { DroneManager.prototype.getSpeed = function () {
return this._speed; return this._speed;
}; };
DroneManager.prototype.getGroundSpeed = function () {
return this._API.getGroundSpeed(this);
};
DroneManager.prototype.getClimbRate = function () { DroneManager.prototype.getClimbRate = function () {
return this._API.getClimbRate(this); return this._API.getClimbRate(this);
}; };
...@@ -524,9 +527,9 @@ var GameManager = /** @class */ (function () { ...@@ -524,9 +527,9 @@ var GameManager = /** @class */ (function () {
if (GAMEPARAMETERS.draw_flight_path) { if (GAMEPARAMETERS.draw_flight_path) {
this._last_position_drawn = []; this._last_position_drawn = [];
this._trace_objects_per_drone = []; this._trace_objects_per_drone = [];
header_list = ["timestamp", "latitude", "longitude", "AMSL (m)", header_list = ["timestamp (ms)", "latitude (°)", "longitude (°)", "AMSL (m)",
"rel altitude (m)", "yaw(°)", "air speed (m/s)", "rel altitude (m)", "yaw (°)", "ground speed (m/s)",
"climb rate(m/s)"]; "climb rate (m/s)"];
for (drone = 0; drone < GAMEPARAMETERS.droneList.length; drone += 1) { for (drone = 0; drone < GAMEPARAMETERS.droneList.length; drone += 1) {
this._flight_log[drone] = []; this._flight_log[drone] = [];
this._flight_log[drone].push(header_list); this._flight_log[drone].push(header_list);
...@@ -687,7 +690,7 @@ var GameManager = /** @class */ (function () { ...@@ -687,7 +690,7 @@ var GameManager = /** @class */ (function () {
game_manager._flight_log[index].push([ game_manager._flight_log[index].push([
game_manager._game_duration, geo_coordinates.x, game_manager._game_duration, geo_coordinates.x,
geo_coordinates.y, map_info.start_AMSL + drone_position.z, geo_coordinates.y, map_info.start_AMSL + drone_position.z,
drone_position.z, drone.getYaw(), drone.getSpeed(), drone_position.z, drone.getYaw(), drone.getGroundSpeed(),
drone.getClimbRate() drone.getClimbRate()
]); ]);
} }
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1006.2016.60568.40294</string> </value> <value> <string>1006.36707.19986.52872</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1675086932.85</float> <float>1677168868.23</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