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

erp5_officejs_drone_simulator_test: refactor x-y-z / lat-lon-alt properties to be consistent

See !1850
parent 505f14c9
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
start_AMSL = 595, start_AMSL = 595,
INIT_LON = 14.2658, INIT_LON = 14.2658,
INIT_LAT = 45.6412, INIT_LAT = 45.6412,
INIT_Z = 15, INIT_ALT = 15,
// Non-inputs parameters // Non-inputs parameters
DEFAULT_SCRIPT_CONTENT = DEFAULT_SCRIPT_CONTENT =
'function assert(a, b, msg) {\n' + 'function assert(a, b, msg) {\n' +
...@@ -51,9 +51,9 @@ ...@@ -51,9 +51,9 @@
'}\n' + '}\n' +
'\n' + '\n' +
'function compare(coord1, coord2) {\n' + 'function compare(coord1, coord2) {\n' +
' assert(coord1.x, coord2.x, "Latitude")\n' + ' assert(coord1.latitude, coord2.latitude, "Latitude")\n' +
' assert(coord1.y, coord2.y, "Longitude")\n' + ' assert(coord1.longitude, coord2.longitude, "Longitude")\n' +
' assert(coord1.z, coord2.z, "Altitude")\n' + ' assert(coord1.altitude, coord2.altitude, "Altitude")\n' +
'}\n' + '}\n' +
'\n' + '\n' +
'me.onStart = function () {\n' + 'me.onStart = function () {\n' +
...@@ -61,8 +61,8 @@ ...@@ -61,8 +61,8 @@
' assert(me.getYaw(), 0, "Yaw angle")\n' + ' assert(me.getYaw(), 0, "Yaw angle")\n' +
' me.initialPosition = me.getCurrentPosition();\n' + ' me.initialPosition = me.getCurrentPosition();\n' +
' me.setTargetCoordinates(\n' + ' me.setTargetCoordinates(\n' +
' me.initialPosition.x + 0.01,\n' + ' me.initialPosition.latitude + 0.01,\n' +
' me.initialPosition.y,\n' + ' me.initialPosition.longitude,\n' +
' me.getAltitudeAbs()\n' + ' me.getAltitudeAbs()\n' +
' );\n' + ' );\n' +
'};\n' + '};\n' +
...@@ -70,19 +70,19 @@ ...@@ -70,19 +70,19 @@
'me.onUpdate = function (timestamp) {\n' + 'me.onUpdate = function (timestamp) {\n' +
' var current_position = me.getCurrentPosition(),\n' + ' var current_position = me.getCurrentPosition(),\n' +
' realDistance = distance(\n' + ' realDistance = distance(\n' +
' me.initialPosition.x,\n' + ' me.initialPosition.latitude,\n' +
' me.initialPosition.y,\n' + ' me.initialPosition.longitude,\n' +
' me.getCurrentPosition().x,\n' + ' me.getCurrentPosition().latitude,\n' +
' me.getCurrentPosition().y\n' + ' me.getCurrentPosition().longitude\n' +
' ).toFixed(8),\n' + ' ).toFixed(8),\n' +
' expectedDistance = (me.getAirSpeed() * timestamp / 1000).toFixed(8);\n' + ' expectedDistance = (me.getAirSpeed() * timestamp / 1000).toFixed(8);\n' +
' assert(timestamp, 1000 / 60, "Timestamp");\n' + ' assert(timestamp, 1000 / 60, "Timestamp");\n' +
' assert(realDistance, expectedDistance, "Distance");\n' + ' assert(realDistance, expectedDistance, "Distance");\n' +
' current_position.x = current_position.x.toFixed(7);\n' + ' current_position.latitude = current_position.latitude.toFixed(7);\n' +
' compare(current_position, {\n' + ' compare(current_position, {\n' +
' x: (me.initialPosition.x + 2.3992831666911723e-06).toFixed(7),\n' + ' latitude: (me.initialPosition.latitude + 2.3992831666911723e-06).toFixed(7),\n' +
' y: me.initialPosition.y,\n' + ' longitude: me.initialPosition.longitude,\n' +
' z: me.initialPosition.z\n' + ' altitude: me.initialPosition.altitude\n' +
' });\n' + ' });\n' +
' me.exit(me.triggerParachute());\n' + ' me.exit(me.triggerParachute());\n' +
'};', '};',
...@@ -199,7 +199,7 @@ ...@@ -199,7 +199,7 @@
"initialPosition": { "initialPosition": {
"longitude": parseFloat(INIT_LON), "longitude": parseFloat(INIT_LON),
"latitude": parseFloat(INIT_LAT), "latitude": parseFloat(INIT_LAT),
"z": parseFloat(INIT_Z) "altitude": parseFloat(INIT_ALT)
}, },
"draw_flight_path": DRAW, "draw_flight_path": DRAW,
"temp_flight_path": true, "temp_flight_path": true,
......
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1010.12196.1891.61832</string> </value> <value> <string>1012.50925.12802.42871</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>1691485888.5</float> <float>1701095838.64</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