Commit 16f88948 authored by Roque's avatar Roque

erp5_officejs_drone: improve precision in script test

- capture flag
- drone simulator
parent c09ec2e3
...@@ -55,7 +55,8 @@ ...@@ -55,7 +55,8 @@
' );\n' + ' );\n' +
'};\n' + '};\n' +
'me.onUpdate = function (timestamp) {\n' + 'me.onUpdate = function (timestamp) {\n' +
'var realDistance = distance(\n' + ' var current_position = me.getCurrentPosition(),\n' +
' realDistance = distance(\n' +
' me.initialPosition.x,\n' + ' me.initialPosition.x,\n' +
' me.initialPosition.y,\n' + ' me.initialPosition.y,\n' +
' me.getCurrentPosition().x,\n' + ' me.getCurrentPosition().x,\n' +
...@@ -64,10 +65,11 @@ ...@@ -64,10 +65,11 @@
' 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' +
'compare(me.getCurrentPosition(), {\n' + ' current_position.x = current_position.x.toFixed(7);\n' +
' x: me.initialPosition.x + 2.3992831666911723e-06,\n' + ' compare(current_position, {\n' +
' y: me.initialPosition.y,\n' + ' x: (me.initialPosition.x + 2.3992831666911723e-06).toFixed(7),\n' +
' z: me.initialPosition.z\n' + ' y: me.initialPosition.y,\n' +
' z: me.initialPosition.z\n' +
'});\n' + '});\n' +
'me.exit(me.triggerParachute());\n' + 'me.exit(me.triggerParachute());\n' +
'};', '};',
......
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1009.56051.15404.48947</string> </value> <value> <string>1010.10600.362.51182</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>1690898400.26</float> <float>1690983490.56</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -68,7 +68,8 @@ ...@@ -68,7 +68,8 @@
'};\n' + '};\n' +
'\n' + '\n' +
'me.onUpdate = function (timestamp) {\n' + 'me.onUpdate = function (timestamp) {\n' +
' var realDistance = distance(\n' + ' var current_position = me.getCurrentPosition(),\n' +
' realDistance = distance(\n' +
' me.initialPosition.x,\n' + ' me.initialPosition.x,\n' +
' me.initialPosition.y,\n' + ' me.initialPosition.y,\n' +
' me.getCurrentPosition().x,\n' + ' me.getCurrentPosition().x,\n' +
...@@ -77,8 +78,9 @@ ...@@ -77,8 +78,9 @@
' 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' +
' compare(me.getCurrentPosition(), {\n' + ' current_position.x = current_position.x.toFixed(7);\n' +
' x: me.initialPosition.x + 2.3992831666911723e-06,\n' + ' compare(current_position, {\n' +
' x: (me.initialPosition.x + 2.3992831666911723e-06).toFixed(7),\n' +
' y: me.initialPosition.y,\n' + ' y: me.initialPosition.y,\n' +
' z: me.initialPosition.z\n' + ' z: me.initialPosition.z\n' +
' });\n' + ' });\n' +
......
...@@ -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.3741.38295.37973</string> </value> <value> <string>1010.10621.5765.11161</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>1690898327.04</float> <float>1690900659.22</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