diff --git a/CHANGELOG.md b/CHANGELOG.md index 60798f945994fd0740d2c65c0fe443cdc514fcf3..115775a6d01c55d1c762b53302e79a795b2b32a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed +- Refactor action schema to accept geojson.Points - Use geojson Point for platform_status - Add waypoint to platform_status - Store remote schemas as committed local files diff --git a/examples/mas-dt/mission_plan.json b/examples/mas-dt/mission_plan.json new file mode 100644 index 0000000000000000000000000000000000000000..10b7342ac211f0cc4121c2a6f4645beac807beb4 --- /dev/null +++ b/examples/mas-dt/mission_plan.json @@ -0,0 +1,36 @@ +{ + "header": { + "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", + "timestamp": "2022-11-16T00:00:00Z", + "version": 2, + "source": "autonomy_engine", + "destination": "soar.noc.autosub.alr-52.to_platform.mission_plan", + "delivery_type": "publish", + "encoded": false + }, + "payload":{ + "message_type": "mission_plan", + "platform_ID": "alr-52", + "autonomy_engine_plan_ID": "a427003c-0000-11aa-a1eb-bvcdfghjgfcc", + "plan": [ + { + "action": "move", + "start": { + "type": "Point", + "coordinates": [ + -3.0071, + 50.3707 + ] + }, + "target": { + "type": "Point", + "coordinates": [ + -3.2371, + 52.3707, + 0.0 + ] + } + } + ] + } +} \ No newline at end of file diff --git a/formats/mission_plan.py b/formats/mission_plan.py index f62e823239d1106de2ebec06a331138e54f19fe3..0f582080d4842ceb4d741e4ce3a26d4f3a8ceef9 100644 --- a/formats/mission_plan.py +++ b/formats/mission_plan.py @@ -25,42 +25,6 @@ action_schema = { ], "example": "move", }, - "start_point_latitude": { - "type": "number", - "format": "float", - "description": "Start point, y-coordinate", - "example": 50.37072283932642, - }, - "start_point_longitude": { - "type": "number", - "format": "float", - "description": "Start point, x-coordinate", - "example": -4.187143188645706, - }, - "target_waypoint_latitude": { - "type": "number", - "format": "float", - "description": "Target waypoint, y-coordinate", - "example": 50.37072283932642, - }, - "target_waypoint_longitude": { - "type": "number", - "format": "float", - "description": "Target waypoint, x-coordinate", - "example": -4.187143188645706, - }, - "altitude": { - "type": "number", - "format": "float", - "description": "Altitude of next action", - "example": 15.0, - }, - "depth": { - "type": "number", - "format": "float", - "description": "Depth of next action", - "example": 15.0, - }, "activate_payload": { "type": "boolean", "description": "To activate/deactivate sensor for Autosub " @@ -74,9 +38,66 @@ action_schema = { "example": 1800.0, }, }, - "required": [ - "target_waypoint_latitude", - "target_waypoint_longitude", + "oneOf": [ + { + "type": "object", + "properties": { + "start": { + "$ref": "https://geojson.org/schema/Point.json", + }, + "target": { + "$ref": "https://geojson.org/schema/Point.json", + }, + }, + "required": [ + "target", + ], + }, + { + "type": "object", + "properties": { + "start_point_latitude": { + "type": "number", + "format": "float", + "description": "Start point, y-coordinate", + "example": 50.37072283932642, + }, + "start_point_longitude": { + "type": "number", + "format": "float", + "description": "Start point, x-coordinate", + "example": -4.187143188645706, + }, + "target_waypoint_latitude": { + "type": "number", + "format": "float", + "description": "Target waypoint, y-coordinate", + "example": 50.37072283932642, + }, + "target_waypoint_longitude": { + "type": "number", + "format": "float", + "description": "Target waypoint, x-coordinate", + "example": -4.187143188645706, + }, + "altitude": { + "type": "number", + "format": "float", + "description": "Altitude of next action", + "example": 15.0, + }, + "depth": { + "type": "number", + "format": "float", + "description": "Depth of next action", + "example": 15.0, + }, + }, + "required": [ + "target_waypoint_latitude", + "target_waypoint_longitude", + ], + }, ], } @@ -90,10 +111,20 @@ mission_plan_schema = { "enum": ["mission_plan"], }, "autonomy_engine_plan_ID": { - "type": "integer", - "description": "Unique identifier for this plan" - + "generated by the Autonomy Engine", - "example": 3, + "oneOf": [ + { + "type": "string", + "format": "uuid", + "description": "Unique identifier for this plan" + + "generated by the Autonomy Engine", + }, + { + "type": "integer", + "description": "Unique identifier for this plan" + + "generated by the Autonomy Engine", + "example": 3, + }, + ] }, "platform_ID": { "type": "string", diff --git a/project/soar/swagger.json b/project/soar/swagger.json index 2296040560007075f67cb947f325f5499f1f0fb2..2ff1d4fd62cecb6b567e27c582a487011f59d76a 100644 --- a/project/soar/swagger.json +++ b/project/soar/swagger.json @@ -1449,9 +1449,18 @@ "mission_plan": { "properties": { "autonomy_engine_plan_ID": { - "description": "Unique identifier for this plangenerated by the Autonomy Engine", - "example": 3, - "type": "integer" + "oneOf": [ + { + "description": "Unique identifier for this plangenerated by the Autonomy Engine", + "format": "uuid", + "type": "string" + }, + { + "description": "Unique identifier for this plangenerated by the Autonomy Engine", + "example": 3, + "type": "integer" + } + ] }, "emergency": { "default": false, @@ -1469,6 +1478,67 @@ }, "plan": { "items": { + "oneOf": [ + { + "properties": { + "start": { + "$ref": "#/components/schemas/geojson.org.schema.Point.json" + }, + "target": { + "$ref": "#/components/schemas/geojson.org.schema.Point.json" + } + }, + "required": [ + "target" + ], + "type": "object" + }, + { + "properties": { + "altitude": { + "description": "Altitude of next action", + "example": 15.0, + "format": "float", + "type": "number" + }, + "depth": { + "description": "Depth of next action", + "example": 15.0, + "format": "float", + "type": "number" + }, + "start_point_latitude": { + "description": "Start point, y-coordinate", + "example": 50.37072283932642, + "format": "float", + "type": "number" + }, + "start_point_longitude": { + "description": "Start point, x-coordinate", + "example": -4.187143188645706, + "format": "float", + "type": "number" + }, + "target_waypoint_latitude": { + "description": "Target waypoint, y-coordinate", + "example": 50.37072283932642, + "format": "float", + "type": "number" + }, + "target_waypoint_longitude": { + "description": "Target waypoint, x-coordinate", + "example": -4.187143188645706, + "format": "float", + "type": "number" + } + }, + "required": [ + "target_waypoint_latitude", + "target_waypoint_longitude" + ], + "type": "object" + } + ], "properties": { "action": { "description": "Autonomy Engine's action from `move`, `payload`, `dive`, `send_hits`, `scanline`, `scanpoint`.", @@ -1492,42 +1562,6 @@ "example": true, "type": "boolean" }, - "altitude": { - "description": "Altitude of next action", - "example": 15.0, - "format": "float", - "type": "number" - }, - "depth": { - "description": "Depth of next action", - "example": 15.0, - "format": "float", - "type": "number" - }, - "start_point_latitude": { - "description": "Start point, y-coordinate", - "example": 50.37072283932642, - "format": "float", - "type": "number" - }, - "start_point_longitude": { - "description": "Start point, x-coordinate", - "example": -4.187143188645706, - "format": "float", - "type": "number" - }, - "target_waypoint_latitude": { - "description": "Target waypoint, y-coordinate", - "example": 50.37072283932642, - "format": "float", - "type": "number" - }, - "target_waypoint_longitude": { - "description": "Target waypoint, x-coordinate", - "example": -4.187143188645706, - "format": "float", - "type": "number" - }, "timeout": { "description": "Timeout set to perform action", "example": 1800.0, @@ -1535,10 +1569,6 @@ "type": "number" } }, - "required": [ - "target_waypoint_latitude", - "target_waypoint_longitude" - ], "type": "object" }, "type": "array"