diff --git a/README.md b/README.md index e2e22cc0b46bb73f95e69f51bee61f651b2b7bd4..4d3b970fe534bec0d4f8bcdbc00436ec30bea09f 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Each message below will be wrapped in a `payload` field and will have a `header` * `mission_plan`: these would be two message types, i. encoded (platform-specific serialized message) and ii. parsed, human-readable message. * `platform_status`: these would be two message types, i. encoded (platform-specific serialized message) and ii. parsed, human-readable message. * `observation`: this would be desired scientific data sent by the platform +* `survey`: this would be demanded track, platform actual path, and survey line * `acknowledgement`: level of acknowledgment where an acknowledgement is sent when a message is i. received, ii. sent to the next destination (e.g. platform in the water). * `planning_configuration`: sent from the GUI to initialise the AI model (autonomy engine). @@ -68,11 +69,16 @@ eg * `soar.*.*.*.to_platform.*` - all messages outbound to platforms (hermes) * `soar.*.slocum.#` - all messages relating to a slocum platform type -## Run Docs -Run the command below and go to `http://127.0.0.1:5000` +## Run Docs & Save Schema When Updating Message Formats +1. Run the command below and go to `http://127.0.0.1:5000` ``` python3 generate_schema_config.py ``` + +2. Copy the schema generated `http://127.0.0.1:5000/soar_protocol.json` into the `backbone-message-format/project/<project_name>/swagger.json` + +3. In the json copied, remove the key `"definitions"` from the schema and save this. + ## Run Tests Run both tests below: 1. Test 1 diff --git a/examples/autonomy_engine_adapter/survey.json b/examples/autonomy_engine_adapter/survey.json new file mode 100644 index 0000000000000000000000000000000000000000..21ee23f9f4b6ef155fb8830abc6f1d647027ddf0 --- /dev/null +++ b/examples/autonomy_engine_adapter/survey.json @@ -0,0 +1,28 @@ +{ + "header": { + "message_ID": "e1237003c-0000-11aa-a1eb-bvcdfghjgfdd", + "timestamp": "2023-03-16T00:00:00Z", + "version": 2, + "source": "ecosub.ecosub-c2", + "destination": "soar.planet-ocean.ecosub.ecosub-2.from_platform.survey", + "delivery_type": "publish", + "encoded": false + }, + "payload": { + "message_type": "survey", + "timestamp": "2026-12-21T00:00:00Z", + "latitude_A": 188.1, + "longitude_A": -10.122, + "latitude_B": 178.2, + "longitude_B": -10.122, + "latitude_C": 177.9, + "longitude_C": -10.122, + "latitude_D": 178.2, + "longitude_D": -11.122, + "latitude_E": 179.2, + "longitude_E": -11.122, + "platform_ID": "ecosub-2", + "track_ID": 12 + } +} + \ No newline at end of file diff --git a/examples/autonomy_engine_adapter/survey_encoded.json b/examples/autonomy_engine_adapter/survey_encoded.json new file mode 100644 index 0000000000000000000000000000000000000000..19eaf7b6c9871c3e9b503e05bcb588bb3934208b --- /dev/null +++ b/examples/autonomy_engine_adapter/survey_encoded.json @@ -0,0 +1,19 @@ +{ + "header": { + "message_ID": "t1237003c-0000-11aa-a1eb-bvcdfghjgfdd", + "timestamp": "2023-03-16T00:00:00Z", + "version": 2, + "source": "hermes.ecosub-2", + "destination": "soar.noc.autosub.alr-52.from_platform.survey_encoded", + "delivery_type": "publish", + "encoded": true + }, + "payload": { + "message_type": "survey_encoded", + "data": "HWYFBAAD+zwBySUAAAADVek72v1N2lUAAAAA9P2cP166ab+9cg==", + "file_name": "ecosub2-survey-data_03837434286438.sbd", + "mime_type": "application/gzip", + "is_binary": true + } + } + \ No newline at end of file diff --git a/examples/ecosub_adapter/survey.json b/examples/ecosub_adapter/survey.json new file mode 100644 index 0000000000000000000000000000000000000000..21ee23f9f4b6ef155fb8830abc6f1d647027ddf0 --- /dev/null +++ b/examples/ecosub_adapter/survey.json @@ -0,0 +1,28 @@ +{ + "header": { + "message_ID": "e1237003c-0000-11aa-a1eb-bvcdfghjgfdd", + "timestamp": "2023-03-16T00:00:00Z", + "version": 2, + "source": "ecosub.ecosub-c2", + "destination": "soar.planet-ocean.ecosub.ecosub-2.from_platform.survey", + "delivery_type": "publish", + "encoded": false + }, + "payload": { + "message_type": "survey", + "timestamp": "2026-12-21T00:00:00Z", + "latitude_A": 188.1, + "longitude_A": -10.122, + "latitude_B": 178.2, + "longitude_B": -10.122, + "latitude_C": 177.9, + "longitude_C": -10.122, + "latitude_D": 178.2, + "longitude_D": -11.122, + "latitude_E": 179.2, + "longitude_E": -11.122, + "platform_ID": "ecosub-2", + "track_ID": 12 + } +} + \ No newline at end of file diff --git a/examples/ecosub_adapter/survey_encoded.json b/examples/ecosub_adapter/survey_encoded.json new file mode 100644 index 0000000000000000000000000000000000000000..19eaf7b6c9871c3e9b503e05bcb588bb3934208b --- /dev/null +++ b/examples/ecosub_adapter/survey_encoded.json @@ -0,0 +1,19 @@ +{ + "header": { + "message_ID": "t1237003c-0000-11aa-a1eb-bvcdfghjgfdd", + "timestamp": "2023-03-16T00:00:00Z", + "version": 2, + "source": "hermes.ecosub-2", + "destination": "soar.noc.autosub.alr-52.from_platform.survey_encoded", + "delivery_type": "publish", + "encoded": true + }, + "payload": { + "message_type": "survey_encoded", + "data": "HWYFBAAD+zwBySUAAAADVek72v1N2lUAAAAA9P2cP166ab+9cg==", + "file_name": "ecosub2-survey-data_03837434286438.sbd", + "mime_type": "application/gzip", + "is_binary": true + } + } + \ No newline at end of file diff --git a/formats/survey.py b/formats/survey.py new file mode 100644 index 0000000000000000000000000000000000000000..ed59a5de1626ddaba154e65ce2246398a8272cf3 --- /dev/null +++ b/formats/survey.py @@ -0,0 +1,123 @@ +""" + schema: Survey Message that is decoded sent by platforms + to track progress +""" + +survey_schema = { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp for onboard message", + "example": "2022-12-21T00:00:00Z", + }, + "latitude_A": { + "type": "number", + "format": "float", + "description": ( + "Latitude of point A(intersection of normal)" + + "from waypoint A to survey line" + ), + "example": 178.2, + }, + "longitude_A": { + "type": "number", + "format": "float", + "description": ( + "Longitude of point A(intersection of normal)" + + "from waypoint A to survey line" + ), + "example": -10.122, + }, + "latitude_B": { + "type": "number", + "format": "float", + "description": ( + "Latitude of point B(intersection of normal)" + + "from waypoint B to survey line" + ), + "example": 178.2, + }, + "longitude_B": { + "type": "number", + "format": "float", + "description": ( + "Longitude of point B(intersection of normal)" + + "from waypoint B to survey line" + ), + "example": -10.122, + }, + "latitude_C": { + "type": "number", + "format": "float", + "description": ( + "Latitude of point C(intersection of normal)" + + "from waypoint C to survey line" + ), + "example": 178.2, + }, + "longitude_C": { + "type": "number", + "format": "float", + "description": ( + "Longitude of point C(intersection of normal)" + + "from waypoint C to survey line" + ), + "example": -10.122, + }, + "latitude_D": { + "type": "number", + "format": "float", + "description": ( + "Latitude of point D(intersection of normal)" + + "from waypoint D to survey line" + ), + "example": 178.2, + }, + "longitude_D": { + "type": "number", + "format": "float", + "description": ( + "Longitude of point D(intersection of normal)" + + "from waypoint D to survey line" + ), + "example": -10.122, + }, + "latitude_E": { + "type": "number", + "format": "float", + "description": ( + "Latitude of point E(intersection of normal)" + + "from waypoint E to survey line" + ), + "example": 178.2, + }, + "longitude_E": { + "type": "number", + "format": "float", + "description": ( + "Longitude of point E(intersection of normal)" + + "from waypoint E to survey line" + ), + "example": -10.122, + }, + "platform_ID": { + "type": "string", + "description": "Unique identifier for this platform", + "example": "ecosub-2", + }, + "track_ID": { + "type": "integer", + "description": "Track number of action(s) currently executed by platform", + "example": 1, + }, + }, + "required": [ + "latitude_A", + "longitude_A", + "latitude_B", + "longitude_B", + "platform_ID", + ], +} diff --git a/formats/survey_encoded.py b/formats/survey_encoded.py new file mode 100644 index 0000000000000000000000000000000000000000..218c8cfc1818ebf07d430d91df1b50ee4eaeb8ce --- /dev/null +++ b/formats/survey_encoded.py @@ -0,0 +1,11 @@ +""" + schema: Survey Message that is encoded sent by platforms + to track progress +""" +from formats.encoded import encoded_schema +from copy import deepcopy + +survey_encoded_schema = deepcopy(encoded_schema) + +survey_encoded_schema["properties"]["message_type"]["enum"] = ["survey_encoded"] +survey_encoded_schema["properties"]["message_type"]["example"] = "survey_encoded" diff --git a/generate_schema_config.py b/generate_schema_config.py index 52fd78655834b32c75115b766d97cb664bde9712..bc08138c4b8109a405372fc68581905e33576b0d 100644 --- a/generate_schema_config.py +++ b/generate_schema_config.py @@ -6,6 +6,8 @@ from formats.observation_encoded import observation_encoded_schema from formats.planning_configuration import planning_configuration_schema from formats.platform_status import platform_status_schema from formats.platform_status_encoded import platform_status_encoded_schema +from formats.survey import survey_schema +from formats.survey_encoded import survey_encoded_schema from formats.acknowledgement import acknowledgement_schema from flasgger import Swagger @@ -65,6 +67,8 @@ swagger_config = { "platform_status_encoded": "#/components/schemas/" + "platform_status_encoded", "acknowledgement": "#/components/schemas/acknowledgement", + "survey": "#/components/schemas/survey", + "survey_encoded": "#/components/schemas/" + "survey_encoded", }, }, "oneOf": [ @@ -76,6 +80,8 @@ swagger_config = { {"$ref": "#/components/schemas/planning_configuration"}, {"$ref": "#/components/schemas/platform_status"}, {"$ref": "#/components/schemas/platform_status_encoded"}, + {"$ref": "#/components/schemas/survey"}, + {"$ref": "#/components/schemas/survey_encoded"}, ], }, "header": message_header, @@ -86,6 +92,8 @@ swagger_config = { "planning_configuration": planning_configuration_schema, "platform_status": platform_status_schema, "platform_status_encoded": platform_status_encoded_schema, + "survey": survey_schema, + "survey_encoded": survey_encoded_schema, "acknowledgement": acknowledgement_schema, } }, diff --git a/project/soar/swagger.json b/project/soar/swagger.json index 1bd3a36a64ca37c426a5c09f282d4a59e13aa572..e99a8438b8cde2fb7ee15d4c516a1289fcd2e55d 100644 --- a/project/soar/swagger.json +++ b/project/soar/swagger.json @@ -147,26 +147,26 @@ "type":"number" }, "start_point_latitude":{ - "description":"Start point, x-coordinate", - "example":-4.187143188645706, + "description":"Start point, y-coordinate", + "example":50.37072283932642, "format":"float", "type":"number" }, "start_point_longitude":{ - "description":"Start point, y-coordinate", - "example":50.37072283932642, + "description":"Start point, x-coordinate", + "example":-4.187143188645706, "format":"float", "type":"number" }, "target_waypoint_latitude":{ - "description":"Target waypoint, x-coordinate", - "example":-4.187143188645706, + "description":"Target waypoint, y-coordinate", + "example":50.37072283932642, "format":"float", "type":"number" }, "target_waypoint_longitude":{ - "description":"Target waypoint, y-coordinate", - "example":50.37072283932642, + "description":"Target waypoint, x-coordinate", + "example":-4.187143188645706, "format":"float", "type":"number" }, @@ -262,13 +262,13 @@ "items":{ "properties":{ "latitude":{ - "description":"Identified x-coordinate of point of interest", + "description":"Identified y-coordinate of point of interest", "example":178.2, "format":"float", "type":"number" }, "longitude":{ - "description":"Identified y-coordinate of point of interest", + "description":"Identified x-coordinate of point of interest", "example":-10.122, "format":"float", "type":"number" @@ -347,7 +347,9 @@ "observation_encoded":"#/components/schemas/observation_encoded", "planning_configuration":"#/components/schemas/planning_configuration", "platform_status":"#/components/schemas/platform_status", - "platform_status_encoded":"#/components/schemas/platform_status_encoded" + "platform_status_encoded":"#/components/schemas/platform_status_encoded", + "survey":"#/components/schemas/survey", + "survey_encoded":"#/components/schemas/survey_encoded" }, "propertyName":"message_type" }, @@ -375,6 +377,12 @@ }, { "$ref":"#/components/schemas/platform_status_encoded" + }, + { + "$ref":"#/components/schemas/survey" + }, + { + "$ref":"#/components/schemas/survey_encoded" } ] }, @@ -489,7 +497,7 @@ }, "beacon_ID":{ "description":"Unique identifier (number) for the beacon associated to this platform", - "example":9407, + "example":2407, "type":"number" }, "emergency":{ @@ -511,14 +519,14 @@ "type":"number" }, "target_waypoint_latitude":{ - "description":"X-coordinate safe place for respective platform", - "example":-7.432, + "description":"Y-coordinate safe place for respective platform", + "example":50.365, "format":"float", "type":"number" }, "target_waypoint_longitude":{ - "description":"Y-coordinate safe place for respective platform", - "example":50.365, + "description":"X-coordinate safe place for respective platform", + "example":-7.432, "format":"float", "type":"number" } @@ -694,7 +702,7 @@ "type":"boolean" }, "latitude":{ - "description":"Latitude in decimal degrees.", + "description":"Latitude (Y-coordinate) in decimal degrees.", "example":178.2, "format":"float", "type":"number" @@ -712,7 +720,7 @@ "type":"number" }, "longitude":{ - "description":"Longitude in decimal degrees.", + "description":"Longitude (X-coordinate) in decimal degrees.", "example":-10.122, "format":"float", "type":"number" @@ -873,6 +881,131 @@ "is_binary" ], "type":"object" + }, + "survey":{ + "properties":{ + "latitude_A":{ + "description":"Latitude of point A(intersection of normal)from waypoint A to survey line", + "example":178.2, + "format":"float", + "type":"number" + }, + "latitude_B":{ + "description":"Latitude of point B(intersection of normal)from waypoint B to survey line", + "example":178.2, + "format":"float", + "type":"number" + }, + "latitude_C":{ + "description":"Latitude of point C(intersection of normal)from waypoint C to survey line", + "example":178.2, + "format":"float", + "type":"number" + }, + "latitude_D":{ + "description":"Latitude of point D(intersection of normal)from waypoint D to survey line", + "example":178.2, + "format":"float", + "type":"number" + }, + "latitude_E":{ + "description":"Latitude of point E(intersection of normal)from waypoint E to survey line", + "example":178.2, + "format":"float", + "type":"number" + }, + "longitude_A":{ + "description":"Longitude of point A(intersection of normal)from waypoint A to survey line", + "example":-10.122, + "format":"float", + "type":"number" + }, + "longitude_B":{ + "description":"Longitude of point B(intersection of normal)from waypoint B to survey line", + "example":-10.122, + "format":"float", + "type":"number" + }, + "longitude_C":{ + "description":"Longitude of point C(intersection of normal)from waypoint C to survey line", + "example":-10.122, + "format":"float", + "type":"number" + }, + "longitude_D":{ + "description":"Longitude of point D(intersection of normal)from waypoint D to survey line", + "example":-10.122, + "format":"float", + "type":"number" + }, + "longitude_E":{ + "description":"Longitude of point E(intersection of normal)from waypoint E to survey line", + "example":-10.122, + "format":"float", + "type":"number" + }, + "platform_ID":{ + "description":"Unique identifier for this platform", + "example":"ecosub-2", + "type":"string" + }, + "timestamp":{ + "description":"Timestamp for onboard message", + "example":"2022-12-21T00:00:00Z", + "format":"date-time", + "type":"string" + }, + "track_ID":{ + "description":"Track number of action(s) currently executed by platform", + "example":1, + "type":"integer" + } + }, + "required":[ + "latitude_A", + "longitude_A", + "latitude_B", + "longitude_B", + "platform_ID" + ], + "type":"object" + }, + "survey_encoded":{ + "properties":{ + "data":{ + "description":"encoded string. E.g. Base64 encoded", + "example":"SDQke4uwyP/YQQAgAhA2AND/nu8nvQAAAAAAAAAACtejPa5HHUGkcBAAAAIAAAAQAAAAAAAAAA9P2cP166ab+9cg==", + "type":"string" + }, + "file_name":{ + "description":"Name of file", + "example":"ah1-0238126349247372.bin", + "type":"string" + }, + "is_binary":{ + "description":"true if the data field contains binary format data encoded as base64. false if the data field contains ascii content such as NMEA.", + "example":true, + "type":"boolean" + }, + "message_type":{ + "description":"Type of message", + "enum":[ + "survey_encoded" + ], + "example":"survey_encoded", + "type":"string" + }, + "mime_type":{ + "description":"MIME type", + "example":"application/gzip", + "type":"string" + } + }, + "required":[ + "data", + "is_binary" + ], + "type":"object" } } }, @@ -885,4 +1018,4 @@ "paths":{ } - } \ No newline at end of file +} \ No newline at end of file