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
140
Merge Requests
140
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
f04d2c0f
Commit
f04d2c0f
authored
Oct 11, 2023
by
Léo-Paul Géneau
👾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_drone_simulator: refactor x-y-z / lat-lon-alt method/properies to be consistent
parent
3dd0da8e
Pipeline
#30582
failed with stage
in 0 seconds
Changes
10
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
107 additions
and
90 deletions
+107
-90
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_dronelogfollower_js.js
...em/web_page_module/drone_simulator_dronelogfollower_js.js
+3
-3
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_dronelogfollower_js.xml
...m/web_page_module/drone_simulator_dronelogfollower_js.xml
+2
-2
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.js
...Item/web_page_module/drone_simulator_fixedwingdrone_js.js
+12
-12
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
+25
-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_log_page_js.js
...teItem/web_page_module/ojs_drone_simulator_log_page_js.js
+47
-40
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/ojs_drone_simulator_log_page_js.xml
...eItem/web_page_module/ojs_drone_simulator_log_page_js.xml
+3
-3
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
+9
-9
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_dronelogfollower_js.js
View file @
f04d2c0f
...
@@ -199,9 +199,9 @@ var DroneLogAPI = /** @class */ (function () {
...
@@ -199,9 +199,9 @@ var DroneLogAPI = /** @class */ (function () {
DroneLogAPI
.
prototype
.
getCurrentPosition
=
function
(
x
,
y
,
z
)
{
DroneLogAPI
.
prototype
.
getCurrentPosition
=
function
(
x
,
y
,
z
)
{
return
{
return
{
x
:
x
,
latitude
:
x
,
y
:
y
,
longitude
:
y
,
z
:
z
altitude
:
z
};
};
};
};
DroneLogAPI
.
prototype
.
getFlightParameters
=
function
()
{
DroneLogAPI
.
prototype
.
getFlightParameters
=
function
()
{
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_dronelogfollower_js.xml
View file @
f04d2c0f
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
101
0.13501.40623.51950
</string>
</value>
<value>
<string>
101
1.48679.53693.47701
</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
1588429.76
</float>
<float>
169
7030760.48
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.js
View file @
f04d2c0f
...
@@ -142,11 +142,11 @@ var FixedWingDroneAPI = /** @class */ (function () {
...
@@ -142,11 +142,11 @@ var FixedWingDroneAPI = /** @class */ (function () {
}*/
}*/
if
(
drone_position
)
{
if
(
drone_position
)
{
drone_info
=
{
drone_info
=
{
'
altitudeRel
'
:
drone_position
.
z
,
'
altitudeRel
'
:
drone_position
.
altitude
,
'
altitudeAbs
'
:
_this
.
_mapManager
.
getMapInfo
().
start_AMSL
+
'
altitudeAbs
'
:
_this
.
_mapManager
.
getMapInfo
().
start_AMSL
+
drone_position
.
z
,
drone_position
.
altitude
,
'
latitude
'
:
drone_position
.
x
,
'
latitude
'
:
drone_position
.
latitude
,
'
longitude
'
:
drone_position
.
y
,
'
longitude
'
:
drone_position
.
longitude
,
'
yaw
'
:
drone
.
getYaw
(),
'
yaw
'
:
drone
.
getYaw
(),
'
speed
'
:
drone
.
getAirSpeed
(),
'
speed
'
:
drone
.
getAirSpeed
(),
'
climbRate
'
:
drone
.
getClimbRate
()
'
climbRate
'
:
drone
.
getClimbRate
()
...
@@ -188,10 +188,10 @@ var FixedWingDroneAPI = /** @class */ (function () {
...
@@ -188,10 +188,10 @@ var FixedWingDroneAPI = /** @class */ (function () {
drone
.
_targetCoordinates
.
z
drone
.
_targetCoordinates
.
z
),
),
bearing
=
this
.
_computeBearing
(
bearing
=
this
.
_computeBearing
(
currentGeoCoordinates
.
x
,
currentGeoCoordinates
.
latitude
,
currentGeoCoordinates
.
y
,
currentGeoCoordinates
.
longitude
,
targetCoordinates
.
x
,
targetCoordinates
.
latitude
,
targetCoordinates
.
y
targetCoordinates
.
longitude
),
),
currentCosLat
,
currentCosLat
,
currentLatRad
,
currentLatRad
,
...
@@ -228,10 +228,10 @@ var FixedWingDroneAPI = /** @class */ (function () {
...
@@ -228,10 +228,10 @@ var FixedWingDroneAPI = /** @class */ (function () {
}
}
newYawRad
=
this
.
_toRad
(
newYaw
);
newYawRad
=
this
.
_toRad
(
newYaw
);
currentLatRad
=
this
.
_toRad
(
currentGeoCoordinates
.
x
);
currentLatRad
=
this
.
_toRad
(
currentGeoCoordinates
.
latitude
);
currentCosLat
=
Math
.
cos
(
currentLatRad
);
currentCosLat
=
Math
.
cos
(
currentLatRad
);
currentSinLat
=
Math
.
sin
(
currentLatRad
);
currentSinLat
=
Math
.
sin
(
currentLatRad
);
currentLonRad
=
this
.
_toRad
(
currentGeoCoordinates
.
y
);
currentLonRad
=
this
.
_toRad
(
currentGeoCoordinates
.
longitude
);
verticalSpeed
=
this
.
_getVerticalSpeed
(
drone
);
verticalSpeed
=
this
.
_getVerticalSpeed
(
drone
);
groundSpeed
=
Math
.
sqrt
(
groundSpeed
=
Math
.
sqrt
(
...
@@ -502,11 +502,11 @@ var FixedWingDroneAPI = /** @class */ (function () {
...
@@ -502,11 +502,11 @@ var FixedWingDroneAPI = /** @class */ (function () {
};
};
FixedWingDroneAPI
.
prototype
.
triggerParachute
=
function
(
drone
)
{
FixedWingDroneAPI
.
prototype
.
triggerParachute
=
function
(
drone
)
{
var
drone_pos
=
drone
.
getCurrentPosition
();
var
drone_pos
=
drone
.
getCurrentPosition
();
drone
.
setTargetCoordinates
(
drone_pos
.
x
,
drone_pos
.
y
,
5
);
drone
.
setTargetCoordinates
(
drone_pos
.
latitude
,
drone_pos
.
longitude
,
5
);
};
};
FixedWingDroneAPI
.
prototype
.
landed
=
function
(
drone
)
{
FixedWingDroneAPI
.
prototype
.
landed
=
function
(
drone
)
{
var
drone_pos
=
drone
.
getCurrentPosition
();
var
drone_pos
=
drone
.
getCurrentPosition
();
return
Math
.
floor
(
drone_pos
.
z
)
<
10
;
return
Math
.
floor
(
drone_pos
.
altitude
)
<
10
;
};
};
FixedWingDroneAPI
.
prototype
.
exit
=
function
()
{
FixedWingDroneAPI
.
prototype
.
exit
=
function
()
{
return
;
return
;
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_fixedwingdrone_js.xml
View file @
f04d2c0f
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
101
0.43751.23980.5597
</string>
</value>
<value>
<string>
101
1.48679.53693.47701
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -260,7 +260,7 @@
...
@@ -260,7 +260,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
169
2888030.77
</float>
<float>
169
7030763.04
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.js
View file @
f04d2c0f
...
@@ -135,16 +135,18 @@ var DroneManager = /** @class */ (function () {
...
@@ -135,16 +135,18 @@ var DroneManager = /** @class */ (function () {
/**
/**
* Set a target point to move
* Set a target point to move
*/
*/
DroneManager
.
prototype
.
setTargetCoordinates
=
function
(
x
,
y
,
z
)
{
DroneManager
.
prototype
.
setTargetCoordinates
=
this
.
_internal_setTargetCoordinates
(
x
,
y
,
z
);
function
(
latitude
,
longitude
,
altitude
)
{
};
this
.
_internal_setTargetCoordinates
(
latitude
,
longitude
,
altitude
);
};
DroneManager
.
prototype
.
_internal_setTargetCoordinates
=
DroneManager
.
prototype
.
_internal_setTargetCoordinates
=
function
(
x
,
y
,
z
,
radius
)
{
function
(
latitude
,
longitude
,
altitude
,
radius
)
{
if
(
!
this
.
_canPlay
)
{
if
(
!
this
.
_canPlay
)
{
return
;
return
;
}
}
//convert real geo-coordinates to virtual x-y coordinates
//convert real geo-coordinates to virtual x-y coordinates
this
.
_targetCoordinates
=
this
.
_API
.
processCoordinates
(
x
,
y
,
z
);
this
.
_targetCoordinates
=
this
.
_API
.
processCoordinates
(
latitude
,
longitude
,
altitude
);
return
this
.
_API
.
internal_setTargetCoordinates
(
return
this
.
_API
.
internal_setTargetCoordinates
(
this
,
this
,
this
.
_targetCoordinates
,
this
.
_targetCoordinates
,
...
@@ -296,9 +298,15 @@ var DroneManager = /** @class */ (function () {
...
@@ -296,9 +298,15 @@ var DroneManager = /** @class */ (function () {
/**
/**
* Make the drone loiter (circle with a set radius)
* Make the drone loiter (circle with a set radius)
*/
*/
DroneManager
.
prototype
.
loiter
=
function
(
x
,
y
,
z
,
radius
)
{
DroneManager
.
prototype
.
loiter
=
this
.
_internal_setTargetCoordinates
(
x
,
y
,
z
,
radius
);
function
(
latitude
,
longitude
,
altitude
,
radius
)
{
};
this
.
_internal_setTargetCoordinates
(
latitude
,
longitude
,
altitude
,
radius
);
};
DroneManager
.
prototype
.
getFlightParameters
=
function
()
{
DroneManager
.
prototype
.
getFlightParameters
=
function
()
{
if
(
this
.
_API
.
getFlightParameters
)
{
if
(
this
.
_API
.
getFlightParameters
)
{
return
this
.
_API
.
getFlightParameters
();
return
this
.
_API
.
getFlightParameters
();
...
@@ -436,7 +444,7 @@ var MapManager = /** @class */ (function () {
...
@@ -436,7 +444,7 @@ var MapManager = /** @class */ (function () {
this
.
map_info
.
initial_position
=
this
.
convertToLocalCoordinates
(
this
.
map_info
.
initial_position
=
this
.
convertToLocalCoordinates
(
initial_position
.
latitude
,
initial_position
.
latitude
,
initial_position
.
longitude
,
initial_position
.
longitude
,
initial_position
.
z
initial_position
.
altitude
);
);
};
};
MapManager
.
prototype
.
getMapInfo
=
function
()
{
MapManager
.
prototype
.
getMapInfo
=
function
()
{
...
@@ -485,9 +493,9 @@ var MapManager = /** @class */ (function () {
...
@@ -485,9 +493,9 @@ var MapManager = /** @class */ (function () {
this
.
map_info
.
min_y
;
this
.
map_info
.
min_y
;
lat
=
90
-
lat
/
(
this
.
map_info
.
map_size
/
180.0
);
lat
=
90
-
lat
/
(
this
.
map_info
.
map_size
/
180.0
);
return
{
return
{
x
:
lat
,
latitude
:
lat
,
y
:
lon
,
longitude
:
lon
,
z
:
z
altitude
:
z
};
};
};
};
return
MapManager
;
return
MapManager
;
...
@@ -666,7 +674,7 @@ var GameManager = /** @class */ (function () {
...
@@ -666,7 +674,7 @@ var GameManager = /** @class */ (function () {
queue
.
push
(
function
()
{
queue
.
push
(
function
()
{
drone
.
_tick
+=
1
;
drone
.
_tick
+=
1
;
if
(
drone
.
_API
.
isCollidable
&&
drone
.
can_play
)
{
if
(
drone
.
_API
.
isCollidable
&&
drone
.
can_play
)
{
if
(
drone
.
getCurrentPosition
().
z
<=
0
)
{
if
(
drone
.
getCurrentPosition
().
altitude
<=
0
)
{
drone
.
_internal_crash
(
new
Error
(
'
Drone
'
+
drone
.
id
+
drone
.
_internal_crash
(
new
Error
(
'
Drone
'
+
drone
.
id
+
'
touched the floor.
'
));
'
touched the floor.
'
));
}
else
{
}
else
{
...
@@ -718,8 +726,9 @@ var GameManager = /** @class */ (function () {
...
@@ -718,8 +726,9 @@ var GameManager = /** @class */ (function () {
drone_position
.
z
drone_position
.
z
);
);
game_manager
.
_flight_log
[
index
].
push
([
game_manager
.
_flight_log
[
index
].
push
([
game_manager
.
_game_duration
,
geo_coordinates
.
x
,
game_manager
.
_game_duration
,
geo_coordinates
.
latitude
,
geo_coordinates
.
y
,
map_info
.
start_AMSL
+
drone_position
.
z
,
geo_coordinates
.
longitude
,
map_info
.
start_AMSL
+
drone_position
.
z
,
drone_position
.
z
,
drone
.
getYaw
(),
drone
.
getGroundSpeed
(),
drone_position
.
z
,
drone
.
getYaw
(),
drone
.
getGroundSpeed
(),
drone
.
getClimbRate
()
drone
.
getClimbRate
()
]);
]);
...
@@ -1013,6 +1022,7 @@ var GameManager = /** @class */ (function () {
...
@@ -1013,6 +1022,7 @@ var GameManager = /** @class */ (function () {
try
{
try
{
eval
(
code_eval
);
eval
(
code_eval
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
error
);
eval
(
base
);
eval
(
base
);
}
}
/*jslint evil: false*/
/*jslint evil: false*/
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/drone_simulator_logic_js.xml
View file @
f04d2c0f
...
@@ -240,7 +240,7 @@
...
@@ -240,7 +240,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
101
0.42341.16308.11025
</string>
</value>
<value>
<string>
101
1.48744.22696.33177
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -260,7 +260,7 @@
...
@@ -260,7 +260,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
169
2802878.6
</float>
<float>
169
7032866.09
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/ojs_drone_simulator_log_page_js.js
View file @
f04d2c0f
(
function
(
window
,
RSVP
,
rJS
,
domsugar
,
document
,
Blob
)
{
/*jslint indent: 2, maxlen: 100*/
/*global window, rJS, domsugar, document*/
(
function
(
window
,
rJS
,
domsugar
,
document
)
{
"
use strict
"
;
"
use strict
"
;
var
SIMULATION_SPEED
=
200
,
var
SIMULATION_SPEED
=
200
,
...
@@ -12,9 +14,9 @@
...
@@ -12,9 +14,9 @@
WIDTH
=
680
,
WIDTH
=
680
,
HEIGHT
=
340
,
HEIGHT
=
340
,
LOGIC_FILE_LIST
=
[
LOGIC_FILE_LIST
=
[
'
gadget_erp5_page_drone_simulator_logic.js
'
,
'
gadget_erp5_page_drone_simulator_logic.js
'
,
'
gadget_erp5_page_drone_simulator_fixedwingdrone.js
'
,
'
gadget_erp5_page_drone_simulator_fixedwingdrone.js
'
,
'
gadget_erp5_page_drone_simulator_dronelogfollower.js
'
'
gadget_erp5_page_drone_simulator_dronelogfollower.js
'
];
];
rJS
(
window
)
rJS
(
window
)
...
@@ -40,7 +42,7 @@
...
@@ -40,7 +42,7 @@
})
})
.
declareMethod
(
'
render
'
,
function
render
()
{
.
declareMethod
(
'
render
'
,
function
render
()
{
var
gadget
=
this
,
query
;
var
gadget
=
this
;
return
gadget
.
getDeclaredGadget
(
'
form_view
'
)
return
gadget
.
getDeclaredGadget
(
'
form_view
'
)
.
push
(
function
(
form_gadget
)
{
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
render
({
return
form_gadget
.
render
({
...
@@ -90,7 +92,7 @@
...
@@ -90,7 +92,7 @@
group_list
:
[[
group_list
:
[[
"
left
"
,
"
left
"
,
[[
"
my_log_1
"
],
[
"
my_simulation_speed
"
]]
[[
"
my_log_1
"
],
[
"
my_simulation_speed
"
]]
],[
],
[
"
right
"
,
"
right
"
,
[[
"
my_log_2
"
]]
[[
"
my_log_2
"
]]
]]
]]
...
@@ -106,7 +108,9 @@
...
@@ -106,7 +108,9 @@
})
})
.
declareJob
(
'
runGame
'
,
function
runGame
(
options
)
{
.
declareJob
(
'
runGame
'
,
function
runGame
(
options
)
{
var
gadget
=
this
,
simulator
,
log_1_entry_list
,
log_2_entry_list
;
var
gadget
=
this
,
dist
,
fragment
=
gadget
.
element
.
querySelector
(
'
.simulator_div
'
),
game_parameters_json
,
log_1_entry_list
,
log_2_entry_list
,
map_info
,
span
=
document
.
querySelector
(
'
#distance
'
);
function
latLonDistance
(
c1
,
c2
)
{
function
latLonDistance
(
c1
,
c2
)
{
var
R
=
6371
e3
,
var
R
=
6371
e3
,
q1
=
c1
[
0
]
*
Math
.
PI
/
180
,
q1
=
c1
[
0
]
*
Math
.
PI
/
180
,
...
@@ -123,19 +127,16 @@
...
@@ -123,19 +127,16 @@
var
i
,
line_list
=
log
.
split
(
'
\n
'
),
log_entry_list
=
[],
log_entry
,
var
i
,
line_list
=
log
.
split
(
'
\n
'
),
log_entry_list
=
[],
log_entry
,
log_header_found
;
log_header_found
;
for
(
i
=
0
;
i
<
line_list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
line_list
.
length
;
i
+=
1
)
{
if
(
!
log_header_found
&&
!
line_list
[
i
].
includes
(
"
timestamp (ms);
"
))
{
if
(
log_header_found
||
line_list
[
i
].
includes
(
"
timestamp (ms);
"
))
{
continue
;
}
else
{
log_header_found
=
true
;
log_header_found
=
true
;
}
if
(
line_list
[
i
].
indexOf
(
"
AMSL
"
)
<
0
&&
if
(
line_list
[
i
].
indexOf
(
"
AMSL
"
)
>=
0
||
line_list
[
i
].
includes
(
"
;
"
))
{
!
line_list
[
i
].
includes
(
"
;
"
))
{
log_entry
=
line_list
[
i
].
trim
();
continue
;
if
(
log_entry
)
{
}
log_entry
=
log_entry
.
split
(
'
;
'
);
log_entry
=
line_list
[
i
].
trim
();
log_entry_list
.
push
(
log_entry
);
if
(
log_entry
)
{
}
log_entry
=
log_entry
.
split
(
'
;
'
);
}
log_entry_list
.
push
(
log_entry
);
}
}
}
}
return
log_entry_list
;
return
log_entry_list
;
...
@@ -146,15 +147,15 @@
...
@@ -146,15 +147,15 @@
Math
.
pow
(
p1
[
1
]
-
p2
[
1
],
2
)
+
Math
.
pow
(
p1
[
1
]
-
p2
[
1
],
2
)
+
Math
.
pow
(
p1
[
2
]
-
p2
[
2
],
2
));
Math
.
pow
(
p1
[
2
]
-
p2
[
2
],
2
));
}
}
var
i
,
sum
=
0
,
point_a
,
point_b
,
penalization
=
0
,
length
;
var
d
,
i
,
sum
=
0
,
point_a
,
point_b
,
penalization
=
0
,
length
;
for
(
i
=
0
;
i
<
a
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
a
.
length
;
i
+=
1
)
{
if
(
b
[
i
])
{
if
(
b
[
i
])
{
point_a
=
[
a
[
i
][
1
],
a
[
i
][
1
]];
point_a
=
[
a
[
i
][
1
],
a
[
i
][
1
]];
point_b
=
[
b
[
i
][
1
],
b
[
i
][
1
]];
point_b
=
[
b
[
i
][
1
],
b
[
i
][
1
]];
if
(
z
)
{
if
(
z
)
{
sum
+=
distance3D
(
point_a
,
point_b
);
sum
+=
distance3D
(
point_a
,
point_b
);
}
else
{
}
else
{
var
d
=
latLonDistance
(
point_a
,
point_b
);
d
=
latLonDistance
(
point_a
,
point_b
);
sum
+=
d
;
sum
+=
d
;
}
}
}
}
...
@@ -168,14 +169,12 @@
...
@@ -168,14 +169,12 @@
}
}
log_1_entry_list
=
getLogEntries
(
options
.
log_1
);
log_1_entry_list
=
getLogEntries
(
options
.
log_1
);
log_2_entry_list
=
getLogEntries
(
options
.
log_2
);
log_2_entry_list
=
getLogEntries
(
options
.
log_2
);
var
span
=
document
.
querySelector
(
'
#distance
'
),
dist
=
averageLogDistance
(
log_1_entry_list
,
log_2_entry_list
,
false
);
dist
=
averageLogDistance
(
log_1_entry_list
,
log_2_entry_list
,
false
);
if
(
isNaN
(
dist
))
{
if
(
isNaN
(
dist
))
{
return
gadget
.
notifySubmitted
({
message
:
'
Invalid log content
'
,
status
:
'
error
'
});
return
gadget
.
notifySubmitted
({
message
:
'
Invalid log content
'
,
status
:
'
error
'
});
}
}
span
.
textContent
=
'
Average flights distance:
'
+
span
.
textContent
=
'
Average flights distance:
'
+
Math
.
round
(
dist
*
100
)
/
100
;
Math
.
round
(
dist
*
100
)
/
100
;
var
fragment
=
gadget
.
element
.
querySelector
(
'
.simulator_div
'
);
fragment
=
domsugar
(
gadget
.
element
.
querySelector
(
'
.simulator_div
'
),
fragment
=
domsugar
(
gadget
.
element
.
querySelector
(
'
.simulator_div
'
),
[
domsugar
(
'
div
'
)]).
firstElementChild
;
[
domsugar
(
'
div
'
)]).
firstElementChild
;
DRONE_LIST
[
0
].
log_content
=
options
.
log_1
;
DRONE_LIST
[
0
].
log_content
=
options
.
log_1
;
...
@@ -184,11 +183,19 @@
...
@@ -184,11 +183,19 @@
var
all
=
list_1
.
concat
(
list_2
),
i
,
var
all
=
list_1
.
concat
(
list_2
),
i
,
min_lat
=
999
,
min_lon
=
999
,
min_lat
=
999
,
min_lon
=
999
,
max_lat
=
0
,
max_lon
=
0
;
max_lat
=
0
,
max_lon
=
0
;
for
(
i
=
0
;
i
<
all
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
all
.
length
;
i
+=
1
)
{
if
(
all
[
i
][
1
]
<
min_lat
)
min_lat
=
all
[
i
][
1
];
if
(
all
[
i
][
1
]
<
min_lat
)
{
if
(
all
[
i
][
1
]
>
max_lat
)
max_lat
=
all
[
i
][
1
];
min_lat
=
all
[
i
][
1
];
if
(
all
[
i
][
2
]
<
min_lon
)
min_lon
=
all
[
i
][
2
];
}
if
(
all
[
i
][
2
]
>
max_lon
)
max_lon
=
all
[
i
][
2
];
if
(
all
[
i
][
1
]
>
max_lat
)
{
max_lat
=
all
[
i
][
1
];
}
if
(
all
[
i
][
2
]
<
min_lon
)
{
min_lon
=
all
[
i
][
2
];
}
if
(
all
[
i
][
2
]
>
max_lon
)
{
max_lon
=
all
[
i
][
2
];
}
}
}
return
{
return
{
"
min_lat
"
:
min_lat
,
"
min_lat
"
:
min_lat
,
...
@@ -198,10 +205,10 @@
...
@@ -198,10 +205,10 @@
"
start_AMSL
"
:
all
[
0
][
3
]
-
all
[
0
][
4
],
"
start_AMSL
"
:
all
[
0
][
3
]
-
all
[
0
][
4
],
"
init_pos_lat
"
:
all
[
0
][
1
],
"
init_pos_lat
"
:
all
[
0
][
1
],
"
init_pos_lon
"
:
all
[
0
][
2
],
"
init_pos_lon
"
:
all
[
0
][
2
],
"
init_pos_
z
"
:
all
[
0
][
4
]
"
init_pos_
alt
"
:
all
[
0
][
4
]
};
};
}
}
var
map_info
=
generateMapInfo
(
log_1_entry_list
,
log_2_entry_list
);
map_info
=
generateMapInfo
(
log_1_entry_list
,
log_2_entry_list
);
options
.
min_lat
=
map_info
.
min_lat
;
options
.
min_lat
=
map_info
.
min_lat
;
options
.
max_lat
=
map_info
.
max_lat
;
options
.
max_lat
=
map_info
.
max_lat
;
options
.
min_lon
=
map_info
.
min_lon
;
options
.
min_lon
=
map_info
.
min_lon
;
...
@@ -210,8 +217,8 @@
...
@@ -210,8 +217,8 @@
options
.
start_AMSL
=
map_info
.
start_AMSL
;
options
.
start_AMSL
=
map_info
.
start_AMSL
;
options
.
init_pos_lon
=
map_info
.
init_pos_lon
;
options
.
init_pos_lon
=
map_info
.
init_pos_lon
;
options
.
init_pos_lat
=
map_info
.
init_pos_lat
;
options
.
init_pos_lat
=
map_info
.
init_pos_lat
;
options
.
init_pos_
z
=
map_info
.
init_pos_z
;
options
.
init_pos_
alt
=
map_info
.
init_pos_alt
;
var
game_parameters_json
=
{
game_parameters_json
=
{
"
drone
"
:
{
"
drone
"
:
{
"
maxAcceleration
"
:
1
,
"
maxAcceleration
"
:
1
,
"
maxSpeed
"
:
1
"
maxSpeed
"
:
1
...
@@ -233,7 +240,7 @@
...
@@ -233,7 +240,7 @@
"
initialPosition
"
:
{
"
initialPosition
"
:
{
"
longitude
"
:
parseFloat
(
options
.
init_pos_lon
),
"
longitude
"
:
parseFloat
(
options
.
init_pos_lon
),
"
latitude
"
:
parseFloat
(
options
.
init_pos_lat
),
"
latitude
"
:
parseFloat
(
options
.
init_pos_lat
),
"
z
"
:
parseFloat
(
options
.
init_pos_z
)
"
altitude
"
:
parseFloat
(
options
.
init_pos_alt
)
},
},
"
draw_flight_path
"
:
DRAW
,
"
draw_flight_path
"
:
DRAW
,
"
log_drone_flight
"
:
LOG
,
"
log_drone_flight
"
:
LOG
,
...
@@ -260,10 +267,10 @@
...
@@ -260,10 +267,10 @@
"
url
"
:
"
babylonjs.gadget.html
"
,
"
url
"
:
"
babylonjs.gadget.html
"
,
"
sandbox
"
:
"
public
"
,
"
sandbox
"
:
"
public
"
,
"
renderjs_extra
"
:
'
{"autorun": false, "width":
'
+
WIDTH
+
'
,
'
+
"
renderjs_extra
"
:
'
{"autorun": false, "width":
'
+
WIDTH
+
'
,
'
+
'
"height":
'
+
HEIGHT
+
'
,
'
+
'
"height":
'
+
HEIGHT
+
'
,
'
+
'
"logic_file_list":
'
+
JSON
.
stringify
(
LOGIC_FILE_LIST
)
+
'
,
'
+
'
"logic_file_list":
'
+
JSON
.
stringify
(
LOGIC_FILE_LIST
)
+
'
,
'
+
'
"game_parameters":
'
+
JSON
.
stringify
(
game_parameters_json
)
+
'
"game_parameters":
'
+
JSON
.
stringify
(
game_parameters_json
)
+
'
}
'
'
}
'
}
}
}},
}},
"
_links
"
:
{
"
_links
"
:
{
...
@@ -288,4 +295,4 @@
...
@@ -288,4 +295,4 @@
});
});
});
});
}(
window
,
RSVP
,
rJS
,
domsugar
,
document
,
Blob
));
}(
window
,
rJS
,
domsugar
,
document
));
\ No newline at end of file
\ No newline at end of file
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/ojs_drone_simulator_log_page_js.xml
View file @
f04d2c0f
...
@@ -232,7 +232,7 @@
...
@@ -232,7 +232,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<
string>
zope
</string
>
</value>
<value>
<
unicode>
zope
</unicode
>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
10
06.43898.62059.64102
</string>
</value>
<value>
<string>
10
11.48769.44767.36898
</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>
16
77600140.0
</float>
<float>
16
97034365.81
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/ojs_drone_simulator_script_page_js.js
View file @
f04d2c0f
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
INITIAL_POSITION
=
{
INITIAL_POSITION
=
{
"
latitude
"
:
45.6412
,
"
latitude
"
:
45.6412
,
"
longitude
"
:
14.2658
,
"
longitude
"
:
14.2658
,
"
z
"
:
15
"
altitude
"
:
15
},
},
NUMBER_OF_DRONES
=
2
,
NUMBER_OF_DRONES
=
2
,
// Non-inputs parameters
// Non-inputs parameters
...
@@ -108,8 +108,8 @@
...
@@ -108,8 +108,8 @@
'
if (me.next_checkpoint < CHECKPOINT_LIST.length) {
\n
'
+
'
if (me.next_checkpoint < CHECKPOINT_LIST.length) {
\n
'
+
'
me.current_position = me.getCurrentPosition();
\n
'
+
'
me.current_position = me.getCurrentPosition();
\n
'
+
'
me.distance = distance(
\n
'
+
'
me.distance = distance(
\n
'
+
'
me.current_position.
x
,
\n
'
+
'
me.current_position.
latitude
,
\n
'
+
'
me.current_position.
y
,
\n
'
+
'
me.current_position.
longitude
,
\n
'
+
'
CHECKPOINT_LIST[me.next_checkpoint].latitude,
\n
'
+
'
CHECKPOINT_LIST[me.next_checkpoint].latitude,
\n
'
+
'
CHECKPOINT_LIST[me.next_checkpoint].longitude
\n
'
+
'
CHECKPOINT_LIST[me.next_checkpoint].longitude
\n
'
+
'
);
\n
'
+
'
);
\n
'
+
...
@@ -387,14 +387,14 @@
...
@@ -387,14 +387,14 @@
"
hidden
"
:
0
,
"
hidden
"
:
0
,
"
type
"
:
"
FloatField
"
"
type
"
:
"
FloatField
"
},
},
"
my_init_pos_
z
"
:
{
"
my_init_pos_
alt
"
:
{
"
description
"
:
""
,
"
description
"
:
""
,
"
title
"
:
"
Initial drone
position Z
"
,
"
title
"
:
"
Initial drone
altitude
"
,
"
default
"
:
INITIAL_POSITION
.
z
,
"
default
"
:
INITIAL_POSITION
.
altitude
,
"
css_class
"
:
""
,
"
css_class
"
:
""
,
"
required
"
:
1
,
"
required
"
:
1
,
"
editable
"
:
1
,
"
editable
"
:
1
,
"
key
"
:
"
init_pos_
z
"
,
"
key
"
:
"
init_pos_
alt
"
,
"
hidden
"
:
0
,
"
hidden
"
:
0
,
"
type
"
:
"
FloatField
"
"
type
"
:
"
FloatField
"
},
},
...
@@ -434,7 +434,7 @@
...
@@ -434,7 +434,7 @@
[[
"
my_simulation_speed
"
],
[
"
my_simulation_time
"
],
[
"
my_number_of_drones
"
],
[[
"
my_simulation_speed
"
],
[
"
my_simulation_time
"
],
[
"
my_number_of_drones
"
],
[
"
my_minimum_latitud
"
],
[
"
my_maximum_latitud
"
],
[
"
my_minimum_latitud
"
],
[
"
my_maximum_latitud
"
],
[
"
my_minimum_longitud
"
],
[
"
my_maximum_longitud
"
],
[
"
my_minimum_longitud
"
],
[
"
my_maximum_longitud
"
],
[
"
my_init_pos_lat
"
],
[
"
my_init_pos_lon
"
],
[
"
my_init_pos_
z
"
],
[
"
my_init_pos_lat
"
],
[
"
my_init_pos_lon
"
],
[
"
my_init_pos_
alt
"
],
[
"
my_map_height
"
]]
[
"
my_map_height
"
]]
],
[
],
[
"
right
"
,
"
right
"
,
...
@@ -498,7 +498,7 @@
...
@@ -498,7 +498,7 @@
"
initialPosition
"
:
{
"
initialPosition
"
:
{
"
longitude
"
:
parseFloat
(
options
.
init_pos_lon
),
"
longitude
"
:
parseFloat
(
options
.
init_pos_lon
),
"
latitude
"
:
parseFloat
(
options
.
init_pos_lat
),
"
latitude
"
:
parseFloat
(
options
.
init_pos_lat
),
"
z
"
:
parseFloat
(
options
.
init_pos_z
)
"
altitude
"
:
parseFloat
(
options
.
init_pos_alt
)
},
},
"
draw_flight_path
"
:
DRAW
,
"
draw_flight_path
"
:
DRAW
,
"
temp_flight_path
"
:
true
,
"
temp_flight_path
"
:
true
,
...
...
bt5/erp5_officejs_drone_simulator/PathTemplateItem/web_page_module/ojs_drone_simulator_script_page_js.xml
View file @
f04d2c0f
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
10
09.59163.16294.47701
</string>
</value>
<value>
<string>
10
11.48716.48246.13943
</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
0477710.21
</float>
<float>
169
7031250.03
</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