diff --git a/README.md b/README.md index e2e22cc0b46bb73f95e69f51bee61f651b2b7bd4..7de0435a94a3a9144b2583f9118c5b0c742fa1c4 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). diff --git a/examples/autonomy_engine_adapter/survey.json b/examples/autonomy_engine_adapter/survey.json new file mode 100644 index 0000000000000000000000000000000000000000..e715942a2c7e532dd2ae7a3098c88bd6b9967634 --- /dev/null +++ b/examples/autonomy_engine_adapter/survey.json @@ -0,0 +1,22 @@ +{ + "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, + "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/formats/survey.py b/formats/survey.py new file mode 100644 index 0000000000000000000000000000000000000000..f5f928c4d92f669fbc36d83e7f1e8532413bf7a0 --- /dev/null +++ b/formats/survey.py @@ -0,0 +1,55 @@ +""" + 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, + }, + "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..88081e3285deb4266389e017f8aba98706359816 --- /dev/null +++ b/formats/survey_encoded.py @@ -0,0 +1,15 @@ +""" + 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..2204b14be0271a35b483afecc0c699cd5163dba2 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,9 @@ 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 +81,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 +93,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..01f985f1d91cee1b6489f4931e523c6b22b7e6b6 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,95 @@ "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" + }, + "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" + }, + "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 +982,4 @@ "paths":{ } - } \ No newline at end of file +} \ No newline at end of file