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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
3dd0da8e
Commit
3dd0da8e
authored
Oct 17, 2023
by
Roque
Browse files
Options
Browse Files
Download
Plain Diff
Capture the flag game fixes
See merge request
nexedi/erp5!1830
parents
80699d25
90c681ad
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
29 deletions
+44
-29
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
+6
-1
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/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.js
...teItem/web_page_module/drone_capture_flag_map_utils_js.js
+1
-4
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.xml
...eItem/web_page_module/drone_capture_flag_map_utils_js.xml
+2
-2
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.js
.../web_page_module/ojs_drone_capture_flag_script_page_js.js
+31
-18
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.xml
...web_page_module/ojs_drone_capture_flag_script_page_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 @
3dd0da8e
...
...
@@ -317,11 +317,16 @@ var DroneManager = /** @class */ (function () {
DroneManager
.
prototype
.
getCurrentPosition
=
function
()
{
if
(
this
.
_controlMesh
)
{
// swap y and z axis so z axis represents altitude
return
this
.
_API
.
getCurrentPosition
(
var
position
=
this
.
_API
.
getCurrentPosition
(
this
.
_controlMesh
.
position
.
x
,
this
.
_controlMesh
.
position
.
z
,
this
.
_controlMesh
.
position
.
y
);
//Backward compatibility sanitation
position
.
x
=
position
.
latitude
;
position
.
y
=
position
.
longitude
;
position
.
z
=
position
.
altitude
;
return
position
;
}
return
null
;
};
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.xml
View file @
3dd0da8e
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1011.
46053.12382.23005
</string>
</value>
<value>
<string>
1011.
57487.9176.36369
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>
169
6871380.85
</float>
<float>
169
7558075.38
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.js
View file @
3dd0da8e
...
...
@@ -82,10 +82,7 @@ var MapUtils = /** @class */ (function () {
return
{
latitude
:
lat
,
longitude
:
lon
,
altitude
:
z
,
x
:
lat
,
y
:
lon
,
z
:
z
altitude
:
z
};
};
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.xml
View file @
3dd0da8e
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1011.5
0252.61779.34440
</string>
</value>
<value>
<string>
1011.5
7448.22674.29627
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
1697
123604.37
</float>
<float>
1697
557365.44
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.js
View file @
3dd0da8e
...
...
@@ -50,34 +50,22 @@ var OperatorAPI = /** @class */ (function () {
"
flag_list
"
:
[{
"
position
"
:
{
"
latitude
"
:
45.6464947316632
,
"
longitude
"
:
14.270747186236491
,
"
altitude
"
:
10
,
"
x
"
:
45.6464947316632
,
"
y
"
:
14.270747186236491
,
"
z
"
:
10
},
"
altitude
"
:
10
},
"
score
"
:
1
,
"
weight
"
:
1
}],
"
obstacle_list
"
:
[{
"
type
"
:
"
box
"
,
"
position
"
:
{
"
latitude
"
:
45.6456815316444
,
"
longitude
"
:
14.274667031215898
,
"
altitude
"
:
15
,
"
x
"
:
45.6456815316444
,
"
y
"
:
14.274667031215898
,
"
z
"
:
15
},
"
altitude
"
:
15
},
"
scale
"
:
{
"
x
"
:
132
,
"
y
"
:
56
,
"
z
"
:
10
},
"
rotation
"
:
{
"
x
"
:
0
,
"
y
"
:
0
,
"
z
"
:
0
}}],
"
enemy_list
"
:
[{
"
type
"
:
"
EnemyDroneAPI
"
,
"
position
"
:
{
"
latitude
"
:
45.6455531
,
"
longitude
"
:
14.270747186236491
,
"
altitude
"
:
15
,
"
x
"
:
45.6455531
,
"
y
"
:
14.270747186236491
,
"
z
"
:
15
}}],
"
altitude
"
:
15
}}],
"
initial_position
"
:
{
"
latitude
"
:
45.642813275
,
"
longitude
"
:
14.270231599999988
,
"
altitude
"
:
15
,
"
x
"
:
45.642813275
,
"
y
"
:
14.270231599999988
,
"
z
"
:
15
}
"
altitude
"
:
15
}
},
DEFAULT_SPEED
=
16
,
MAX_ACCELERATION
=
6
,
...
...
@@ -190,9 +178,9 @@ var OperatorAPI = /** @class */ (function () {
'
var random = Math.random() < 0.5, dodge_point = {};
\n
'
+
'
Object.assign(dodge_point, me.flag_positions[me.next_checkpoint].position);
\n
'
+
'
if (random) {
\n
'
+
'
dodge_point.
x = dodge_point.x
* -1;
\n
'
+
'
dodge_point.
latitude = dodge_point.latitude
* -1;
\n
'
+
'
} else {
\n
'
+
'
dodge_point.
y = dodge_point.y
* -1;
\n
'
+
'
dodge_point.
longitude = dodge_point.longitude
* -1;
\n
'
+
'
}
\n
'
+
'
me.setTargetCoordinates(dodge_point.latitude, dodge_point.longitude, me.getCurrentPosition().altitude);
\n
'
+
'
return;
\n
'
+
...
...
@@ -307,6 +295,27 @@ var OperatorAPI = /** @class */ (function () {
function
renderMapParameterView
(
gadget
)
{
var
form_gadget
;
renderGadgetHeader
(
gadget
,
true
);
//Drop backward compatibility sanitation
function
sanitize
(
position
)
{
delete
position
.
x
;
delete
position
.
y
;
delete
position
.
z
;
return
position
;
}
var
map_json
=
JSON
.
parse
(
gadget
.
state
.
map_json
);
map_json
.
initial_position
=
sanitize
(
map_json
.
initial_position
);
map_json
.
flag_list
.
forEach
(
function
(
flag
,
index
)
{
flag
.
position
=
sanitize
(
flag
.
position
);
});
map_json
.
obstacle_list
.
forEach
(
function
(
obstacle
,
index
)
{
obstacle
.
position
=
sanitize
(
obstacle
.
position
);
});
map_json
.
enemy_list
.
forEach
(
function
(
enemy
,
index
)
{
enemy
.
position
=
sanitize
(
enemy
.
position
);
});
gadget
.
state
.
map_json
=
JSON
.
stringify
(
map_json
,
undefined
,
4
);
return
gadget
.
declareGadget
(
"
gadget_erp5_form.html
"
,
{
scope
:
"
parameter_form
"
})
...
...
@@ -739,6 +748,10 @@ var OperatorAPI = /** @class */ (function () {
position
.
latitude
=
position
.
x
;
position
.
longitude
=
position
.
y
;
position
.
altitude
=
position
.
z
;
}
else
if
(
!
position
.
x
)
{
position
.
x
=
position
.
latitude
;
position
.
y
=
position
.
longitude
;
position
.
z
=
position
.
altitude
;
}
return
position
;
}
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.xml
View file @
3dd0da8e
...
...
@@ -246,7 +246,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1011.5
0269.22753.36317
</string>
</value>
<value>
<string>
1011.5
7494.145.60023
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -266,7 +266,7 @@
</tuple>
<state>
<tuple>
<float>
1697
124355.48
</float>
<float>
1697
558059.95
</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