diff --git a/examples/geojson/platform_status.json b/examples/geojson/platform_status.json index 4cfc13142262a90615eafefb4465013e4f082161..4a7b1fcf048d15ca2a831aaf2d0d2cfce9ce9191 100644 --- a/examples/geojson/platform_status.json +++ b/examples/geojson/platform_status.json @@ -22,7 +22,7 @@ "type": "Point", "coordinates": [ -10.122, - 178.2, + 78.2, 50.0, 20 ] @@ -31,7 +31,7 @@ "type": "Point", "coordinates": [ -10.5, - 178.5 + 78.5 ] } } diff --git a/examples/mas-dt/waypoints_geojson.json b/examples/mas-dt/waypoints_geojson.json new file mode 100644 index 0000000000000000000000000000000000000000..534b619c33aedb0f663ac92cdf7123b6b0131866 --- /dev/null +++ b/examples/mas-dt/waypoints_geojson.json @@ -0,0 +1,23 @@ +{ + "header":{ + "message_ID": "b427003c-0000-11aa-a1eb-b1cdf2342fdd", + "timestamp": "2024-09-05T00:00:00Z", + "version": "v2.0.0-beta.1", + "source": "noc-sfmc", + "destination": "mas-dt.noc.slocum.unit_xxx.from_platform.waypoints", + "delivery_type": "publish", + "encoded": false + }, + "payload":{ + "message_type": "waypoints", + "platform_ID": "unit_xxx", + "platform_timestamp": "2024-09-05T00:00:00Z", + "status_source": "simulated", + "waypoints": [ + { + "type": "Point", + "coordinates": [-10.122, 78.2, 50.0, 20.0] + } + ] + } +} diff --git a/examples/mas-dt/waypoints_props.json b/examples/mas-dt/waypoints_props.json new file mode 100644 index 0000000000000000000000000000000000000000..3f210b3f42770a5c01a4a4be118bd1f67b258eb7 --- /dev/null +++ b/examples/mas-dt/waypoints_props.json @@ -0,0 +1,25 @@ +{ + "header":{ + "message_ID": "b427003c-0000-11aa-a1eb-b1cdf2342fdd", + "timestamp": "2024-09-05T00:00:00Z", + "version": "v2.0.0-beta.1", + "source": "noc-sfmc", + "destination": "mas-dt.noc.slocum.unit_xxx.from_platform.waypoints", + "delivery_type": "publish", + "encoded": false + }, + "payload":{ + "message_type": "waypoints", + "platform_ID": "unit_xxx", + "platform_timestamp": "2024-09-05T00:00:00Z", + "status_source": "simulated", + "waypoints": [ + { + "latitude": 78.2, + "longitude": -10.122, + "depth": 50.0, + "altitude": 20.0 + } + ] + } +} diff --git a/formats/payload.py b/formats/payload.py index 0868657e81a5208ed8e9a4cbe0cd278777655db7..ac8f87ca913a48f2212b9968c6d84f899c4ae651 100644 --- a/formats/payload.py +++ b/formats/payload.py @@ -5,9 +5,9 @@ payload_schema = { "alert": "#/components/schemas/alert", "instruction_set": "#/components/schemas/instruction_set", "mission_plan": "#/components/schemas/mission_plan", - "mission_plan_encoded": "#/components/schemas/" + "mission_plan_encoded", + "mission_plan_encoded": "#/components/schemas/mission_plan_encoded", "observation": "#/components/schemas/observation", - "observation_encoded": "#/components/schemas/" + "observation_encoded", + "observation_encoded": "#/components/schemas/observation_encoded", "planning_configuration": "#/components/schemas/" + "planning_configuration", "platform_status": "#/components/schemas/platform_status", @@ -15,7 +15,8 @@ payload_schema = { + "platform_status_encoded", "acknowledgement": "#/components/schemas/acknowledgement", "survey": "#/components/schemas/survey", - "survey_encoded": "#/components/schemas/" + "survey_encoded", + "survey_encoded": "#/components/schemas/survey_encoded", + "waypoints": "#/components/schemas/waypoints", }, }, "oneOf": [ @@ -31,5 +32,6 @@ payload_schema = { {"$ref": "#/components/schemas/platform_status_encoded"}, {"$ref": "#/components/schemas/survey"}, {"$ref": "#/components/schemas/survey_encoded"}, + {"$ref": "#/components/schemas/waypoints"}, ], } diff --git a/formats/platform_status.py b/formats/platform_status.py index 47807805ec41636fc35064f96560015644c549b1..52c34c5f65551a84d5e7eda3b5df73c446acf556 100644 --- a/formats/platform_status.py +++ b/formats/platform_status.py @@ -25,6 +25,11 @@ sensor_schema = { }, } +platform_status_core_fields_schema = { + "type": "object", + "properties": {}, +} + platform_status_schema = { "type": "object", "properties": { @@ -41,7 +46,7 @@ platform_status_schema = { }, "status_source": { "type": "string", - "enum": ["usbl", "onboard_platform"], + "enum": ["usbl", "onboard_platform", "simulated"], "description": "Indicate if this status message is from the" + " platform or USBL", "example": "usbl", @@ -173,6 +178,27 @@ platform_status_schema = { "sensor_config": sensor_schema, }, "oneOf": [ + { + "type": "object", + "properties": { + "no_position_reason": { + "type": "string", + "enum": [ + "missing", + "invalid", + "old", + "poor_fix", + "unavailable", + "not_applicable", + ], + "description": "Why position data is unavailable", + "example": "invalid", + }, + }, + "required": [ + "no_position_reason", + ], + }, { "type": "object", "properties": { diff --git a/formats/waypoints.py b/formats/waypoints.py new file mode 100644 index 0000000000000000000000000000000000000000..11fc50183739da46a9bf308242f28468e96295c0 --- /dev/null +++ b/formats/waypoints.py @@ -0,0 +1,95 @@ +""" +Temporary message definition to handle the MAS-DT dry-run mode + +In dry-run the SFMC adapter will receive misson_plan messages from ORI +These messages will be parsed and compiled into a goto file which will +not be sent on to the glider + +To confirm the message flow is working the SFMC will instead publish +a waypoints message back to the backbone which C2 can receive and +process - adding simulated waypoints to C2 positions +""" + +waypoint_schema = { + "type": "object", + "oneOf": [ + { + "$ref": "https://geojson.org/schema/Point.json", + }, + { + "type": "object", + "properties": { + "latitude": { + "type": "number", + "format": "float", + "description": "Latitude (Y-coordinate) in decimal degrees.", + "example": 178.2, + }, + "longitude": { + "type": "number", + "format": "float", + "description": "Longitude (X-coordinate) in decimal degrees.", + "example": -10.122, + }, + "depth": { + "type": "number", + "format": "float", + "description": "Target depth in metres", + "example": 50.0, + "default": 0.0, + }, + "altitude": { + "type": "number", + "format": "float", + "description": "Target altitude in metres", + "example": 20.0, + }, + }, + "required": [ + "latitude", + "longitude", + ], + }, + ], +} + +waypoints_schema = { + "type": "object", + "properties": { + "message_type": { + "type": "string", + "description": "Type of message", + "example": "waypoints", + "enum": ["waypoints"], + }, + "platform_ID": { + "type": "string", + "description": "Unique identifier for this platform", + "example": "reav-x-1", + }, + "status_source": { + "type": "string", + "enum": ["onboard_platform", "simulated", "autonomy"], + "description": "Indicate if this status message is from the" + + " platform or USBL", + "example": "usbl", + }, + "platform_timestamp": { + "type": "string", + "format": "date-time", + "description": "Timestamp for onboard platform status message", + "example": "2022-12-21T00:00:00Z", + }, + "waypoints": { + "type": "array", + "items": waypoint_schema, + }, + }, + "required": [ + "message_type", + "platform_ID", + "status_source", + "platform_timestamp", + "waypoints", + ], +} diff --git a/generate_schema_config.py b/generate_schema_config.py index 3c0f530a8635479c1af949877718cc11afa89f21..2ff507a6ff03061c4c5541f66ee34a078e8d65b8 100644 --- a/generate_schema_config.py +++ b/generate_schema_config.py @@ -7,6 +7,7 @@ from formats.observation_encoded import observation_encoded_schema from formats.payload import payload_schema from formats.planning_configuration import planning_configuration_schema from formats.platform_status import platform_status_schema +from formats.waypoints import waypoints_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 @@ -74,6 +75,7 @@ def get_swagger_config(reload=False): "alert": alert_schema, "instruction_set": instruction_set_schema, "config_file": config_file_schema, + "waypoints": waypoints_schema, } }, } diff --git a/project/soar/swagger.json b/project/soar/swagger.json index b2a1073cddfce560ff3657e479a753a1f20b725a..359440a3abb8f9b6d3d107fd56e8789f8cad066e 100644 --- a/project/soar/swagger.json +++ b/project/soar/swagger.json @@ -1820,7 +1820,8 @@ "platform_status": "#/components/schemas/platform_status", "platform_status_encoded": "#/components/schemas/platform_status_encoded", "survey": "#/components/schemas/survey", - "survey_encoded": "#/components/schemas/survey_encoded" + "survey_encoded": "#/components/schemas/survey_encoded", + "waypoints": "#/components/schemas/waypoints" }, "propertyName": "message_type" }, @@ -1860,6 +1861,9 @@ }, { "$ref": "#/components/schemas/survey_encoded" + }, + { + "$ref": "#/components/schemas/waypoints" } ] }, @@ -2208,6 +2212,27 @@ }, "platform_status": { "oneOf": [ + { + "properties": { + "no_position_reason": { + "description": "Why position data is unavailable", + "enum": [ + "missing", + "invalid", + "old", + "poor_fix", + "unavailable", + "not_applicable" + ], + "example": "invalid", + "type": "string" + } + }, + "required": [ + "no_position_reason" + ], + "type": "object" + }, { "properties": { "position": { @@ -2417,7 +2442,8 @@ "description": "Indicate if this status message is from the platform or USBL", "enum": [ "usbl", - "onboard_platform" + "onboard_platform", + "simulated" ], "example": "usbl", "type": "string" @@ -2628,6 +2654,92 @@ "is_binary" ], "type": "object" + }, + "waypoints": { + "properties": { + "message_type": { + "description": "Type of message", + "enum": [ + "waypoints" + ], + "example": "waypoints", + "type": "string" + }, + "platform_ID": { + "description": "Unique identifier for this platform", + "example": "reav-x-1", + "type": "string" + }, + "platform_timestamp": { + "description": "Timestamp for onboard platform status message", + "example": "2022-12-21T00:00:00Z", + "format": "date-time", + "type": "string" + }, + "status_source": { + "description": "Indicate if this status message is from the platform or USBL", + "enum": [ + "onboard_platform", + "simulated", + "autonomy" + ], + "example": "usbl", + "type": "string" + }, + "waypoints": { + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/geojson.org.schema.Point.json" + }, + { + "properties": { + "altitude": { + "description": "Target altitude in metres", + "example": 20.0, + "format": "float", + "type": "number" + }, + "depth": { + "default": 0.0, + "description": "Target depth in metres", + "example": 50.0, + "format": "float", + "type": "number" + }, + "latitude": { + "description": "Latitude (Y-coordinate) in decimal degrees.", + "example": 178.2, + "format": "float", + "type": "number" + }, + "longitude": { + "description": "Longitude (X-coordinate) in decimal degrees.", + "example": -10.122, + "format": "float", + "type": "number" + } + }, + "required": [ + "latitude", + "longitude" + ], + "type": "object" + } + ], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "message_type", + "platform_ID", + "status_source", + "platform_timestamp", + "waypoints" + ], + "type": "object" } } },