From f40b2551b6a20b502df42a9bbb32641165ba0f11 Mon Sep 17 00:00:00 2001
From: Trishna Saeharaseelan <trishna.saeharaseelan@noc.ac.uk>
Date: Thu, 21 Nov 2024 15:07:09 +0000
Subject: [PATCH] feat: add goal obj and partial flag to mission plan

---
 CHANGELOG.md                      |  2 ++
 examples/mas-dt/mission_plan.json | 20 +++++++++++++++++++-
 formats/mission_plan.py           | 23 +++++++++++++++++++++++
 project/soar/swagger.json         | 19 +++++++++++++++++++
 4 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 48bcf42..a973545 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
 
 ### Added
 
+- Goal object in mission_plan message that consists of a GeoJSON feature (representing the part of primitive that is currently the goal of the given mission plan).
+- A `partial` flag that indicates if a mission plan is a partial plan or the entire mission plan
 - Validate message_ID matches uuid format
 - Add definition of instruction_set message
 - Added optional primitives to squad schema
diff --git a/examples/mas-dt/mission_plan.json b/examples/mas-dt/mission_plan.json
index 3a76f4f..0899a5d 100644
--- a/examples/mas-dt/mission_plan.json
+++ b/examples/mas-dt/mission_plan.json
@@ -12,6 +12,7 @@
     "message_type": "mission_plan",
     "platform_ID": "alr-52",
     "autonomy_engine_plan_ID": "a427003c-0000-11aa-a1eb-b1cdf2342fcc",
+    "partial": false,
     "plan": [
       {
         "action": "move",
@@ -31,6 +32,23 @@
           ]
         }
       }
-    ]
+    ],
+    "goal": {
+      "timestamp": "2024-11-21T00:00:00Z",
+      "feature": {
+        "type": "Feature",
+        "properties": {
+          "name": "MAS-DT west",
+          "type": "target primitive"
+        },
+        "geometry": {
+          "type": "Point",
+          "coordinates": [
+            -3.0071,
+            50.3707
+          ]
+        }
+      }
+    }
   }
 }
\ No newline at end of file
diff --git a/formats/mission_plan.py b/formats/mission_plan.py
index fe46d11..d118d76 100644
--- a/formats/mission_plan.py
+++ b/formats/mission_plan.py
@@ -101,6 +101,21 @@ action_schema = {
     ],
 }
 
+goal_schema = {
+    "type": "object",
+    "properties": {
+        "timestamp": {
+            "type": "string",
+            "format": "date-time",
+            "description": "Timestamp of last state change when autonomy model"
+            + " sets this goal",
+            "example": "2024-11-21T00:00:00Z",
+        },
+        "feature": {
+            "$ref": "https://geojson.org/schema/Feature.json",
+        },
+    },
+}
 mission_plan_schema = {
     "type": "object",
     "properties": {
@@ -122,10 +137,18 @@ mission_plan_schema = {
             "default": False,
             "example": False,
         },
+        "partial": {
+            "type": "boolean",
+            "description": "To indicate if this mission plan represents a "
+            + "partial (`true`) or the entire (`false`) mission plan. E.g."
+            + "Partial would be `true` if a full mission plan is broken down into multiple plans.",
+            "example": False,
+        },
         "plan": {
             "type": "array",
             "items": action_schema,
         },
+        "goal": goal_schema,
     },
     "oneOf": [
         {
diff --git a/project/soar/swagger.json b/project/soar/swagger.json
index 4ba43f1..44e912e 100644
--- a/project/soar/swagger.json
+++ b/project/soar/swagger.json
@@ -1547,6 +1547,20 @@
             "example": false,
             "type": "boolean"
           },
+          "goal": {
+            "properties": {
+              "feature": {
+                "$ref": "#/components/schemas/geojson.org.schema.Feature.json"
+              },
+              "timestamp": {
+                "description": "Timestamp of last state change when autonomy model sets this goal",
+                "example": "2024-11-21T00:00:00Z",
+                "format": "date-time",
+                "type": "string"
+              }
+            },
+            "type": "object"
+          },
           "message_type": {
             "description": "Type of message",
             "enum": [
@@ -1555,6 +1569,11 @@
             "example": "mission_plan",
             "type": "string"
           },
+          "partial": {
+            "description": "To indicate if this mission plan represents a partial (`true`) or the entire (`false`) mission plan. E.g.Partial would be `true` if a full mission plan is broken down into multiple plans.",
+            "example": false,
+            "type": "boolean"
+          },
           "plan": {
             "items": {
               "oneOf": [
-- 
GitLab