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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Georgios Dagkakis
erp5
Commits
f159d4f2
Commit
f159d4f2
authored
Mar 15, 2024
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_drone_simulator: fix timeout
Timeout feature was broken by
2f7689d1
. Add timeout check in tests.
parent
a12d43f0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
90 additions
and
83 deletions
+90
-83
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.js
...mplateItem/web_page_module/drone_capture_flag_logic_js.js
+2
-3
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.xml
...plateItem/web_page_module/drone_capture_flag_logic_js.xml
+2
-2
bt5/erp5_officejs_drone_capture_flag_test/PathTemplateItem/web_page_module/test_capture_drone_flight_js.js
...plateItem/web_page_module/test_capture_drone_flight_js.js
+35
-30
bt5/erp5_officejs_drone_capture_flag_test/PathTemplateItem/web_page_module/test_capture_drone_flight_js.xml
...lateItem/web_page_module/test_capture_drone_flight_js.xml
+2
-2
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.js
...hTemplateItem/web_page_module/drone_simulator_logic_js.js
+2
-3
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.xml
...TemplateItem/web_page_module/drone_simulator_logic_js.xml
+2
-2
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
+43
-39
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
+2
-2
No files found.
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.js
View file @
f159d4f2
...
...
@@ -1043,8 +1043,7 @@ var GameManager = /** @class */ (function () {
};
GameManager
.
prototype
.
_timeOut
=
function
()
{
var
seconds
=
Math
.
floor
(
this
.
_game_duration
/
1000
);
return
this
.
_totalTime
-
seconds
<=
0
;
return
this
.
_totalTime
-
this
.
_game_duration
<=
0
;
};
GameManager
.
prototype
.
_allDronesFinished
=
function
()
{
...
...
@@ -1227,7 +1226,7 @@ var GameManager = /** @class */ (function () {
_this
.
finish_deferred
=
RSVP
.
defer
();
console
.
log
(
"
Simulation started.
"
);
this
.
_game_duration
=
Date
.
now
();
this
.
_totalTime
=
GAMEPARAMETERS
.
gameTime
+
this
.
_game_duration
;
this
.
_totalTime
=
GAMEPARAMETERS
.
gameTime
*
1000
+
this
.
_game_duration
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.xml
View file @
f159d4f2
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
101
4.65026.25145.27272
</string>
</value>
<value>
<string>
101
5.15557.49327.13158
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>
17
09560433.33
</float>
<float>
17
10511088.86
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_capture_flag_test/PathTemplateItem/web_page_module/test_capture_drone_flight_js.js
View file @
f159d4f2
...
...
@@ -3,8 +3,9 @@
(
function
(
window
,
rJS
,
domsugar
,
document
)
{
"
use strict
"
;
var
SIMULATION_SPEED
=
10
,
SIMULATION_TIME
=
270
,
var
SIMULATION_SPEED
=
1
,
LOOP_INTERVAL
=
1000
/
60
,
SIMULATION_TIME
=
LOOP_INTERVAL
/
1000
,
MIN_LAT
=
45.6364
,
MAX_LAT
=
45.65
,
MIN_LON
=
14.2521
,
...
...
@@ -74,7 +75,7 @@
'
me.getCurrentPosition().longitude
\n
'
+
'
).toFixed(8),
\n
'
+
'
time_interval = timestamp - me.start_time,
\n
'
+
'
expected_interval =
1000 / 60
,
\n
'
+
'
expected_interval =
'
+
LOOP_INTERVAL
+
'
,
\n
'
+
'
expectedDistance = (me.getSpeed() * expected_interval / 1000).toFixed(8);
\n
'
+
'
assert(time_interval, Math.floor(expected_interval), "Timestamp");
\n
'
+
'
assert(realDistance, expectedDistance, "Distance");
\n
'
+
...
...
@@ -84,7 +85,6 @@
'
longitude: me.initialPosition.longitude,
\n
'
+
'
altitude: me.initialPosition.altitude
\n
'
+
'
});
\n
'
+
'
me.exit(me.land());
\n
'
+
'
};
'
,
DRAW
=
true
,
LOG
=
true
,
...
...
@@ -120,19 +120,19 @@
"
script_content
"
:
DEFAULT_SCRIPT_CONTENT
};
}
map_json
=
{
"
height
"
:
parseInt
(
map_height
,
10
)
,
"
start_AMSL
"
:
parseFloat
(
start_AMSL
)
,
"
min_lat
"
:
parseFloat
(
MIN_LAT
)
,
"
max_lat
"
:
parseFloat
(
MAX_LAT
)
,
"
min_lon
"
:
parseFloat
(
MIN_LON
)
,
"
max_lon
"
:
parseFloat
(
MAX_LON
)
,
"
height
"
:
map_height
,
"
start_AMSL
"
:
start_AMSL
,
"
min_lat
"
:
MIN_LAT
,
"
max_lat
"
:
MAX_LAT
,
"
min_lon
"
:
MIN_LON
,
"
max_lon
"
:
MAX_LON
,
"
flag_list
"
:
[],
"
obstacle_list
"
:
[],
"
enemy_list
"
:
[],
"
initial_position
"
:
{
"
longitude
"
:
parseFloat
(
INIT_LON
)
,
"
latitude
"
:
parseFloat
(
INIT_LAT
)
,
"
altitude
"
:
parseFloat
(
INIT_ALT
)
"
longitude
"
:
INIT_LON
,
"
latitude
"
:
INIT_LAT
,
"
altitude
"
:
INIT_ALT
}
};
operator_init_msg
=
{
...
...
@@ -142,20 +142,20 @@
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
)
,
"
maxAcceleration
"
:
MAX_ACCELERATION
,
"
maxDeceleration
"
:
MAX_DECELERATION
,
"
minSpeed
"
:
MIN_SPEED
,
"
speed
"
:
DEFAULT_SPEED
,
"
maxSpeed
"
:
MAX_SPEED
,
"
maxRoll
"
:
MAX_ROLL
,
"
minPitchAngle
"
:
MIN_PITCH
,
"
maxPitchAngle
"
:
MAX_PITCH
,
"
maxSinkRate
"
:
MAX_SINK_RATE
,
"
maxClimbRate
"
:
MAX_CLIMB_RATE
,
"
list
"
:
DRONE_LIST
},
"
gameTime
"
:
parseInt
(
SIMULATION_TIME
,
10
)
,
"
simulation_speed
"
:
parseInt
(
SIMULATION_SPEED
,
10
)
,
"
gameTime
"
:
SIMULATION_TIME
,
"
simulation_speed
"
:
SIMULATION_SPEED
,
"
latency
"
:
{
"
information
"
:
0
,
"
communication
"
:
0
...
...
@@ -214,19 +214,24 @@
})
.
push
(
function
(
result
)
{
var
div
=
domsugar
(
'
div
'
,
{
text
:
"
CONSOLE LOG ENTRIES:
"
}),
lines
,
l
,
node
;
l
,
test_log_node
=
document
.
querySelector
(
'
.test_log
'
)
;
document
.
querySelector
(
'
.container
'
).
parentNode
.
appendChild
(
div
);
function
createLogNode
(
message
)
{
function
appendToTestLog
(
test_log_node
,
message
)
{
var
log_node
=
document
.
createElement
(
"
div
"
),
textNode
=
document
.
createTextNode
(
message
);
log_node
.
appendChild
(
textNode
);
return
log_node
;
test_log_node
.
appendChild
(
log_node
)
;
}
lines
=
result
.
console_log
.
split
(
'
\n
'
);
for
(
l
=
0
;
l
<
lines
.
length
;
l
+=
1
)
{
node
=
createLogNode
(
lines
[
l
]);
document
.
querySelector
(
'
.test_log
'
).
appendChild
(
node
);
if
(
lines
[
l
]
!==
'
TIMEOUT!
'
)
{
appendToTestLog
(
test_log_node
,
lines
[
l
]);
}
else
{
appendToTestLog
(
test_log_node
,
'
Timeout: OK
'
);
return
;
}
}
appendToTestLog
(
test_log_node
,
'
Timeout: FAILED
'
);
},
function
(
error
)
{
return
gadget
.
notifySubmitted
({
message
:
"
Error:
"
+
error
.
message
,
status
:
'
error
'
});
...
...
bt5/erp5_officejs_drone_capture_flag_test/PathTemplateItem/web_page_module/test_capture_drone_flight_js.xml
View file @
f159d4f2
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
101
4.60680.20078.34286
</string>
</value>
<value>
<string>
101
5.15807.32412.36915
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>
17
09286290.59
</float>
<float>
17
10526066.91
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.js
View file @
f159d4f2
...
...
@@ -763,8 +763,7 @@ var GameManager = /** @class */ (function () {
};
GameManager
.
prototype
.
_timeOut
=
function
()
{
var
seconds
=
Math
.
floor
(
this
.
_game_duration
/
1000
);
return
this
.
_totalTime
-
seconds
<=
0
;
return
this
.
_totalTime
-
this
.
_game_duration
<=
0
;
};
GameManager
.
prototype
.
_allDronesFinished
=
function
()
{
...
...
@@ -904,7 +903,7 @@ var GameManager = /** @class */ (function () {
_this
.
finish_deferred
=
RSVP
.
defer
();
console
.
log
(
"
Simulation started.
"
);
this
.
_game_duration
=
Date
.
now
();
this
.
_totalTime
=
GAMEPARAMETERS
.
gameTime
+
this
.
_game_duration
;
this
.
_totalTime
=
GAMEPARAMETERS
.
gameTime
*
1000
+
this
.
_game_duration
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.xml
View file @
f159d4f2
...
...
@@ -240,7 +240,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
101
4.65027.38618.31573
</string>
</value>
<value>
<string>
101
5.15533.18317.53657
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
17
09560536.57
</float>
<float>
17
10509638.96
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_js.js
View file @
f159d4f2
...
...
@@ -3,11 +3,9 @@
(
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
,
var
SIMULATION_SPEED
=
1
,
LOOP_INTERVAL
=
1000
/
60
,
SIMULATION_TIME
=
LOOP_INTERVAL
/
1000
,
DEFAULT_SPEED
=
16
,
MAX_ACCELERATION
=
6
,
MAX_DECELERATION
=
1
,
...
...
@@ -19,7 +17,6 @@
MAX_CLIMB_RATE
=
8
,
MAX_SINK_RATE
=
3
,
NUMBER_OF_DRONES
=
1
,
FLAG_WEIGHT
=
5
,
MIN_LAT
=
45.6364
,
MAX_LAT
=
45.65
,
MIN_LON
=
14.2521
,
...
...
@@ -78,7 +75,7 @@
'
me.getCurrentPosition().longitude
\n
'
+
'
).toFixed(8),
\n
'
+
'
time_interval = timestamp - me.start_time,
\n
'
+
'
expected_interval =
1000 / 60
,
\n
'
+
'
expected_interval =
'
+
LOOP_INTERVAL
+
'
,
\n
'
+
'
expectedDistance = (me.getSpeed() * expected_interval / 1000).toFixed(8);
\n
'
+
'
assert(time_interval.toFixed(4), expected_interval.toFixed(4), "Timestamp");
\n
'
+
'
assert(realDistance, expectedDistance, "Distance");
\n
'
+
...
...
@@ -88,7 +85,6 @@
'
longitude: me.initialPosition.longitude,
\n
'
+
'
altitude: me.initialPosition.altitude
\n
'
+
'
});
\n
'
+
'
me.exit(me.land());
\n
'
+
'
};
'
,
DRAW
=
true
,
LOG
=
true
,
...
...
@@ -175,35 +171,35 @@
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
)
"
maxAcceleration
"
:
MAX_ACCELERATION
,
"
maxDeceleration
"
:
MAX_DECELERATION
,
"
minSpeed
"
:
MIN_SPEED
,
"
speed
"
:
DEFAULT_SPEED
,
"
maxSpeed
"
:
MAX_SPEED
,
"
maxRoll
"
:
MAX_ROLL
,
"
minPitchAngle
"
:
MIN_PITCH
,
"
maxPitchAngle
"
:
MAX_PITCH
,
"
maxSinkRate
"
:
MAX_SINK_RATE
,
"
maxClimbRate
"
:
MAX_CLIMB_RATE
},
"
gameTime
"
:
parseInt
(
SIMULATION_TIME
,
10
)
,
"
simulation_speed
"
:
parseInt
(
SIMULATION_SPEED
,
10
)
,
"
gameTime
"
:
SIMULATION_TIME
,
"
simulation_speed
"
:
SIMULATION_SPEED
,
"
latency
"
:
{
"
information
"
:
0
,
"
communication
"
:
0
},
"
map
"
:
{
"
min_lat
"
:
parseFloat
(
MIN_LAT
)
,
"
max_lat
"
:
parseFloat
(
MAX_LAT
)
,
"
min_lon
"
:
parseFloat
(
MIN_LON
)
,
"
max_lon
"
:
parseFloat
(
MAX_LON
)
,
"
height
"
:
parseInt
(
HEIGHT
)
,
"
start_AMSL
"
:
parseFloat
(
start_AMSL
)
"
min_lat
"
:
MIN_LAT
,
"
max_lat
"
:
MAX_LAT
,
"
min_lon
"
:
MIN_LON
,
"
max_lon
"
:
MAX_LON
,
"
height
"
:
HEIGHT
,
"
start_AMSL
"
:
start_AMSL
},
"
initialPosition
"
:
{
"
longitude
"
:
parseFloat
(
INIT_LON
)
,
"
latitude
"
:
parseFloat
(
INIT_LAT
)
,
"
altitude
"
:
parseFloat
(
INIT_ALT
)
"
longitude
"
:
INIT_LON
,
"
latitude
"
:
INIT_LAT
,
"
altitude
"
:
INIT_ALT
},
"
draw_flight_path
"
:
DRAW
,
"
temp_flight_path
"
:
true
,
...
...
@@ -257,19 +253,27 @@
return
form_gadget
.
getContent
();
})
.
push
(
function
(
result
)
{
var
div
=
domsugar
(
'
div
'
,
{
text
:
"
CONSOLE LOG ENTRIES:
"
});
var
div
=
domsugar
(
'
div
'
,
{
text
:
"
CONSOLE LOG ENTRIES:
"
}),
lines
=
result
.
console_log
.
split
(
'
\n
'
),
line_nb
,
node
,
test_log_node
=
document
.
querySelector
(
'
.test_log
'
);;
document
.
querySelector
(
'
.container
'
).
parentNode
.
appendChild
(
div
);
function
createLogNode
(
message
)
{
var
node
=
document
.
createElement
(
"
div
"
);
var
textNode
=
document
.
createTextNode
(
message
);
node
.
appendChild
(
textNode
);
return
node
;
function
appendToTestLog
(
test_log_node
,
message
)
{
var
log_node
=
document
.
createElement
(
"
div
"
),
textNode
=
document
.
createTextNode
(
message
);
log_
node
.
appendChild
(
textNode
);
test_log_node
.
appendChild
(
log_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
);
for
(
line_nb
=
0
;
line_nb
<
lines
.
length
;
line_nb
+=
1
)
{
if
(
lines
[
line_nb
]
!==
'
TIMEOUT!
'
)
{
appendToTestLog
(
test_log_node
,
lines
[
line_nb
]);
}
else
{
appendToTestLog
(
test_log_node
,
'
Timeout: OK
'
);
return
;
}
}
appendToTestLog
(
test_log_node
,
'
Timeout: FAILED
'
);
},
function
(
error
)
{
return
gadget
.
notifySubmitted
({
message
:
"
Error:
"
+
error
.
message
,
status
:
'
error
'
});
...
...
bt5/erp5_officejs_drone_simulator_test/PathTemplateItem/web_page_module/test_drone_simulator_flight_js.xml
View file @
f159d4f2
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
101
4.60681.20667.37171
</string>
</value>
<value>
<string>
101
5.15809.60561.48213
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>
17
09286436.53
</float>
<float>
17
10526207.55
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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