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
c3ab8096
Commit
c3ab8096
authored
Mar 21, 2024
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_drone_simulator: loop interval
parent
25f8b070
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
25 deletions
+47
-25
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.js
...Item/web_page_module/drone_simulator_fixedwingdrone_js.js
+2
-2
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.xml
...tem/web_page_module/drone_simulator_fixedwingdrone_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
+24
-15
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/PathTemplateItem/web_page_module/ojs_drone_simulator_script_page_js.js
...tem/web_page_module/ojs_drone_simulator_script_page_js.js
+15
-2
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/ojs_drone_simulator_script_page_js.xml
...em/web_page_module/ojs_drone_simulator_script_page_js.xml
+2
-2
No files found.
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.js
View file @
c3ab8096
...
...
@@ -102,7 +102,7 @@ var FixedWingDroneAPI = /** @class */ (function () {
/*
** Function called on every drone update, right before onUpdate AI script
*/
FixedWingDroneAPI
.
prototype
.
internal_update
=
function
(
context
,
delta_time
)
{
FixedWingDroneAPI
.
prototype
.
internal_
position_
update
=
function
(
context
,
delta_time
)
{
this
.
_updateSpeed
(
context
,
delta_time
);
this
.
_updatePosition
(
context
,
delta_time
);
...
...
@@ -112,7 +112,7 @@ var FixedWingDroneAPI = /** @class */ (function () {
/*
** Function called on every drone update, right after onUpdate AI script
*/
FixedWingDroneAPI
.
prototype
.
internal_
post
_update
=
function
(
drone
)
{
FixedWingDroneAPI
.
prototype
.
internal_
info
_update
=
function
(
drone
)
{
var
_this
=
this
,
drone_position
=
drone
.
getCurrentPosition
(),
drone_info
;
/*if (_this._start_altitude > 0) { //TODO move start_altitude here
_this.reachAltitude(drone);
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.xml
View file @
c3ab8096
...
...
@@ -240,7 +240,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1015.
19909.43325.57463
</string>
</value>
<value>
<string>
1015.
21415.54357.41250
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
1710
776370.92
</float>
<float>
1710
947081.61
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.js
View file @
c3ab8096
...
...
@@ -124,7 +124,7 @@ var DroneManager = /** @class */ (function () {
this
.
_canCommunicate
=
true
;
this
.
_targetCoordinates
=
initial_position
;
try
{
return
this
.
onStart
(
this
.
_API
.
_gameManager
.
_
game_duration
);
return
this
.
onStart
(
this
.
_API
.
_gameManager
.
_
start_time
);
}
catch
(
error
)
{
console
.
warn
(
'
Drone crashed on start due to error:
'
,
error
);
this
.
_internal_crash
(
error
);
...
...
@@ -132,17 +132,18 @@ var DroneManager = /** @class */ (function () {
};
DroneManager
.
prototype
.
_callSetTargetCommand
=
function
(
latitude
,
longitude
,
altitude
,
speed
,
radius
)
{
var
current_time
=
this
.
_API
.
_gameManager
.
getCurrentTime
();
if
(
!
this
.
isReadyToFly
())
{
return
;
}
if
(
this
.
_API
.
_gameManager
.
_game_duration
-
this
.
_last_command_timestamp
if
(
current_time
-
this
.
_last_command_timestamp
<
1000
/
this
.
_API
.
getMaxCommandFrequency
())
{
this
.
_internal_crash
(
new
Error
(
'
Minimum interval between commands is
'
+
1000
/
this
.
_API
.
getMaxCommandFrequency
()
+
'
milliseconds
'
));
}
this
.
_internal_setTargetCoordinates
(
latitude
,
longitude
,
altitude
,
speed
,
radius
);
this
.
_last_command_timestamp
=
this
.
_API
.
_gameManager
.
_game_duration
;
this
.
_last_command_timestamp
=
current_time
;
};
/**
* Set a target point to move
...
...
@@ -167,14 +168,16 @@ var DroneManager = /** @class */ (function () {
);
};
DroneManager
.
prototype
.
internal_update
=
function
(
delta_time
)
{
var
context
=
this
;
var
context
=
this
,
gameManager
=
this
.
_API
.
_gameManager
;
if
(
this
.
_controlMesh
)
{
context
.
_API
.
internal_update
(
context
,
delta_time
);
if
(
context
.
_canUpdate
)
{
context
.
_API
.
internal_position_update
(
context
,
delta_time
);
if
(
context
.
_canUpdate
&&
Math
.
floor
(
gameManager
.
_game_duration
/
GAMEPARAMETERS
.
loop_interval_time
)
>
gameManager
.
loop_count
)
{
context
.
_canUpdate
=
false
;
gameManager
.
loop_count
+=
1
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
context
.
onUpdate
(
context
.
_API
.
_gameManager
.
_game_duration
);
return
context
.
onUpdate
(
context
.
_API
.
_gameManager
.
getCurrentTime
()
);
})
.
push
(
function
()
{
context
.
_canUpdate
=
true
;
...
...
@@ -183,7 +186,7 @@ var DroneManager = /** @class */ (function () {
context
.
_internal_crash
(
error
);
})
.
push
(
function
()
{
context
.
_API
.
internal_
post
_update
(
context
);
context
.
_API
.
internal_
info
_update
(
context
);
})
.
push
(
undefined
,
function
(
error
)
{
console
.
warn
(
'
Drone crashed on update due to error:
'
,
error
);
...
...
@@ -282,7 +285,7 @@ var DroneManager = /** @class */ (function () {
this
.
_controlMesh
.
position
.
z
,
this
.
_controlMesh
.
position
.
y
);
position
.
timestamp
=
this
.
_API
.
_gameManager
.
_game_duration
;
position
.
timestamp
=
this
.
_API
.
_gameManager
.
getCurrentTime
()
;
return
position
;
}
return
null
;
...
...
@@ -705,7 +708,8 @@ var GameManager = /** @class */ (function () {
this
.
_game_duration
+=
delta_time
;
var
color
,
drone_position
,
game_manager
=
this
,
geo_coordinates
,
log_count
,
map_info
,
map_manager
,
material
,
position_obj
,
seconds
=
Math
.
floor
(
this
.
_game_duration
/
1000
),
trace_objects
;
current_time
=
this
.
getCurrentTime
(),
seconds
=
Math
.
floor
(
current_time
/
1000
),
trace_objects
;
if
(
GAMEPARAMETERS
.
log_drone_flight
||
GAMEPARAMETERS
.
draw_flight_path
)
{
this
.
_droneList
.
forEach
(
function
(
drone
,
index
)
{
...
...
@@ -724,7 +728,7 @@ var GameManager = /** @class */ (function () {
drone_position
.
z
);
game_manager
.
_flight_log
[
index
].
push
([
game_manager
.
_game_duration
,
geo_coordinates
.
latitude
,
current_time
,
geo_coordinates
.
latitude
,
geo_coordinates
.
longitude
,
map_info
.
start_AMSL
+
drone_position
.
z
,
drone_position
.
z
,
drone
.
getYaw
(),
drone
.
getSpeed
(),
...
...
@@ -906,11 +910,13 @@ var GameManager = /** @class */ (function () {
GameManager
.
prototype
.
_start
=
function
()
{
var
_this
=
this
,
promise_list
;
_this
.
waiting_update_count
=
0
;
_this
.
loop_count
=
0
;
_this
.
ongoing_update_promise
=
null
;
_this
.
finish_deferred
=
RSVP
.
defer
();
console
.
log
(
"
Simulation started.
"
);
this
.
_game_duration
=
Date
.
now
();
this
.
_totalTime
=
GAMEPARAMETERS
.
gameTime
*
1000
+
this
.
_game_duration
;
this
.
_start_time
=
Date
.
now
();
this
.
_game_duration
=
0
;
this
.
_totalTime
=
GAMEPARAMETERS
.
gameTime
*
1000
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
...
...
@@ -998,9 +1004,8 @@ var GameManager = /** @class */ (function () {
"
let droneMe = function(NativeDate, me, Math, window, DroneManager,
"
+
"
GameManager, DroneLogAPI, FixedWingDroneAPI, BABYLON,
"
+
"
GAMEPARAMETERS) {
"
+
"
var start_time = (new Date(2070, 0, 0, 0, 0, 0, 0)).getTime();
"
+
"
Date.now = function () {
"
+
"
return
start_time + drone._tick * 1000/60
;};
"
+
"
return
me._API._gameManager.getCurrentTime()
;};
"
+
"
function Date() {if (!(this instanceof Date))
"
+
"
{throw new Error('Missing new operator');}
"
+
"
if (arguments.length === 0) {return new NativeDate(Date.now());}
"
+
...
...
@@ -1056,6 +1061,10 @@ var GameManager = /** @class */ (function () {
}
};
GameManager
.
prototype
.
getCurrentTime
=
function
()
{
return
this
.
_start_time
+
this
.
_game_duration
;
}
return
GameManager
;
}());
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.xml
View file @
c3ab8096
...
...
@@ -240,7 +240,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1015.2
1426.50931.23620
</string>
</value>
<value>
<string>
1015.2
4141.42399.13107
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
171
0926073.14
</float>
<float>
171
1026120.76
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/ojs_drone_simulator_script_page_js.js
View file @
c3ab8096
...
...
@@ -128,6 +128,7 @@
DRAW
=
true
,
LOG
=
true
,
LOG_TIME
=
1662.7915426540285
,
LOOP_INTERVAL
=
100
,
DRONE_LIST
=
[],
WIDTH
=
680
,
HEIGHT
=
340
,
...
...
@@ -192,6 +193,17 @@
"
hidden
"
:
0
,
"
type
"
:
"
IntegerField
"
},
"
my_loop_interval
"
:
{
"
description
"
:
"
Minimum interval (in milliseconds) between 2 executions of flight loop
"
,
"
title
"
:
"
Loop interval
"
,
"
default
"
:
LOOP_INTERVAL
,
"
css_class
"
:
""
,
"
required
"
:
1
,
"
editable
"
:
1
,
"
key
"
:
"
loop_interval
"
,
"
hidden
"
:
0
,
"
type
"
:
"
IntegerField
"
},
"
my_drone_min_speed
"
:
{
"
description
"
:
""
,
"
title
"
:
"
Drone min speed
"
,
...
...
@@ -445,8 +457,8 @@
form_definition
:
{
group_list
:
[[
"
left
"
,
[[
"
my_simulation_speed
"
],
[
"
my_simulation_time
"
],
[
"
my_
number_of_drones
"
],
[
"
my_minimum_latitud
"
],
[
"
my_maximum_latitud
"
],
[[
"
my_simulation_speed
"
],
[
"
my_simulation_time
"
],
[
"
my_
loop_interval
"
],
[
"
my_
number_of_drones
"
],
[
"
my_
minimum_latitud
"
],
[
"
my_maximum_latitud
"
],
[
"
my_minimum_longitud
"
],
[
"
my_maximum_longitud
"
],
[
"
my_init_pos_lat
"
],
[
"
my_init_pos_lon
"
],
[
"
my_init_pos_alt
"
],
[
"
my_map_height
"
]]
...
...
@@ -520,6 +532,7 @@
"
temp_flight_path
"
:
true
,
"
log_drone_flight
"
:
LOG
,
"
log_interval_time
"
:
LOG_TIME
,
"
loop_interval_time
"
:
parseInt
(
options
.
loop_interval
,
10
),
"
droneList
"
:
DRONE_LIST
};
return
gadget
.
declareGadget
(
"
babylonjs.gadget.html
"
,
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/ojs_drone_simulator_script_page_js.xml
View file @
c3ab8096
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1015.
15836.20157.60791
</string>
</value>
<value>
<string>
1015.
22612.41991.56780
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>
1710
527785.95
</float>
<float>
1710
934372.06
</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