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
1
Issues
1
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
Roque
erp5
Commits
0076438f
Commit
0076438f
authored
Sep 29, 2022
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_drone_simulator: get rid of rescue swarm dependency
- use a JSON dict as game parameters (instead of RS maps)
parent
2e3234f9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
19 deletions
+99
-19
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_logic_js.js
...TemplateItem/web_page_module/drone_web_worker_logic_js.js
+91
-4
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_logic_js.xml
...emplateItem/web_page_module/drone_web_worker_logic_js.xml
+2
-2
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_page_js.js
...hTemplateItem/web_page_module/drone_web_worker_page_js.js
+1
-7
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_page_js.xml
...TemplateItem/web_page_module/drone_web_worker_page_js.xml
+2
-2
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_web_worker_js.js
...ateItem/web_page_module/drone_web_worker_web_worker_js.js
+1
-2
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_web_worker_js.xml
...teItem/web_page_module/drone_web_worker_web_worker_js.xml
+2
-2
No files found.
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_logic_js.js
View file @
0076438f
...
...
@@ -11,7 +11,95 @@ var runGame, updateGame, eventGame, game_manager_instance;
"
use strict
"
;
console
.
log
(
'
game logic
'
);
runGame
=
function
(
canvas
,
script
,
game_parameters_json
,
log
)
{
runGame
=
function
(
canvas
,
script
,
log
)
{
var
game_parameters_json
=
{
"
distances
"
:
{
"
communication
"
:
99999
,
"
control
"
:
1500
,
"
information
"
:
5
},
"
drone
"
:
{
"
maxAcceleration
"
:
1
,
"
maxSpeed
"
:
16.666667
,
"
collisionSector
"
:
0.25
,
"
broadcastingTime
"
:
1000
,
"
viewAngle
"
:
60
},
"
meteo
"
:
0.5
,
"
derive
"
:
{
"
speed
"
:
0.1
,
"
direction
"
:
{
"
x
"
:
1
,
"
y
"
:
0.5
}
},
"
gameTime
"
:
1800
,
"
goalDiameter
"
:
7
,
"
goalPositionLeftTeam
"
:
{
"
x
"
:
0
,
"
y
"
:
0
,
"
z
"
:
0.6
},
"
goalPositionRightTeam
"
:
{
"
x
"
:
0
,
"
y
"
:
0
,
"
z
"
:
0.6
},
"
latency
"
:
{
"
information
"
:
0
,
"
communication
"
:
0
},
"
mapSize
"
:
{
"
depth
"
:
1000
,
"
height
"
:
100
,
"
width
"
:
1000
},
"
obstacles
"
:
[],
"
initialHumanAreaPosition
"
:
{
"
x
"
:
-
400
,
"
y
"
:
400
,
"
z
"
:
0
},
"
randomSpawn
"
:
{
"
leftTeam
"
:
{
"
position
"
:
{
"
x
"
:
0
,
"
y
"
:
0
,
"
z
"
:
20
},
"
dispertion
"
:
{
"
x
"
:
8
,
"
y
"
:
8
,
"
z
"
:
6
},
"
types
"
:
[
"
DroneAaileFixeAPI
"
,
"
DroneLogAPI
"
,
"
DroneAPI
"
]
},
"
rightTeam
"
:
{
"
position
"
:
{
"
x
"
:
-
400
,
"
y
"
:
400
,
"
z
"
:
0
},
"
dispertion
"
:
{
"
x
"
:
100
,
"
y
"
:
100
,
"
z
"
:
0.1
}
}
},
"
teamSize
"
:
2
,
"
dronesPosition
"
:
{
"
x
"
:
0
,
"
y
"
:
0
,
"
z
"
:
20
},
"
droneList
"
:
[
"
DroneAaileFixeAPI
"
,
"
DroneLogAPI
"
]
};
function
processLog
(
game_parameters_json
,
log
)
{
var
MAP_SIZE
=
1000
,
...
...
@@ -196,9 +284,6 @@ var runGame, updateGame, eventGame, game_manager_instance;
};
game_parameters_json
.
drone
.
maxSpeed
=
(
flight_dist
/
flight_time
)
*
SPEED_FACTOR
;
game_parameters_json
.
flight_path_point_list
=
path_point_list
;
/*game_parameters_json.randomSpawn.leftTeam.position.x = start_position[0];
game_parameters_json.randomSpawn.leftTeam.position.y = start_position[1];
game_parameters_json.randomSpawn.leftTeam.position.z = start_position[2];*/
game_parameters_json
.
dronesPosition
.
x
=
start_position
[
0
];
game_parameters_json
.
dronesPosition
.
y
=
start_position
[
1
];
game_parameters_json
.
dronesPosition
.
z
=
start_position
[
2
];
...
...
@@ -214,7 +299,9 @@ var runGame, updateGame, eventGame, game_manager_instance;
game_parameters_json
.
randomSpawn
.
rightTeam
.
position
.
y
=
destination
[
1
];
return
game_parameters_json
;
}
game_parameters_json
=
processLog
(
game_parameters_json
,
log
);
if
(
!
game_manager_instance
)
{
game_manager_instance
=
new
GameManager
(
canvas
,
script
,
game_parameters_json
,
5
);
...
...
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_logic_js.xml
View file @
0076438f
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1003.1
7407.48631.50875
</string>
</value>
<value>
<string>
1003.1
8677.8071.57617
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
1664
386550.2
</float>
<float>
1664
462737.31
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_page_js.js
View file @
0076438f
...
...
@@ -148,7 +148,6 @@
width
:
options
.
width
,
height
:
options
.
height
,
script
:
options
.
script
,
game_parameters_json
:
options
.
game_parameters_json
,
log
:
options
.
log
},
[
options
.
canvas
]);
break
;
...
...
@@ -291,7 +290,7 @@
offscreen
=
canvas
.
transferControlToOffscreen
();
//TODO this should be in game logic BUT gadget can't be accessed from WW
var
script_content
,
game_parameters_json
,
log_content
;
var
script_content
,
log_content
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
var
query
=
'
(portal_type:"Web Script") AND (reference:"loiter_flight_script")
'
;
...
...
@@ -299,10 +298,6 @@
})
.
push
(
function
(
result
)
{
script_content
=
result
.
data
.
rows
[
0
].
value
.
text_content
;
return
gadget
.
jio_get
(
"
rescue_swarm_map_module/
"
+
"
compare_map
"
);
})
.
push
(
function
(
parameters_doc
)
{
game_parameters_json
=
JSON
.
parse
(
parameters_doc
.
text_content
);
var
query
=
'
(portal_type:"Web Manifest") AND (reference:"loiter_flight_log")
'
;
return
gadget
.
jio_allDocs
({
query
:
query
,
select_list
:
[
"
text_content
"
]});
})
...
...
@@ -316,7 +311,6 @@
width
:
canvas
.
width
,
height
:
canvas
.
height
,
script
:
script_content
,
game_parameters_json
:
game_parameters_json
,
log
:
log_content
});
...
...
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_page_js.xml
View file @
0076438f
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1003.186
68.38123.54476
</string>
</value>
<value>
<string>
1003.186
72.40791.39372
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
1664462
231.88
</float>
<float>
1664462
734.74
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_web_worker_js.js
View file @
0076438f
...
...
@@ -35,8 +35,7 @@ function mainToWorker(evt) {
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
postMessage
({
'
type
'
:
'
started
'
});
return
runGame
(
offscreen_canvas
,
evt
.
data
.
script
,
evt
.
data
.
game_parameters_json
,
evt
.
data
.
log
);
return
runGame
(
offscreen_canvas
,
evt
.
data
.
script
,
evt
.
data
.
log
);
})
.
push
(
function
(
result
)
{
return
postMessage
({
'
type
'
:
'
finished
'
,
'
result
'
:
result
});
...
...
erp5_drone_simulator/PathTemplateItem/web_page_module/drone_web_worker_web_worker_js.xml
View file @
0076438f
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1003.1
6068.56422.56064
</string>
</value>
<value>
<string>
1003.1
8677.12846.47872
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
1664
386491.83
</float>
<float>
1664
462736.14
</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