From 3aba610499ea9935a88888bce1ca3f837dd0a583 Mon Sep 17 00:00:00 2001 From: Trishna Saeharaseelan <trishna.saeharaseelan@noc.ac.uk> Date: Mon, 20 Feb 2023 21:06:36 +0000 Subject: [PATCH] feat: add human-in-the-loop acknowledgment --- .../acknowledgement.json | 5 ++- .../hydrosurv_adapter/acknowledgement.json | 5 ++- formats/acknowledgement.py | 26 ++++++------ project/soar/swagger.json | 42 +++++++++---------- tests/fixtures/schemas.py | 27 ++++++------ tests/fixtures/swagger.json | 35 ++++++++-------- .../acknowledgement.json | 5 ++- .../hydrosurv_adapter/acknowledgement.json | 5 ++- 8 files changed, 78 insertions(+), 72 deletions(-) diff --git a/examples/autonomy_engine_adapter/acknowledgement.json b/examples/autonomy_engine_adapter/acknowledgement.json index c5290f5..1787704 100644 --- a/examples/autonomy_engine_adapter/acknowledgement.json +++ b/examples/autonomy_engine_adapter/acknowledgement.json @@ -10,7 +10,8 @@ }, "payload":{ "message_type": "acknowledgement", - "acknowledged_message_ID": "11111111-7bc8-11ed-a1eb-0242ac999999", - "status": "c2_received" + "autonomy_engine_plan_ID": 1, + "platform_ID": "reav-x-1", + "approved": false } } \ No newline at end of file diff --git a/examples/hydrosurv_adapter/acknowledgement.json b/examples/hydrosurv_adapter/acknowledgement.json index c5290f5..1787704 100644 --- a/examples/hydrosurv_adapter/acknowledgement.json +++ b/examples/hydrosurv_adapter/acknowledgement.json @@ -10,7 +10,8 @@ }, "payload":{ "message_type": "acknowledgement", - "acknowledged_message_ID": "11111111-7bc8-11ed-a1eb-0242ac999999", - "status": "c2_received" + "autonomy_engine_plan_ID": 1, + "platform_ID": "reav-x-1", + "approved": false } } \ No newline at end of file diff --git a/formats/acknowledgement.py b/formats/acknowledgement.py index cd2ce6e..40371af 100644 --- a/formats/acknowledgement.py +++ b/formats/acknowledgement.py @@ -10,21 +10,21 @@ acknowledgement_schema = { "description": "Type of message", "example": "acknowledgement", }, - "acknowledged_message_ID": { - "type": "string", - "description": "Identifier of message received and executed with " - + "success for mission plans sent by the Autonomy Engine.", - "example": "02125022255-7bc8-11ed-a1eb-0242ac999999", + "autonomy_engine_plan_ID": { + "type": "integer", + "description": "Mission plan ID (according to Autonomy" + + " Engine's mission plan number sent) executed by platform", + "example": 1, }, - "status": { + "platform_ID": { "type": "string", - "enum": ["c2_received", "operator_approved_and_sent", "executed"], - "description": "Highest level of acknowledgement. I.e." - + " `c2_received`: Received by C2, `operator_approved_and_sent`" - + " : Approved by operator and sent from C2->Platform," - + " `executed`: Executed by platform", - "example": "executed by platform", + "description": "Unique identifier for this platform", + "example": "reav-x-1", + }, + "approved": { + "type": "boolean", + "description": "Human-in-the-loop approval. 1 - Plan approved; 0 - Plan Rejected", }, }, - "required": ["message_type", "acknowledged_message_ID", "status"], + "required": ["message_type","autonomy_engine_plan_ID", "platform_ID", "approved"], } diff --git a/project/soar/swagger.json b/project/soar/swagger.json index b60d60b..880bec8 100644 --- a/project/soar/swagger.json +++ b/project/soar/swagger.json @@ -19,31 +19,32 @@ }, "acknowledgement": { "properties": { - "acknowledged_message_ID": { - "description": "Identifier of message received and executed with success for mission plans sent by the Autonomy Engine.", - "example": "02125022255-7bc8-11ed-a1eb-0242ac999999", - "type": "string" + "approved": { + "type": "boolean", + "description": "Human-in-the-loop approval. 1 - Plan approved; 0 - Plan Rejected", + "example": 1 + }, + "autonomy_engine_plan_ID": { + "type": "integer", + "description": "Mission plan ID (according to Autonomy Engine's mission plan number sent) executed by platform", + "example": 1 }, "message_type": { "description": "Type of message", - "example": "acknowledgement", - "type": "string" + "type": "string", + "example": "acknowledgement" }, - "status": { - "description": "Highest level of acknowledgement. I.e. `c2_received`: Received by C2, `operator_approved_and_sent` : Approved by operator and sent from C2->Platform, `executed`: Executed by platform", - "enum": [ - "c2_received", - "operator_approved_and_sent", - "executed" - ], - "example": "executed by platform", - "type": "string" + "platform_ID": { + "type": "string", + "description": "Unique identifier for this platform", + "example": "reav-x-1" } }, "required": [ "message_type", - "acknowledged_message_ID", - "status" + "autonomy_engine_plan_ID", + "platform_ID", + "approved" ], "type": "object" }, @@ -230,8 +231,7 @@ }, "region_surveyed": { "description": "Region surveyed by given platform. GEOJSON", - "example": "", - "nullable": true + "example": "" } }, "required": [ @@ -517,9 +517,9 @@ "type": "number" }, "depth": { - "default": 0, + "default": 0.0, "description": "Target depth in metres", - "example": 50, + "example": 50.0, "format": "float", "type": "number" }, diff --git a/tests/fixtures/schemas.py b/tests/fixtures/schemas.py index d9633d1..64f1612 100644 --- a/tests/fixtures/schemas.py +++ b/tests/fixtures/schemas.py @@ -56,26 +56,27 @@ acknowledgement_schema = { "description": "Type of message", "example": "acknowledgement", }, - "acknowledged_message_ID": { - "type": "string", - "description": "Identifier of message received and executed with " - + "success for mission plans sent by the Autonomy Engine.", - "example": "02125022255-7bc8-11ed-a1eb-0242ac999999", + "autonomy_engine_plan_ID": { + "type": "integer", + "description": "Mission plan ID (according to Autonomy" + + " Engine's mission plan number sent) executed by platform", + "example": 1, }, - "status": { + "platform_ID": { "type": "string", - "enum": ["c2_received", "operator_approved_and_sent", "executed"], - "description": "Highest level of acknowledgement. I.e." - + " `c2_received`: Received by C2, `operator_approved_and_sent`" - + " : Approved by operator and sent from C2->Platform," - + " `executed`: Executed by platform", - "example": "executed by platform", + "description": "Unique identifier for this platform", + "example": "reav-x-1", + }, + "approved": { + "type": "boolean", + "description": "Human-in-the-loop approval. 1 - Plan approved; 0 - Plan Rejected", }, }, - "required": ["message_type", "acknowledged_message_ID", "status"], + "required": ["message_type","autonomy_engine_plan_ID", "platform_ID", "approved"], } + action_schema = { "type": "object", "properties": { diff --git a/tests/fixtures/swagger.json b/tests/fixtures/swagger.json index 31d4c95..a864c5c 100644 --- a/tests/fixtures/swagger.json +++ b/tests/fixtures/swagger.json @@ -19,31 +19,32 @@ }, "acknowledgement": { "properties": { - "acknowledged_message_ID": { - "description": "Identifier of message received and executed with success for mission plans sent by the Autonomy Engine.", - "example": "02125022255-7bc8-11ed-a1eb-0242ac999999", - "type": "string" + "approved": { + "type": "boolean", + "description": "Human-in-the-loop approval. 1 - Plan approved; 0 - Plan Rejected", + "example": 1 + }, + "autonomy_engine_plan_ID": { + "type": "integer", + "description": "Mission plan ID (according to Autonomy Engine's mission plan number sent) executed by platform", + "example": 1 }, "message_type": { "description": "Type of message", - "example": "acknowledgement", - "type": "string" + "type": "string", + "example": "acknowledgement" }, - "status": { - "description": "Highest level of acknowledgement. I.e. `c2_received`: Received by C2, `operator_approved_and_sent` : Approved by operator and sent from C2->Platform, `executed`: Executed by platform", - "enum": [ - "c2_received", - "operator_approved_and_sent", - "executed" - ], - "example": "executed by platform", - "type": "string" + "platform_ID": { + "type": "string", + "description": "Unique identifier for this platform", + "example": "reav-x-1" } }, "required": [ "message_type", - "acknowledged_message_ID", - "status" + "autonomy_engine_plan_ID", + "platform_ID", + "approved" ], "type": "object" }, diff --git a/tests/mock_data/autonomy_engine_adapter/acknowledgement.json b/tests/mock_data/autonomy_engine_adapter/acknowledgement.json index c5290f5..1787704 100644 --- a/tests/mock_data/autonomy_engine_adapter/acknowledgement.json +++ b/tests/mock_data/autonomy_engine_adapter/acknowledgement.json @@ -10,7 +10,8 @@ }, "payload":{ "message_type": "acknowledgement", - "acknowledged_message_ID": "11111111-7bc8-11ed-a1eb-0242ac999999", - "status": "c2_received" + "autonomy_engine_plan_ID": 1, + "platform_ID": "reav-x-1", + "approved": false } } \ No newline at end of file diff --git a/tests/mock_data/hydrosurv_adapter/acknowledgement.json b/tests/mock_data/hydrosurv_adapter/acknowledgement.json index c5290f5..1787704 100644 --- a/tests/mock_data/hydrosurv_adapter/acknowledgement.json +++ b/tests/mock_data/hydrosurv_adapter/acknowledgement.json @@ -10,7 +10,8 @@ }, "payload":{ "message_type": "acknowledgement", - "acknowledged_message_ID": "11111111-7bc8-11ed-a1eb-0242ac999999", - "status": "c2_received" + "autonomy_engine_plan_ID": 1, + "platform_ID": "reav-x-1", + "approved": false } } \ No newline at end of file -- GitLab