From e15001f02f8af58740de89539bd5e2d8a60539ba Mon Sep 17 00:00:00 2001 From: Dan Jones <danjon@noc.ac.uk> Date: Tue, 10 Sep 2024 10:36:05 +0100 Subject: [PATCH] refactor: add primitives at squad level --- examples/mas-dt/planning_configuration.json | 125 ++++++++++++++++++++ formats/planning_configuration.py | 55 +++++---- project/soar/swagger.json | 32 ++++- 3 files changed, 186 insertions(+), 26 deletions(-) create mode 100644 examples/mas-dt/planning_configuration.json diff --git a/examples/mas-dt/planning_configuration.json b/examples/mas-dt/planning_configuration.json new file mode 100644 index 0000000..ea4b7af --- /dev/null +++ b/examples/mas-dt/planning_configuration.json @@ -0,0 +1,125 @@ +{ + "header":{ + "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", + "timestamp": "2022-11-16T00:00:00Z", + "version": 2, + "source": "noc-c2", + "destination": "", + "delivery_type": "broadcast", + "encoded": false + }, + "payload":{ + "message_type": "planning_configuration", + "planning_config_ID": 1, + "primitives": [ + { + "instruction": "stay_outside", + "feature": { + "type": "Feature", + "properties": { + "name": "The Rock", + "type": "exclusion_zone" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -4.1777839187560915, + 50.34173405662855 + ], + [ + -4.1777839187560915, + 50.33820949229701 + ], + [ + -4.143667777943875, + 50.33820949229701 + ], + [ + -4.143667777943875, + 50.34173405662855 + ], + [ + -4.1777839187560915, + 50.34173405662855 + ] + ] + ] + } + } + }, + { + "instruction": "stay_inside", + "feature": { + "type": "Feature", + "properties": { + "name": "Survey Zone Charlie", + "type": "operating area" + }, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -4.1777839187560915, + 50.34173405662855 + ], + [ + -4.1777839187560915, + 50.33820949229701 + ], + [ + -4.143667777943875, + 50.33820949229701 + ], + [ + -4.143667777943875, + 50.34173405662855 + ], + [ + -4.1777839187560915, + 50.34173405662855 + ] + ] + ] + } + } + } + ], + "squads": [ + { + "squad_ID": 1, + "no_of_platforms": 1, + "squad_mission_type": "profiling", + "platforms": [ + { + "operator": "noc", + "model": "slocum", + "platform_ID": "unit_xxx", + "active": true + } + ], + "primitives": [ + { + "instruction": "navigate_to", + "feature": { + "type": "Feature", + "properties": { + "name": "Target a", + "type": "target" + }, + "geometry": { + "type": "Point", + "coordinates": [ + -4.183181, + 50.335942 + ] + } + } + } + ] + } + ] + } +} \ No newline at end of file diff --git a/formats/planning_configuration.py b/formats/planning_configuration.py index 24fd18a..7fff4b5 100644 --- a/formats/planning_configuration.py +++ b/formats/planning_configuration.py @@ -180,6 +180,28 @@ platform_schema = { ], } +primitive_schema = { + "type": "object", + "properties": { + "instruction": { + "type": "string", + "enum": [ + "stay_inside", + "stay_outside", + "navigate_to", + "follow", + "repeat", + "cover", + ], + "description": "How the associated feature should be used", + }, + "feature": { + "$ref": "https://geojson.org/schema/Feature.json", + }, + }, + "required": ["feature"], +} + squad_metadata_schema = { "type": "object", "properties": { @@ -200,11 +222,17 @@ squad_metadata_schema = { }, "squad_mission_type": { "type": "string", - "enum": ["tracking", "survey", "inspection"], + "enum": ["tracking", "survey", "inspection", "profiling"], "description": "Mission of given squad: `tracking`, `survey`" + ", `inspection`", "example": "survey", }, + "primitives": { + "type": "array", + "items": primitive_schema, + "description": "Squad primitives " + + "- includes platform group navigation instructions", + }, }, "required": [ "squad_ID", @@ -214,28 +242,6 @@ squad_metadata_schema = { ], } -primitive_schema = { - "type": "object", - "properties": { - "instruction": { - "type": "string", - "enum": [ - "stay_inside", - "stay_outside", - "navigate_to", - "follow", - "repeat", - "cover", - ], - "description": "How the associated feature should be used", - }, - "feature": { - "$ref": "https://geojson.org/schema/Feature.json", - }, - }, - "required": ["feature"], -} - planning_configuration_schema = { "type": "object", "properties": { @@ -254,7 +260,8 @@ planning_configuration_schema = { "primitives": { "type": "array", "items": primitive_schema, - "description": "Specification primitives", + "description": "Specification primitives " + + "- campaign-wide such as operating area and obstacles", }, "squads": { "type": "array", diff --git a/project/soar/swagger.json b/project/soar/swagger.json index 2ff1d4f..e76d2ff 100644 --- a/project/soar/swagger.json +++ b/project/soar/swagger.json @@ -1794,7 +1794,7 @@ "type": "integer" }, "primitives": { - "description": "Specification primitives", + "description": "Specification primitives - campaign-wide such as operating area and obstacles", "items": { "properties": { "feature": { @@ -2004,6 +2004,33 @@ }, "type": "array" }, + "primitives": { + "description": "Squad primitives - includes platform group navigation instructions", + "items": { + "properties": { + "feature": { + "$ref": "#/components/schemas/geojson.org.schema.Feature.json" + }, + "instruction": { + "description": "How the associated feature should be used", + "enum": [ + "stay_inside", + "stay_outside", + "navigate_to", + "follow", + "repeat", + "cover" + ], + "type": "string" + } + }, + "required": [ + "feature" + ], + "type": "object" + }, + "type": "array" + }, "squad_ID": { "description": "Identifier of given squad", "example": 23, @@ -2014,7 +2041,8 @@ "enum": [ "tracking", "survey", - "inspection" + "inspection", + "profiling" ], "example": "survey", "type": "string" -- GitLab