diff --git a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.js b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.js index 4511905d5e1795d7c6a4be189a02ced225dfddad..50cd26d92757264ab7bba3ebb55d38954cb69315 100644 --- a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.js +++ b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.js @@ -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; }; diff --git a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.xml b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.xml index 6eceb488cd3408b584c03e4b8f7a69ad5ec3d4c7..0d24e95bc4d6b0ba387d4cc7d278c6d4e6e43538 100644 --- a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.xml +++ b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_logic_js.xml @@ -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>1696871380.85</float> + <float>1697558075.38</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.js b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.js index 18d8df86d51f447f5fcea1c7fa255b8f48ff3cbb..aa4d81eed538d9d779c31f306960e31624077601 100644 --- a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.js +++ b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.js @@ -82,10 +82,7 @@ var MapUtils = /** @class */ (function () { return { latitude: lat, longitude: lon, - altitude: z, - x: lat, - y: lon, - z: z + altitude: z }; }; diff --git a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.xml b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.xml index 0697221cc9933532125450da333b4f58ed84e448..8c1224e92fbcfa19f4cbf47399f4662654746500 100644 --- a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.xml +++ b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/drone_capture_flag_map_utils_js.xml @@ -242,7 +242,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>1011.50252.61779.34440</string> </value> + <value> <string>1011.57448.22674.29627</string> </value> </item> <item> <key> <string>state</string> </key> @@ -262,7 +262,7 @@ </tuple> <state> <tuple> - <float>1697123604.37</float> + <float>1697557365.44</float> <string>UTC</string> </tuple> </state> diff --git a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.js b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.js index 3956016fa846b5d6b669a5c7d0f322a82c07eaae..aba603050371926e52cc1404dabd303a1a511d83 100644 --- a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.js +++ b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.js @@ -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; } diff --git a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.xml b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.xml index 63085a45b0ba120d386e6339a7ac57ccd6909a2e..90055fa1bbf3cb45883c5f30ad98f97fb2b284a8 100644 --- a/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.xml +++ b/bt5/erp5_officejs_drone_capture_flag/PathTemplateItem/web_page_module/ojs_drone_capture_flag_script_page_js.xml @@ -246,7 +246,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>1011.50269.22753.36317</string> </value> + <value> <string>1011.57494.145.60023</string> </value> </item> <item> <key> <string>state</string> </key> @@ -266,7 +266,7 @@ </tuple> <state> <tuple> - <float>1697124355.48</float> + <float>1697558059.95</float> <string>UTC</string> </tuple> </state>