Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
7f4316cb
Commit
7f4316cb
authored
Jul 18, 2023
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_drone_simulator_test: test drone flight
parent
0b7c1c3e
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
1042 additions
and
367 deletions
+1042
-367
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/portal_tests/drone_simulator_ui_site_zuite/testDroneSimulatorAPIResults.zpt
..._simulator_ui_site_zuite/testDroneSimulatorAPIResults.zpt
+0
-365
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/portal_tests/drone_simulator_ui_site_zuite/testDroneSimulatorFlight.xml
...rone_simulator_ui_site_zuite/testDroneSimulatorFlight.xml
+1
-1
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/portal_tests/drone_simulator_ui_site_zuite/testDroneSimulatorFlight.zpt
...rone_simulator_ui_site_zuite/testDroneSimulatorFlight.zpt
+89
-0
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_html.html
...tem/web_page_module/test_drone_simulator_flight_html.html
+42
-0
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_html.xml
...Item/web_page_module/test_drone_simulator_flight_html.xml
+344
-0
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_js.js
...ateItem/web_page_module/test_drone_simulator_flight_js.js
+215
-0
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_js.xml
...teItem/web_page_module/test_drone_simulator_flight_js.xml
+346
-0
bt5/erp5_officejs_drone_simulator_test/bt/template_keep_last_workflow_history_only_path_list
...est/bt/template_keep_last_workflow_history_only_path_list
+1
-0
bt5/erp5_officejs_drone_simulator_test/bt/template_keep_path_list
..._officejs_drone_simulator_test/bt/template_keep_path_list
+1
-0
bt5/erp5_officejs_drone_simulator_test/bt/template_keep_workflow_path_list
..._drone_simulator_test/bt/template_keep_workflow_path_list
+1
-0
bt5/erp5_officejs_drone_simulator_test/bt/template_path_list
bt5/erp5_officejs_drone_simulator_test/bt/template_path_list
+2
-1
No files found.
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/portal_tests/drone_simulator_ui_site_zuite/testDroneSimulatorAPIResults.zpt
deleted
100644 → 0
View file @
0b7c1c3e
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/portal_tests/drone_simulator_ui_site_zuite/testDroneSimulator
APIResults
.xml
→
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/portal_tests/drone_simulator_ui_site_zuite/testDroneSimulator
Flight
.xml
View file @
7f4316cb
...
...
@@ -46,7 +46,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
testDroneSimulator
APIResults
</string>
</value>
<value>
<string>
testDroneSimulator
Flight
</string>
</value>
</item>
<item>
<key>
<string>
output_encoding
</string>
</key>
...
...
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/portal_tests/drone_simulator_ui_site_zuite/testDroneSimulatorFlight.zpt
0 → 100644
View file @
7f4316cb
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Test Drone Simulator OJS app (expected failure)
</title>
<!-- This test is expected to fail as the drone simulator runs on a web worker canvas, which relies on a very new feature: offscreen canvas
---- This feature is not supported yet by the latest Firefox ESR used in the test nodes -->
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test Drone Simulator OJS app (expected failure)
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplate/macros/init"
/>
<!-- Go to site -->
<tr>
<td>
open
</td>
<td>
${base_url}/web_site_module/officejs_drone_simulator/app/#/?page=drone_simulator_test_page
</td>
<td></td>
</tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'gadget_erp5_page_drone_simulator_test_page.html')]//input[@type="submit" and @name="action_run"]
</td>
<td></td>
<tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//span[@id="loading"]
</td>
<td></td>
<tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'babylonjs.gadget.html')]
</td>
<td></td>
<tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[contains(@data-gadget-url, 'babylonjs.gadget.html')]//canvas[contains(@data-engine, 'Babylon.js')]
</td>
<td></td>
<tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[contains(text(), 'CONSOLE LOG ENTRIES:')]
</td>
<td></td>
<tr>
<tr>
<td>
waitForElementPresent
</td>
<td>
//div[contains(text(), 'Simulation finished')]
</td>
<td></td>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(text(), 'Initial speed: OK')]
</td>
<td></td>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(text(), 'Yaw angle: OK')]
</td>
<td></td>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(text(), 'Timestamp: OK')]
</td>
<td></td>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(text(), 'Distance: OK')]
</td>
<td></td>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(text(), 'Latitude: OK')]
</td>
<td></td>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(text(), 'Longitude: OK')]
</td>
<td></td>
<tr>
<tr>
<td>
assertElementPresent
</td>
<td>
//div[contains(text(), 'Altitude: OK')]
</td>
<td></td>
<tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_html.html
0 → 100644
View file @
7f4316cb
<!DOCTYPE html>
<html>
<!--
data-i18n=Others
data-i18n=Tools
-->
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width"
/>
<title>
Drone Simulator Test Page
</title>
<link
rel=
"http://www.renderjs.org/rel/interface"
href=
"interface_page.html"
>
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<script
src=
"jiodev.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"domsugar.js"
type=
"text/javascript"
></script>
<script
type=
"text/javascript"
src=
"./libraries/seedrandom.min.js"
></script>
<script
src=
"gadget_erp5_page_drone_simulator_test_page.js"
type=
"text/javascript"
></script>
</head>
<body>
<form>
<div
data-gadget-url=
"gadget_erp5_form.html"
data-gadget-scope=
"form_view"
data-gadget-sandbox=
"public"
>
</div>
<input
name=
"action_run"
class=
"dialogconfirm"
type=
"submit"
value=
"Run"
style=
"margin-bottom: 20pt;margin-top: 20pt;"
>
<a
data-i18n=
"Storages"
></a>
<!-- for zelenium test common macro -->
<div
class=
"simulator_div"
></div>
<div
data-gadget-url=
"gadget_erp5_form.html"
data-gadget-scope=
"form_view_babylonjs"
data-gadget-sandbox=
"public"
>
</div>
<div
class=
"test_log"
></div>
</form>
</body>
</html>
\ No newline at end of file
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_html.xml
0 → 100644
View file @
7f4316cb
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_js.js
0 → 100644
View file @
7f4316cb
/*jslint indent: 2, maxlen: 100*/
/*global window, rJS, domsugar, document, URLSearchParams, Blob*/
(
function
(
window
,
rJS
,
domsugar
,
document
,
URLSearchParams
,
Blob
)
{
"
use strict
"
;
var
SIMULATION_SPEED
=
10
,
SIMULATION_TIME
=
270
,
MAP_SIZE
=
600
,
map_height
=
700
,
start_AMSL
=
595
,
DEFAULT_SPEED
=
16
,
MAX_ACCELERATION
=
6
,
MAX_DECELERATION
=
1
,
MIN_SPEED
=
12
,
MAX_SPEED
=
26
,
MAX_ROLL
=
35
,
MIN_PITCH
=
-
20
,
MAX_PITCH
=
25
,
MAX_CLIMB_RATE
=
8
,
MAX_SINK_RATE
=
3
,
NUMBER_OF_DRONES
=
1
,
FLAG_WEIGHT
=
5
,
SEED
=
'
flag
'
,
// Non-inputs parameters
DEFAULT_SCRIPT_CONTENT
=
'
function assert(a, b, msg) {
\n
'
+
'
if (a === b)
\n
'
+
'
console.log(msg + ": OK");
\n
'
+
'
else
\n
'
+
'
console.log(msg + ": FAIL");
\n
'
+
'
}
\n
'
+
'
function distance(lat1, lon1, lat2, lon2) {
\n
'
+
'
var R = 6371e3, // meters
\n
'
+
'
la1 = lat1 * Math.PI / 180, // lat, lon in radians
\n
'
+
'
la2 = lat2 * Math.PI / 180,
\n
'
+
'
lo1 = lon1 * Math.PI / 180,
\n
'
+
'
lo2 = lon2 * Math.PI / 180,
\n
'
+
'
haversine_phi = Math.pow(Math.sin((la2 - la1) / 2), 2),
\n
'
+
'
sin_lon = Math.sin((lo2 - lo1) / 2),
\n
'
+
'
h = haversine_phi + Math.cos(la1) * Math.cos(la2) * sin_lon * sin_lon;
\n
'
+
'
return 2 * R * Math.asin(Math.sqrt(h));
\n
'
+
'
}
\n
'
+
'
function compare(coord1, coord2) {
\n
'
+
'
assert(coord1.x, coord2.x, "Latitude")
\n
'
+
'
assert(coord1.y, coord2.y, "Longitude")
\n
'
+
'
assert(coord1.z, coord2.z, "Altitude")
\n
'
+
'
}
\n
'
+
'
me.onStart = function () {
\n
'
+
'
assert(me.getAirSpeed(), 16, "Initial speed");
\n
'
+
'
assert(me.getYaw(), 0, "Yaw angle")
\n
'
+
'
me.initialPosition = me.getCurrentPosition();
\n
'
+
'
me.setTargetCoordinates(
\n
'
+
'
me.initialPosition.x + 0.01,
\n
'
+
'
me.initialPosition.y,
\n
'
+
'
me.initialPosition.z
\n
'
+
'
);
\n
'
+
'
};
\n
'
+
'
me.onUpdate = function (timestamp) {
\n
'
+
'
var realDistance = distance(
\n
'
+
'
me.initialPosition.x,
\n
'
+
'
me.initialPosition.y,
\n
'
+
'
me.getCurrentPosition().x,
\n
'
+
'
me.getCurrentPosition().y
\n
'
+
'
).toFixed(8),
\n
'
+
'
expectedDistance = (me.getAirSpeed() * timestamp / 1000).toFixed(8);
\n
'
+
'
assert(timestamp, 1000 / 60, "Timestamp");
\n
'
+
'
assert(realDistance, expectedDistance, "Distance");
\n
'
+
'
compare(me.getCurrentPosition(), {
\n
'
+
'
x: me.initialPosition.x + 2.3992831666911723e-06,
\n
'
+
'
y: me.initialPosition.y,
\n
'
+
'
z: me.initialPosition.z
\n
'
+
'
});
\n
'
+
'
me.exit(me.triggerParachute());
\n
'
+
'
};
'
,
DRAW
=
true
,
LOG
=
true
,
LOG_TIME
=
1662.7915426540285
,
DRONE_LIST
=
[],
LOGIC_FILE_LIST
=
[
'
gadget_erp5_page_drone_capture_flag_logic.js
'
,
'
gadget_erp5_page_drone_capture_flag_fixedwingdrone.js
'
,
'
gadget_erp5_page_drone_capture_flag_enemydrone.js
'
];
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
"
notifySubmitted
"
)
.
declareMethod
(
'
render
'
,
function
render
()
{
var
gadget
=
this
;
return
gadget
.
runGame
();
})
.
declareJob
(
'
runGame
'
,
function
runGame
(
options
)
{
var
gadget
=
this
,
i
,
fragment
=
gadget
.
element
.
querySelector
(
'
.simulator_div
'
),
game_parameters_json
,
map_json
;
DRONE_LIST
=
[];
fragment
=
domsugar
(
gadget
.
element
.
querySelector
(
'
.simulator_div
'
),
[
domsugar
(
'
div
'
)]).
firstElementChild
;
for
(
i
=
0
;
i
<
NUMBER_OF_DRONES
;
i
+=
1
)
{
DRONE_LIST
[
i
]
=
{
"
id
"
:
i
,
"
type
"
:
"
FixedWingDroneAPI
"
,
"
script_content
"
:
DEFAULT_SCRIPT_CONTENT
};
}
map_json
=
{
"
map_size
"
:
parseFloat
(
MAP_SIZE
),
"
height
"
:
parseInt
(
map_height
,
10
),
"
start_AMSL
"
:
parseFloat
(
start_AMSL
),
"
flag_list
"
:
[{
"
position
"
:
{
"
x
"
:
-
27
,
"
y
"
:
72
,
"
z
"
:
10
}
}],
"
obstacle_list
"
:
[],
"
drones
"
:
{
"
user
"
:
DRONE_LIST
,
"
enemy
"
:
[]
}
};
game_parameters_json
=
{
"
debug_test_mode
"
:
true
,
"
drone
"
:
{
"
maxAcceleration
"
:
parseInt
(
MAX_ACCELERATION
,
10
),
"
maxDeceleration
"
:
parseInt
(
MAX_DECELERATION
,
10
),
"
minSpeed
"
:
parseInt
(
MIN_SPEED
,
10
),
"
speed
"
:
parseFloat
(
DEFAULT_SPEED
),
"
maxSpeed
"
:
parseInt
(
MAX_SPEED
,
10
),
"
maxRoll
"
:
parseFloat
(
MAX_ROLL
),
"
minPitchAngle
"
:
parseFloat
(
MIN_PITCH
),
"
maxPitchAngle
"
:
parseFloat
(
MAX_PITCH
),
"
maxSinkRate
"
:
parseFloat
(
MAX_SINK_RATE
),
"
maxClimbRate
"
:
parseFloat
(
MAX_CLIMB_RATE
)
},
"
gameTime
"
:
parseInt
(
SIMULATION_TIME
,
10
),
"
simulation_speed
"
:
parseInt
(
SIMULATION_SPEED
,
10
),
"
latency
"
:
{
"
information
"
:
0
,
"
communication
"
:
0
},
"
map
"
:
map_json
,
"
draw_flight_path
"
:
DRAW
,
"
temp_flight_path
"
:
true
,
"
log_drone_flight
"
:
LOG
,
"
log_interval_time
"
:
LOG_TIME
};
return
gadget
.
declareGadget
(
"
babylonjs.gadget.html
"
,
{
element
:
fragment
,
scope
:
'
simulator
'
})
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
form_view_babylonjs
'
);
})
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
render
({
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{
"
my_babylonjs
"
:
{
"
default
"
:
""
,
"
css_class
"
:
""
,
"
required
"
:
0
,
"
editable
"
:
1
,
"
key
"
:
"
babylonjs
"
,
"
hidden
"
:
0
,
"
type
"
:
"
GadgetField
"
,
"
url
"
:
"
babylonjs.gadget.html
"
,
"
sandbox
"
:
"
public
"
,
"
renderjs_extra
"
:
'
{"autorun": false,
'
+
'
"logic_file_list":
'
+
JSON
.
stringify
(
LOGIC_FILE_LIST
)
+
'
,
'
+
'
"game_parameters":
'
+
JSON
.
stringify
(
game_parameters_json
)
+
'
}
'
}
}},
"
_links
"
:
{
"
type
"
:
{
name
:
""
}
}
},
form_definition
:
{
group_list
:
[[
"
bottom
"
,
[[
"
my_babylonjs
"
]]
]]
}
});
})
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
form_view_babylonjs
'
);
})
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
getContent
();
})
.
push
(
function
(
result
)
{
var
div
=
domsugar
(
'
div
'
,
{
text
:
"
CONSOLE LOG ENTRIES:
"
});
document
.
querySelector
(
'
.container
'
).
parentNode
.
appendChild
(
div
);
function
createLogNode
(
message
)
{
var
node
=
document
.
createElement
(
"
div
"
);
var
textNode
=
document
.
createTextNode
(
message
);
node
.
appendChild
(
textNode
);
return
node
;
}
var
lines
=
result
.
console_log
.
split
(
'
\n
'
);
for
(
var
i
=
0
;
i
<
lines
.
length
;
i
++
)
{
var
node
=
createLogNode
(
lines
[
i
]);
document
.
querySelector
(
'
.test_log
'
).
appendChild
(
node
);
}
},
function
(
error
)
{
return
gadget
.
notifySubmitted
({
message
:
"
Error:
"
+
error
.
message
,
status
:
'
error
'
});
});
});
}(
window
,
rJS
,
domsugar
,
document
,
URLSearchParams
,
Blob
));
\ No newline at end of file
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_js.xml
0 → 100644
View file @
7f4316cb
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs_drone_simulator_test/bt/template_keep_last_workflow_history_only_path_list
0 → 100644
View file @
7f4316cb
web_page_module/test_drone_simulator_*
\ No newline at end of file
bt5/erp5_officejs_drone_simulator_test/bt/template_keep_path_list
0 → 100644
View file @
7f4316cb
web_page_module/test_drone_simulator_*
\ No newline at end of file
bt5/erp5_officejs_drone_simulator_test/bt/template_keep_workflow_path_list
0 → 100644
View file @
7f4316cb
web_page_module/test_drone_simulator_*
\ No newline at end of file
bt5/erp5_officejs_drone_simulator_test/bt/template_path_list
View file @
7f4316cb
portal_tests/drone_simulator_ui_site_zuite
portal_tests/drone_simulator_ui_site_zuite/**
\ No newline at end of file
portal_tests/drone_simulator_ui_site_zuite/**
web_page_module/test_drone_simulator_*
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment