diff --git a/__init__.py b/__init__.py index 42345bdd995796281efd1207c2cd04dea0c0b446..41054dacef087b0c9938b5fd854acaef374d6e8f 100644 --- a/__init__.py +++ b/__init__.py @@ -4,6 +4,8 @@ from flask import Flask __all__ = [ "formats", + "examples", + "projects", "tests", ] app = Flask(__name__) diff --git a/examples/__init__.py b/examples/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/examples/autonomy_engine_adapter/acknowledgement.json b/examples/autonomy_engine_adapter/acknowledgement.json index 1787704f0275dfffabf981a2f644deb732d989ea..11bbc8d5b94f6e5ea47fa86c7071fa56db840713 100644 --- a/examples/autonomy_engine_adapter/acknowledgement.json +++ b/examples/autonomy_engine_adapter/acknowledgement.json @@ -4,7 +4,7 @@ "timestamp": "2022-11-16T00:00:00Z", "version": 1, "source": "hydrosurv_adapter", - "destination": "autonomy_engine", + "destination": "soar.#", "delivery_type": "publish", "encoded": false }, diff --git a/examples/autonomy_engine_adapter/mission_plan_AH1.json b/examples/autonomy_engine_adapter/mission_plan_AH1.json index 99d42e1be88ec3992cf8c05f626bd43a6b7096ad..e9d96b5d32ff1a3859ca977e1148e57c2a67a352 100644 --- a/examples/autonomy_engine_adapter/mission_plan_AH1.json +++ b/examples/autonomy_engine_adapter/mission_plan_AH1.json @@ -4,7 +4,7 @@ "timestamp": "2022-11-16T00:00:00Z", "version": 2, "source": "autonomy_engine", - "destination": "noc_c2", + "destination": "soar.#", "delivery_type": "publish", "encoded": false }, diff --git a/examples/autonomy_engine_adapter/mission_plan_ECOSUB.json b/examples/autonomy_engine_adapter/mission_plan_ECOSUB.json index 3ba5aacbc7195524749c9fa05f4cd5d181b9acf9..716746c6eeb93318931c46523a356de71131f095 100644 --- a/examples/autonomy_engine_adapter/mission_plan_ECOSUB.json +++ b/examples/autonomy_engine_adapter/mission_plan_ECOSUB.json @@ -4,7 +4,7 @@ "timestamp": "2022-11-16T00:00:00Z", "version": 2, "source": "autonomy_engine", - "destination": "ecosub_c2", + "destination": "soar.#", "delivery_type": "publish", "encoded": false }, diff --git a/examples/autonomy_engine_adapter/mission_plan_HYDROSURV.json b/examples/autonomy_engine_adapter/mission_plan_HYDROSURV.json index 6aec0c67bb0362791ac09374b67b1aa5f935d3a1..18a51cea44b4353e4edc2b376d64f6162db724cf 100644 --- a/examples/autonomy_engine_adapter/mission_plan_HYDROSURV.json +++ b/examples/autonomy_engine_adapter/mission_plan_HYDROSURV.json @@ -4,7 +4,7 @@ "timestamp": "2022-11-16T00:00:00Z", "version": 2, "source": "autonomy_engine", - "destination": "hydrosurv_adapter", + "destination": "soar.#", "delivery_type": "publish", "encoded": false }, @@ -14,20 +14,14 @@ "autonomy_engine_plan_ID": 1, "plan": [ { - "start_point_latitude": -4.007143188645706, - "start_point_longitude": 50.37072283932642, "target_waypoint_latitude": -4.187143188645706, "target_waypoint_longitude": 50.37072283932642 }, { - "start_point_latitude": -4.187143188645706, - "start_point_longitude": 50.37072283932642, "target_waypoint_latitude": -3.187143188645706, "target_waypoint_longitude": 51.37072283932642 }, { - "start_point_latitude": -3.187143188645706, - "start_point_longitude": 51.37072283932642, "target_waypoint_latitude": -3.237143188645706, "target_waypoint_longitude": 52.37072283932642 } diff --git a/examples/autonomy_engine_adapter/planning_configuration.json b/examples/autonomy_engine_adapter/planning_configuration.json index 1c76fcdd53e1c4f0d1a273ec1f6387440c87ca11..f5a82819acb029aee08d71ae63366d41b3beb950 100644 --- a/examples/autonomy_engine_adapter/planning_configuration.json +++ b/examples/autonomy_engine_adapter/planning_configuration.json @@ -4,7 +4,7 @@ "timestamp": "2022-11-16T00:00:00Z", "version": 2, "source": "ecosub_c2", - "destination": "autonomy_engine", + "destination": "soar.#", "delivery_type": "publish", "encoded": false }, diff --git a/examples/hydrosurv_adapter/mission_plan.json b/examples/hydrosurv_adapter/mission_plan.json index 6aec0c67bb0362791ac09374b67b1aa5f935d3a1..deff464a6188b319918862bab93a2b4912c03b17 100644 --- a/examples/hydrosurv_adapter/mission_plan.json +++ b/examples/hydrosurv_adapter/mission_plan.json @@ -14,20 +14,14 @@ "autonomy_engine_plan_ID": 1, "plan": [ { - "start_point_latitude": -4.007143188645706, - "start_point_longitude": 50.37072283932642, "target_waypoint_latitude": -4.187143188645706, "target_waypoint_longitude": 50.37072283932642 }, { - "start_point_latitude": -4.187143188645706, - "start_point_longitude": 50.37072283932642, "target_waypoint_latitude": -3.187143188645706, "target_waypoint_longitude": 51.37072283932642 }, { - "start_point_latitude": -3.187143188645706, - "start_point_longitude": 51.37072283932642, "target_waypoint_latitude": -3.237143188645706, "target_waypoint_longitude": 52.37072283932642 } diff --git a/projects/__init__.py b/projects/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/project/soar/SOAR_README.md b/projects/soar/SOAR_README.md similarity index 100% rename from project/soar/SOAR_README.md rename to projects/soar/SOAR_README.md diff --git a/project/soar/swagger.json b/projects/soar/swagger.json similarity index 100% rename from project/soar/swagger.json rename to projects/soar/swagger.json diff --git a/tests/mock_data/autonomy_engine_adapter/acknowledgement.json b/tests/mock_data/autonomy_engine_adapter/acknowledgement.json deleted file mode 100644 index 1787704f0275dfffabf981a2f644deb732d989ea..0000000000000000000000000000000000000000 --- a/tests/mock_data/autonomy_engine_adapter/acknowledgement.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 1, - "source": "hydrosurv_adapter", - "destination": "autonomy_engine", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "acknowledgement", - "autonomy_engine_plan_ID": 1, - "platform_ID": "reav-x-1", - "approved": false - } -} \ No newline at end of file diff --git a/tests/mock_data/autonomy_engine_adapter/mission_plan_AH1.json b/tests/mock_data/autonomy_engine_adapter/mission_plan_AH1.json deleted file mode 100644 index 99d42e1be88ec3992cf8c05f626bd43a6b7096ad..0000000000000000000000000000000000000000 --- a/tests/mock_data/autonomy_engine_adapter/mission_plan_AH1.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "header": { - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "autonomy_engine", - "destination": "noc_c2", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "mission_plan", - "platform_ID": "5-ah1", - "autonomy_engine_plan_ID": 1, - "plan": [ - { - "action": "move", - "flight_style": "go to waypoint", - "start_point_latitude": -3.007143188645706, - "start_point_longitude": 50.37072283932642, - "target_waypoint_latitude": -3.237143188645706, - "target_waypoint_longitude": 52.37072283932642, - "depth": 0.0, - "activate_payload": false, - "send_environmental_data": false - }, - { - "action": "dive", - "flight_style": "dive to depth", - "start_point_latitude": -3.237143188645706, - "start_point_longitude": 52.37072283932642, - "target_waypoint_latitude": -3.337143188645706, - "target_waypoint_longitude": 56.37072283932642, - "altitude": 10, - "activate_payload": false, - "send_environmental_data": false - }, - { - "action": "scanline", - "flight_style": "go to waypoint", - "start_point_latitude": -3.337143188645706, - "start_point_longitude": 56.37072283932642, - "target_waypoint_latitude": -0.237143188645706, - "target_waypoint_longitude": 60.00000000000000, - "altitude": 10, - "activate_payload": true, - "send_environmental_data": false - }, - { - "action": "climb", - "flight_style": "go to surface", - "start_point_latitude": -0.237143188645706, - "start_point_longitude": 60.00000000000000, - "target_waypoint_latitude": -0.237143188645706, - "target_waypoint_longitude": 52.37072283932642, - "depth": 0.0, - "activate_payload": false, - "send_environmental_data": true - } - ] - } -} \ No newline at end of file diff --git a/tests/mock_data/autonomy_engine_adapter/mission_plan_ECOSUB.json b/tests/mock_data/autonomy_engine_adapter/mission_plan_ECOSUB.json deleted file mode 100644 index 2cfdaad4a7efae767216adda063b4ed55fbc9124..0000000000000000000000000000000000000000 --- a/tests/mock_data/autonomy_engine_adapter/mission_plan_ECOSUB.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "header": { - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "autonomy_engine", - "destination": "ecosub_c2", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "mission_plan", - "platform_ID": "ecosub-5", - "autonomy_engine_plan_ID": 1, - "plan": [ - { - "action": "move", - "flight_style": "go to waypoint", - "start_point_latitude": -3.007143188645706, - "start_point_longitude": 50.37072283932642, - "target_waypoint_latitude": -3.237143188645706, - "target_waypoint_longitude": 52.37072283932642, - "depth": 0.0, - "activate_payload": false, - "send_environmental_data": false - }, - { - "action": "dive", - "flight_style": "dive to depth", - "start_point_latitude": -3.237143188645706, - "start_point_longitude": 52.37072283932642, - "target_waypoint_latitude": -3.337143188645706, - "target_waypoint_longitude": 56.37072283932642, - "altitude": 10, - "activate_payload": false, - "send_environmental_data": false - }, - { - "action": "scanline", - "flight_style": "go to waypoint", - "start_point_latitude": -3.337143188645706, - "start_point_longitude": 56.37072283932642, - "target_waypoint_latitude": -0.237143188645706, - "target_waypoint_longitude": 60.00000000000000, - "altitude": 10, - "activate_payload": true, - "send_environmental_data": false - }, - { - "action": "climb", - "flight_style": "go to surface", - "start_point_latitude": -0.237143188645706, - "start_point_longitude": 60.00000000000000, - "target_waypoint_latitude": -0.237143188645706, - "target_waypoint_longitude": 52.37072283932642, - "depth": 0.0, - "activate_payload": false, - "send_environmental_data": true - } - ] - } -} \ No newline at end of file diff --git a/tests/mock_data/autonomy_engine_adapter/mission_plan_HYDROSURV.json b/tests/mock_data/autonomy_engine_adapter/mission_plan_HYDROSURV.json deleted file mode 100644 index 6aec0c67bb0362791ac09374b67b1aa5f935d3a1..0000000000000000000000000000000000000000 --- a/tests/mock_data/autonomy_engine_adapter/mission_plan_HYDROSURV.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "autonomy_engine", - "destination": "hydrosurv_adapter", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "mission_plan", - "platform_ID": "reav-60-1", - "autonomy_engine_plan_ID": 1, - "plan": [ - { - "start_point_latitude": -4.007143188645706, - "start_point_longitude": 50.37072283932642, - "target_waypoint_latitude": -4.187143188645706, - "target_waypoint_longitude": 50.37072283932642 - }, - { - "start_point_latitude": -4.187143188645706, - "start_point_longitude": 50.37072283932642, - "target_waypoint_latitude": -3.187143188645706, - "target_waypoint_longitude": 51.37072283932642 - }, - { - "start_point_latitude": -3.187143188645706, - "start_point_longitude": 51.37072283932642, - "target_waypoint_latitude": -3.237143188645706, - "target_waypoint_longitude": 52.37072283932642 - } - ] - } -} \ No newline at end of file diff --git a/tests/mock_data/autonomy_engine_adapter/planning_configuration.json b/tests/mock_data/autonomy_engine_adapter/planning_configuration.json deleted file mode 100644 index 1c76fcdd53e1c4f0d1a273ec1f6387440c87ca11..0000000000000000000000000000000000000000 --- a/tests/mock_data/autonomy_engine_adapter/planning_configuration.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "ecosub_c2", - "destination": "autonomy_engine", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "platform_status", - "planning_config_ID": 3, - "exclusion_zones": [ - { - "geometry_coordinates": [ - [ - [ - -4.187143188645706, - 50.37072283932642 - ], - [ - -4.202697005964865, - 50.368816892405874 - ], - [ - -4.203156724702808, - 50.365640144076906 - ], - [ - -4.19449868846155, - 50.362267670845654 - ] - ] - ] - } - ], - "squads": [ - { - "squad_ID": 1, - "no_of_platforms": 1, - "squad_mission_type": "tracking", - "squad_state": "active", - "platforms": [ - { - "model": "reav", - "platform_ID": "reav-60-1", - "serial": "reav-60", - "emergency": { - "additional_data": {}, - "target_waypoint_latitude": -7.432, - "target_waypoint_longitude": 50.365, - "safe_command": "go_home", - "target_depth": 10.0 - }, - "max_velocity": 0.9, - "min_altitude": 15.2, - "min_velocity": 0.1, - "additional_data": {} - } - ], - "region_of_interest": { - "geometry_coordinates": [ - [ - [ - -4.187143188645706, - 50.37072283932642 - ], - [ - -4.202697005964865, - 50.368816892405874 - ], - [ - -4.203156724702808, - 50.365640144076906 - ], - [ - -4.19449868846155, - 50.362267670845654 - ] - ] - ] - } - }, - { - "squad_ID": 2, - "no_of_platforms": 3, - "squad_mission_type": "survey", - "squad_state": "active", - "platforms": [ - { - "platform_ID": "ecosub-1", - "serial": "ecosub-2", - "model": "ecosub", - "emergency": { - "additional_data": {}, - "target_waypoint_latitude": -7.432, - "target_waypoint_longitude": 50.365, - "safe_command": "go_home", - "target_depth": 10.0 - }, - "max_velocity": 0.9, - "min_altitude": 15.2, - "min_velocity": 0.1, - "additional_data": { - "scan_type": "DVL", - "swath_width": 10 - } - }, - { - "platform_ID": "ecosub-2", - "serial": "ecosubxyz-5", - "model": "ecosub", - "emergency": { - "additional_data": {}, - "target_waypoint_latitude": -0.432, - "target_waypoint_longitude": 20.365, - "safe_command": "go_home", - "target_depth": 0.0 - }, - "max_velocity": 0.9, - "min_altitude": 15.2, - "min_velocity": 0.1, - "additional_data": { - "scan_type": "DVL", - "swath_width": 10 - } - } - ], - "region_of_interest": {} - }, - { - "squad_ID": 3, - "no_of_platforms": 1, - "squad_mission_type": "inspection", - "squad_state": "active", - "platforms": [ - { - "platform_ID": "ah-1", - "serial": "autosubhover-1", - "model": "autosub", - "emergency": { - "additional_data": {}, - "target_waypoint_latitude": 20.432, - "target_waypoint_longitude": 50.365, - "safe_command": "abort_now", - "target_depth": 0.0 - }, - "max_velocity": 0.9, - "min_altitude": 15.2, - "min_velocity": 0.1, - "additional_data": { - "scan_type": "MBES" - } - } - ], - "region_of_interest": {} - } - ] - } -} \ No newline at end of file diff --git a/tests/mock_data/autonomy_engine_adapter/platform_status-from_usbl_example.json b/tests/mock_data/autonomy_engine_adapter/platform_status-from_usbl_example.json deleted file mode 100644 index 6a506d973a4a838ca670220198d7e958485d71a4..0000000000000000000000000000000000000000 --- a/tests/mock_data/autonomy_engine_adapter/platform_status-from_usbl_example.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "hermes", - "destination": "autonomy_engine", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "platform_status", - "platform_ID": "ecosub-5", - "platform_timestamp": "2022-12-21T00:00:00Z", - "status_source": "usbl", - "latitude": 178.2, - "longitude": -10.122, - "depth": 50.0, - "altitude": 20.0 - } -} diff --git a/tests/mock_data/autonomy_engine_adapter/platform_status.json b/tests/mock_data/autonomy_engine_adapter/platform_status.json deleted file mode 100644 index fa2ecada5cb7d459bc16954a4cb908787e523d82..0000000000000000000000000000000000000000 --- a/tests/mock_data/autonomy_engine_adapter/platform_status.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "ecosub_c2", - "destination": "autonomy_engine", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "platform_status", - "platform_ID": "ecosub-2", - "platform_timestamp": "2022-12-21T00:00:00Z", - "status_source": "onboard_platform", - "autonomy_engine_plan_ID": 1, - "battery_remaining_capacity": 80.2, - "active": true, - "platform_state": "ABORT", - "mission_plan_ID": 1, - "mission_track_ID": 4, - "latitude": 178.2, - "longitude": -10.122, - "depth": 50.0, - "altitude": 20.0, - "heading": 90.0, - "health_status": false, - "localisation_north_error": 0, - "localisation_east_error": 0, - "usbl_fix_seconds_ago": 0, - "range_to_go": 124.3, - "sensor_config": { - "sensor_ID": 22, - "serial": "sidescan-2x", - "sensor_on": true, - "additional_data": { - "whiskers_on": true - } - }, - "speed_over_ground": 4.3, - "thrust_applied": 124.3, - "water_current_velocity": "124.3NE" - } -} diff --git a/tests/mock_data/ecosub_adapter/mission_plan.json b/tests/mock_data/ecosub_adapter/mission_plan.json deleted file mode 100644 index 3ba5aacbc7195524749c9fa05f4cd5d181b9acf9..0000000000000000000000000000000000000000 --- a/tests/mock_data/ecosub_adapter/mission_plan.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "header": { - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "autonomy_engine", - "destination": "ecosub_c2", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "mission_plan", - "platform_ID": "ecosub-2", - "autonomy_engine_plan_ID": 1, - "plan": [ - { - "action": "move", - "flight_style": "go to waypoint", - "start_point_latitude": -3.007143188645706, - "start_point_longitude": 50.37072283932642, - "target_waypoint_latitude": -3.237143188645706, - "target_waypoint_longitude": 52.37072283932642, - "depth": 0.0, - "activate_payload": false, - "send_environmental_data": false - }, - { - "action": "dive", - "flight_style": "dive to depth", - "start_point_latitude": -3.237143188645706, - "start_point_longitude": 52.37072283932642, - "target_waypoint_latitude": -3.337143188645706, - "target_waypoint_longitude": 56.37072283932642, - "altitude": 10, - "activate_payload": false, - "send_environmental_data": false - }, - { - "action": "scanline", - "flight_style": "go to waypoint", - "start_point_latitude": -3.337143188645706, - "start_point_longitude": 56.37072283932642, - "target_waypoint_latitude": -0.237143188645706, - "target_waypoint_longitude": 60.00000000000000, - "altitude": 10, - "activate_payload": true, - "send_environmental_data": false - }, - { - "action": "climb", - "flight_style": "go to surface", - "start_point_latitude": -0.237143188645706, - "start_point_longitude": 60.00000000000000, - "target_waypoint_latitude": -0.237143188645706, - "target_waypoint_longitude": 52.37072283932642, - "depth": 0.0, - "activate_payload": false, - "send_environmental_data": true - } - ] - } -} \ No newline at end of file diff --git a/tests/mock_data/ecosub_adapter/observation.json b/tests/mock_data/ecosub_adapter/observation.json deleted file mode 100644 index 8eb0571baaefb70ee0813d8f5054ca1bdf6a724e..0000000000000000000000000000000000000000 --- a/tests/mock_data/ecosub_adapter/observation.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "ecosub_c2", - "destination": "autonomy_engine", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "observation", - "platform_ID": "ecosub-2", - "points_of_interest": [ - { - "latitude": 178.2, - "longitude": -10.122, - "quality_of_point": 0.98 - }, - { - "latitude": 50.1382, - "longitude": -11.122, - "quality_of_point": 0.50 - } - ], - "region_surveyed": "" - } -} \ No newline at end of file diff --git a/tests/mock_data/ecosub_adapter/platform_status-from_usbl_example.json b/tests/mock_data/ecosub_adapter/platform_status-from_usbl_example.json deleted file mode 100644 index 4b3000971434fcecd4d952fc10309ec75b0685ee..0000000000000000000000000000000000000000 --- a/tests/mock_data/ecosub_adapter/platform_status-from_usbl_example.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "hermes", - "destination": "autonomy_engine", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "platform_status", - "platform_ID": "ecosub-5", - "platform_timestamp": "2022-12-21T00:00:00Z", - "status_source": "usbl", - "latitude": 178.2, - "longitude": -10.122, - "depth": 50.0, - "altitude": 20 - } -} diff --git a/tests/mock_data/ecosub_adapter/platform_status.json b/tests/mock_data/ecosub_adapter/platform_status.json deleted file mode 100644 index 59a24f1f48a47b3a3aeb1b37d05212c7e7cde0a7..0000000000000000000000000000000000000000 --- a/tests/mock_data/ecosub_adapter/platform_status.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "ecosub_c2", - "destination": "autonomy_engine", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "platform_status", - "platform_ID": "ecosub-2", - "platform_timestamp": "2022-12-21T00:00:00Z", - "status_source": "onboard_platform", - "autonomy_engine_plan_ID": 1, - "battery_remaining_capacity": 80.2, - "active": true, - "platform_state": "ABORT", - "mission_plan_ID": 1, - "mission_track_ID": 4, - "latitude": 178.2, - "longitude": -10.122, - "depth": 50.0, - "altitude": 20, - "heading": 90.0, - "health_status": false, - "localisation_north_error": 0, - "localisation_east_error": 0, - "usbl_fix_seconds_ago": 0, - "range_to_go": 124.3, - "sensor_config": { - "sensor_ID": 22, - "serial": "sidescan-2x", - "sensor_on": true, - "additional_data": { - "whiskers_on": true - } - }, - "speed_over_ground": 4.3, - "thrust_applied": 124.3, - "water_current_velocity": "124.3NE" - } -} diff --git a/tests/mock_data/ecosub_adapter/sample_decoded_ecosub_status.txt b/tests/mock_data/ecosub_adapter/sample_decoded_ecosub_status.txt deleted file mode 100644 index bacf8886dc4225ed6676b7759f9d095b3c3f3797..0000000000000000000000000000000000000000 --- a/tests/mock_data/ecosub_adapter/sample_decoded_ecosub_status.txt +++ /dev/null @@ -1,23 +0,0 @@ -#C2# -4338 -(4338,) -11111111111111111000000000000000 -Health : 722 -Content_Mask : 4 -Battery Voltage : 82045 -Battery Amps : 0 -Battery Acc charge : 767 -Battery Max Amps : 548 -Battery Max Voltage : 18 -Inner pressure : 43 -Inner Temp : 4 -Inner Humidity : 0 -Max depth : 0 -Current Pitch : -80 -Max pitch : 0 -Current RPM : 0 -Surface Time : 1636015764 -last GPS Time : 0 -(b'A', 0, 60, 1636016049, 57.33663558959961, -4.444321632385254, 0, 4294934528, 722, 4, 82045, 0, 767, 548, 18, 43, 4, 0, 0, -80, 0, 0, 1636015764, 0) -['Type', 'Version', 'Sub_Num', 'Time', 'Latitude', 'Longitude', 'Health', 'Content_Mask', 'Battery Voltage', 'Battery Amps', 'Battery Acc charge', 'Battery Max Amps', 'Battery Max Voltage', 'Inner pressure', 'Inner Temp', 'Inner Humidity', 'Max depth', 'Current Pitch', 'Max pitch', 'Current RPM', 'Surface Time', 'last GPS Time'] -(b'A', 0, 60, 1636016049, 57.33663558959961, -4.444321632385254, 0, 4294934528, 722, 4, 82045, 0, 767, 548, 18, 43, 4, 0, 0, -80, 0, 0, 1636015764, 0) \ No newline at end of file diff --git a/tests/mock_data/gui_adapter/planning_configuration.json b/tests/mock_data/gui_adapter/planning_configuration.json deleted file mode 100644 index 40d1e86ad25a58460ab9bdafbbe3d1265556220b..0000000000000000000000000000000000000000 --- a/tests/mock_data/gui_adapter/planning_configuration.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "ecosub_c2", - "destination": "autonomy_engine", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "platform_status", - "planning_config_ID": 3, - "exclusion_zones": [ - { - "geometry_coordinates": [ - [ - [ - -4.187143188645706, - 50.37072283932642 - ], - [ - -4.202697005964865, - 50.368816892405874 - ], - [ - -4.203156724702808, - 50.365640144076906 - ], - [ - -4.19449868846155, - 50.362267670845654 - ] - ] - ] - } - ], - "squads": [ - { - "squad_ID": 1, - "no_of_platforms": 1, - "squad_mission_type": "tracking", - "squad_state": "active", - "platforms": [ - { - "model": "reav", - "platform_ID": "reav-60-1", - "serial": "reav-60", - "emergency": { - "additional_data": {}, - "target_waypoint_latitude": -7.432, - "target_waypoint_longitude": 50.365, - "safe_command": "go_home", - "target_depth": 10.0 - }, - "max_velocity": 0.9, - "min_altitude": 15.2, - "min_velocity": 0.1, - "additional_data": {} - } - ], - "region_of_interest": { - "geometry_coordinates": [ - [ - [ - -4.187143188645706, - 50.37072283932642 - ], - [ - -4.202697005964865, - 50.368816892405874 - ], - [ - -4.203156724702808, - 50.365640144076906 - ], - [ - -4.19449868846155, - 50.362267670845654 - ] - ] - ] - } - }, - { - "squad_ID": 2, - "no_of_platforms": 3, - "squad_mission_type": "survey", - "squad_state": "active", - "platforms": [ - { - "platform_ID": "ecosub-2", - "serial": "ecosub-2", - "model": "ecosub", - "emergency": { - "additional_data": {}, - "target_waypoint_latitude": -7.432, - "target_waypoint_longitude": 50.365, - "safe_command": "go_home", - "target_depth": 10.0 - }, - "max_velocity": 0.9, - "min_altitude": 15.2, - "min_velocity": 0.1, - "additional_data": { - "scan_type": "DVL", - "swath_width": 10 - } - }, - { - "platform_ID": "ecosub-5", - "serial": "ecosub-5", - "model": "ecosub", - "emergency": { - "additional_data": {}, - "target_waypoint_latitude": -0.432, - "target_waypoint_longitude": 20.365, - "safe_command": "go_home", - "target_depth": 0.0 - }, - "max_velocity": 0.9, - "min_altitude": 15.2, - "min_velocity": 0.1, - "additional_data": { - "scan_type": "DVL", - "swath_width": 10 - } - } - ] - }, - { - "squad_ID": 3, - "no_of_platforms": 1, - "squad_mission_type": "inspection", - "squad_state": "active", - "platforms": [ - { - "platform_ID": "139-ah-1", - "serial": "ah-1", - "model": "autosub", - "emergency": { - "additional_data": {}, - "target_waypoint_latitude": 20.432, - "target_waypoint_longitude": 50.365, - "safe_command": "abort_now", - "target_depth": 0.0 - }, - "max_velocity": 0.9, - "min_altitude": 15.2, - "min_velocity": 0.1, - "additional_data": { - "scan_type": "MBES" - } - } - ], - "region_of_interest": {} - } - ] - } -} \ No newline at end of file diff --git a/tests/mock_data/hydrosurv_adapter/acknowledgement.json b/tests/mock_data/hydrosurv_adapter/acknowledgement.json deleted file mode 100644 index 1787704f0275dfffabf981a2f644deb732d989ea..0000000000000000000000000000000000000000 --- a/tests/mock_data/hydrosurv_adapter/acknowledgement.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 1, - "source": "hydrosurv_adapter", - "destination": "autonomy_engine", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "acknowledgement", - "autonomy_engine_plan_ID": 1, - "platform_ID": "reav-x-1", - "approved": false - } -} \ No newline at end of file diff --git a/tests/mock_data/hydrosurv_adapter/mission_plan.json b/tests/mock_data/hydrosurv_adapter/mission_plan.json deleted file mode 100644 index 6aec0c67bb0362791ac09374b67b1aa5f935d3a1..0000000000000000000000000000000000000000 --- a/tests/mock_data/hydrosurv_adapter/mission_plan.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "autonomy_engine", - "destination": "hydrosurv_adapter", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "mission_plan", - "platform_ID": "reav-60-1", - "autonomy_engine_plan_ID": 1, - "plan": [ - { - "start_point_latitude": -4.007143188645706, - "start_point_longitude": 50.37072283932642, - "target_waypoint_latitude": -4.187143188645706, - "target_waypoint_longitude": 50.37072283932642 - }, - { - "start_point_latitude": -4.187143188645706, - "start_point_longitude": 50.37072283932642, - "target_waypoint_latitude": -3.187143188645706, - "target_waypoint_longitude": 51.37072283932642 - }, - { - "start_point_latitude": -3.187143188645706, - "start_point_longitude": 51.37072283932642, - "target_waypoint_latitude": -3.237143188645706, - "target_waypoint_longitude": 52.37072283932642 - } - ] - } -} \ No newline at end of file diff --git a/tests/mock_data/hydrosurv_adapter/platform_status.json b/tests/mock_data/hydrosurv_adapter/platform_status.json deleted file mode 100644 index 48731995f0eed6b97db78827e38d82808365ea11..0000000000000000000000000000000000000000 --- a/tests/mock_data/hydrosurv_adapter/platform_status.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "header":{ - "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", - "timestamp": "2022-11-16T00:00:00Z", - "version": 2, - "source": "hydrosurv_adapter", - "destination": "autonomy_engine", - "delivery_type": "publish", - "encoded": false - }, - "payload":{ - "message_type": "platform_status", - "autonomy_engine_plan_ID": 1, - "active": true, - "status_source": "onboard_platform", - "battery_remaining_capacity": 80.2, - "heading": 310.0, - "health_status": false, - "latitude": 178.2, - "longitude": -10.122, - "mission_plan_ID": 1, - "mission_track_ID": 4, - "platform_ID": "reav-60-1", - "platform_state": "ABORT", - "platform_timestamp": "2022-12-21T00:00:00Z", - "speed_over_ground": 4.5, - "range_to_go": 0.0, - "thrust_applied": 2.3 - } -} \ No newline at end of file diff --git a/tests/test_schemas.py b/tests/test_schemas.py index 789f9ce58b050736f300444ff59bed44ee502538..c893ac1e8cd1113544ca709c922a646f38179815 100644 --- a/tests/test_schemas.py +++ b/tests/test_schemas.py @@ -10,8 +10,28 @@ from tests.fixtures.schemas import ( platform_status_schema, mission_plan_schema, ) + import unittest import json +import os +from jsonschema.validators import RefResolver +from openapi_schema_validator import validate + +# class ValidateResponse: +# def __init__(self, valid, error): +# self.valid = valid +# self.error = error + +SCHEMA_DIR = "projects/soar/swagger.json" +MOCK_DATA_DIR = "examples/" + +class SchemaError(Exception): + """ + """ + def __init__(self, exception_type, message): + self.type = exception_type + self.message = message + super().__init__(self.message) class TestSpecs(unittest.TestCase): @@ -22,6 +42,40 @@ class TestSpecs(unittest.TestCase): schema, spec_url = read_from_filename("tests/fixtures/swagger.json") self.assertIsNone(openapi_v30_spec_validator.validate(schema)) +class TestAllMessageExamples(unittest.TestCase): + def test_schema_specs(self): + """ + Test specs (swagger.json generated from generate_schema_config.py) + """ + schema_ref = open(SCHEMA_DIR) + schema = json.load(schema_ref) + schema_ref.close() + + + partner_dir_list = os.listdir(MOCK_DATA_DIR) + + + for partner in partner_dir_list: + message_list = os.listdir(os.path.join(MOCK_DATA_DIR, partner)) + for message_type in message_list: + print("Testing message %s by %s now..." % (message_type, partner)) + + f = open(os.path.join(MOCK_DATA_DIR, partner, message_type)) + mock_message = json.load(f) + ref_resolver = RefResolver.from_schema(schema) + + + self.assertIsNone( + validate( + mock_message, + schema["components"]["schemas"]["MESSAGE"], + resolver=ref_resolver, + ) + ) + f.close() + + schema_ref.close() + class TestSchema(unittest.TestCase): def test_sample_hydrosurv_messages(self):