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
141
Merge Requests
141
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
90c681ad
Commit
90c681ad
authored
Oct 17, 2023
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_drone_capture_flag: fix coordinates backward compatibility issue
parent
80699d25
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 @
90c681ad
...
@@ -317,11 +317,16 @@ var DroneManager = /** @class */ (function () {
...
@@ -317,11 +317,16 @@ var DroneManager = /** @class */ (function () {
DroneManager
.
prototype
.
getCurrentPosition
=
function
()
{
DroneManager
.
prototype
.
getCurrentPosition
=
function
()
{
if
(
this
.
_controlMesh
)
{
if
(
this
.
_controlMesh
)
{
// swap y and z axis so z axis represents altitude
// 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
.
x
,
this
.
_controlMesh
.
position
.
z
,
this
.
_controlMesh
.
position
.
z
,
this
.
_controlMesh
.
position
.
y
this
.
_controlMesh
.
position
.
y
);
);
//Backward compatibility sanitation
position
.
x
=
position
.
latitude
;
position
.
y
=
position
.
longitude
;
position
.
z
=
position
.
altitude
;
return
position
;
}
}
return
null
;
return
null
;
};
};
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.xml
View file @
90c681ad
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
1011.
46053.12382.23005
</string>
</value>
<value>
<string>
1011.
57487.9176.36369
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -266,7 +266,7 @@
...
@@ -266,7 +266,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
169
6871380.85
</float>
<float>
169
7558075.38
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.js
View file @
90c681ad
...
@@ -82,10 +82,7 @@ var MapUtils = /** @class */ (function () {
...
@@ -82,10 +82,7 @@ var MapUtils = /** @class */ (function () {
return
{
return
{
latitude
:
lat
,
latitude
:
lat
,
longitude
:
lon
,
longitude
:
lon
,
altitude
:
z
,
altitude
:
z
x
:
lat
,
y
:
lon
,
z
:
z
};
};
};
};
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.xml
View file @
90c681ad
...
@@ -242,7 +242,7 @@
...
@@ -242,7 +242,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -262,7 +262,7 @@
...
@@ -262,7 +262,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1697
123604.37
</float>
<float>
1697
557365.44
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.js
View file @
90c681ad
...
@@ -50,34 +50,22 @@ var OperatorAPI = /** @class */ (function () {
...
@@ -50,34 +50,22 @@ var OperatorAPI = /** @class */ (function () {
"
flag_list
"
:
[{
"
position
"
:
"
flag_list
"
:
[{
"
position
"
:
{
"
latitude
"
:
45.6464947316632
,
{
"
latitude
"
:
45.6464947316632
,
"
longitude
"
:
14.270747186236491
,
"
longitude
"
:
14.270747186236491
,
"
altitude
"
:
10
,
"
altitude
"
:
10
},
"
x
"
:
45.6464947316632
,
"
y
"
:
14.270747186236491
,
"
z
"
:
10
},
"
score
"
:
1
,
"
score
"
:
1
,
"
weight
"
:
1
}],
"
weight
"
:
1
}],
"
obstacle_list
"
:
[{
"
type
"
:
"
box
"
,
"
obstacle_list
"
:
[{
"
type
"
:
"
box
"
,
"
position
"
:
{
"
latitude
"
:
45.6456815316444
,
"
position
"
:
{
"
latitude
"
:
45.6456815316444
,
"
longitude
"
:
14.274667031215898
,
"
longitude
"
:
14.274667031215898
,
"
altitude
"
:
15
,
"
altitude
"
:
15
},
"
x
"
:
45.6456815316444
,
"
y
"
:
14.274667031215898
,
"
z
"
:
15
},
"
scale
"
:
{
"
x
"
:
132
,
"
y
"
:
56
,
"
z
"
:
10
},
"
scale
"
:
{
"
x
"
:
132
,
"
y
"
:
56
,
"
z
"
:
10
},
"
rotation
"
:
{
"
x
"
:
0
,
"
y
"
:
0
,
"
z
"
:
0
}}],
"
rotation
"
:
{
"
x
"
:
0
,
"
y
"
:
0
,
"
z
"
:
0
}}],
"
enemy_list
"
:
[{
"
type
"
:
"
EnemyDroneAPI
"
,
"
enemy_list
"
:
[{
"
type
"
:
"
EnemyDroneAPI
"
,
"
position
"
:
{
"
latitude
"
:
45.6455531
,
"
position
"
:
{
"
latitude
"
:
45.6455531
,
"
longitude
"
:
14.270747186236491
,
"
longitude
"
:
14.270747186236491
,
"
altitude
"
:
15
,
"
altitude
"
:
15
}}],
"
x
"
:
45.6455531
,
"
y
"
:
14.270747186236491
,
"
z
"
:
15
}}],
"
initial_position
"
:
{
"
latitude
"
:
45.642813275
,
"
initial_position
"
:
{
"
latitude
"
:
45.642813275
,
"
longitude
"
:
14.270231599999988
,
"
longitude
"
:
14.270231599999988
,
"
altitude
"
:
15
,
"
altitude
"
:
15
}
"
x
"
:
45.642813275
,
"
y
"
:
14.270231599999988
,
"
z
"
:
15
}
},
},
DEFAULT_SPEED
=
16
,
DEFAULT_SPEED
=
16
,
MAX_ACCELERATION
=
6
,
MAX_ACCELERATION
=
6
,
...
@@ -190,9 +178,9 @@ var OperatorAPI = /** @class */ (function () {
...
@@ -190,9 +178,9 @@ var OperatorAPI = /** @class */ (function () {
'
var random = Math.random() < 0.5, dodge_point = {};
\n
'
+
'
var random = Math.random() < 0.5, dodge_point = {};
\n
'
+
'
Object.assign(dodge_point, me.flag_positions[me.next_checkpoint].position);
\n
'
+
'
Object.assign(dodge_point, me.flag_positions[me.next_checkpoint].position);
\n
'
+
'
if (random) {
\n
'
+
'
if (random) {
\n
'
+
'
dodge_point.
x = dodge_point.x
* -1;
\n
'
+
'
dodge_point.
latitude = dodge_point.latitude
* -1;
\n
'
+
'
} else {
\n
'
+
'
} else {
\n
'
+
'
dodge_point.
y = dodge_point.y
* -1;
\n
'
+
'
dodge_point.
longitude = dodge_point.longitude
* -1;
\n
'
+
'
}
\n
'
+
'
}
\n
'
+
'
me.setTargetCoordinates(dodge_point.latitude, dodge_point.longitude, me.getCurrentPosition().altitude);
\n
'
+
'
me.setTargetCoordinates(dodge_point.latitude, dodge_point.longitude, me.getCurrentPosition().altitude);
\n
'
+
'
return;
\n
'
+
'
return;
\n
'
+
...
@@ -307,6 +295,27 @@ var OperatorAPI = /** @class */ (function () {
...
@@ -307,6 +295,27 @@ var OperatorAPI = /** @class */ (function () {
function
renderMapParameterView
(
gadget
)
{
function
renderMapParameterView
(
gadget
)
{
var
form_gadget
;
var
form_gadget
;
renderGadgetHeader
(
gadget
,
true
);
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
"
,
{
return
gadget
.
declareGadget
(
"
gadget_erp5_form.html
"
,
{
scope
:
"
parameter_form
"
scope
:
"
parameter_form
"
})
})
...
@@ -739,6 +748,10 @@ var OperatorAPI = /** @class */ (function () {
...
@@ -739,6 +748,10 @@ var OperatorAPI = /** @class */ (function () {
position
.
latitude
=
position
.
x
;
position
.
latitude
=
position
.
x
;
position
.
longitude
=
position
.
y
;
position
.
longitude
=
position
.
y
;
position
.
altitude
=
position
.
z
;
position
.
altitude
=
position
.
z
;
}
else
if
(
!
position
.
x
)
{
position
.
x
=
position
.
latitude
;
position
.
y
=
position
.
longitude
;
position
.
z
=
position
.
altitude
;
}
}
return
position
;
return
position
;
}
}
...
...
bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.xml
View file @
90c681ad
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -266,7 +266,7 @@
...
@@ -266,7 +266,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1697
124355.48
</float>
<float>
1697
558059.95
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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