Verified Commit 1f934bae authored by Dan Jones's avatar Dan Jones
Browse files

refactor: implement platform for instruction_set

parent 4fc951e2
Pipeline #239445 passed with stages
in 2 minutes and 44 seconds
...@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ...@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed ### Changed
- Refactor instruction_set into platform_instruction_set
- Refactor mission_plan schema autonomy_engine_plan_ID oneOf - Refactor mission_plan schema autonomy_engine_plan_ID oneOf
- Update all example messages with valid UUIDs - Update all example messages with valid UUIDs
- Refactor action schema to accept geojson.Points - Refactor action schema to accept geojson.Points
......
{
"header": {
"message_ID": "b427003c-0000-11aa-a1eb-b1cdf2342fdd",
"timestamp": "2024-09-03T00:00:00Z",
"version": 1,
"source": "ori",
"destination": "internal.noc.slocum.unit_111.to_platform.instruction_set",
"delivery_type": "publish",
"encoded": false
},
"payload": {
"message_type": "instruction_set",
"categories": {
"speed": "slow",
"data_transmission": "normal"
},
"files": [
{
"name": "yo95.ma",
"content": "YmVoYXZpb3JfbmFtZT15bw0KIyB5bzM1Lm1hDQojIFN0YW5kYXJkIFlPIEZpbGUgZmlsZSBnMiBvciBnMyBOT0MgZ2xpZGVycw0KIyAgMSBZTw0KIyAgMzBtIGRlcHRoDQojICBBbHRpbWV0ZXIgT24gYXQgbWF4aW11biBzcGVlZA0KIyAgQXV0b2JhbGxhc3Qgb24gLSBGdWxsIEJ1b3lhbmN5DQojICBCYXR0ZXJ5IE1vZGUgU2Vydm8gMjYgZGVlZ3JlZXMNCiMgU2VlIC9kb2NvL2h3LWl0LXdvcmtzL2F1dG9iYWxsYXN0LnR4dCBhbmQgbWFzdGVyZGF0YSBmb3IgZnVsbCBsaXN0IG9mIGJfYXJncy4NCiMgMjIgLSBBdWd1c3QgMjAxNiBhbHZhcm8ubG9yZW56b0Bub2MuYWMudWsNCiMgMDIgLSBEZWMgMjAyMSBiZW4uYWxsc3VwQG5vYyBjbGVhbiB1cCBmb3IgZzMgYW5kIHRocnVzdGVyIHVzYWdlDQoNCjxzdGFydDpiX2FyZz4JDQojICAgIGJfYXJnOiBudW1faGFsZl9jeWNsZXNfdG9fZG8obm9kaW0pIDIgCQkJIyBOdW1iZXIgb2YgZGl2ZS9jbGltYnMgdG8gcGVyZm9ybQ0KCQkJCQkJCQkJCQkJCQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgDQojIGFyZ3VtZW50cyBmb3IgZGl2ZV90bw0KICAgIGJfYXJnOiBkX2JwdW1wX3ZhbHVlKFgpIAkgICAgICAJMzAwLjAgCQkjIHRvdGFsIGRyaXZlIHZvbHVtZSBmb3IgYXV0b2JhbGxhc3QNCiAgICBiX2FyZzogZF9waXRjaF92YWx1ZShYKSAgIAkgICAgICAJLTAuMzQ5ICAJIyAtMjAgZGVnDQogICANCiMgYXJndW1lbnRzIGZvciBjbGltYl90bw0KICAgIGJfYXJnOiBjX3BpdGNoX3ZhbHVlKFgpICAgICAJCTAuMzQ5ICAgICAgICMgKzIwIGRlZw0KDQo8ZW5kOmJfYXJnPg0K",
"static": {
"no_half_cycles_to_do": 2,
"d_bpump_value": 300.0,
"d_pitch_value": -0.349,
"c_pitch_value": 0.349
}
},
{
"name": "tbdlist.dat",
"content": "IyMjIG1hbmRhdG9yeSB0aW1lIGluZm9ybWF0aW9uIGF0IGZ1bGwgcmVzb2x1dGlvbg0KU0NJX01fUFJFU0VOVF9USU1FDQpTQ0lfTV9QUkVTRU5UX1NFQ1NfSU5UT19NSVNTSU9ODQoNCiMjIyMjIyMjIyBzdGFuZGFyZCBDVEQgaW5mb3JtYXRpb24gIyMjIyMjIyMjIyMjIyMjIyMNCiMjIyByZWNvbW1lbmRlZCBzYW1wbGUgcmF0ZSA6IDwgMTAgc2Vjb25kcw0KU0NJX1dBVEVSX0NPTkQgICAgICAgICAxMCAjIHRvIHNhbXBsZSBldmVyeSBvdGhlciB5byBvbiBkb3duY2FzdCBvbmx5LCB1c2UgMTAgMSAtMSAyDQpTQ0lfV0FURVJfVEVNUCAgICAgICAgIDEwDQpTQ0lfV0FURVJfUFJFU1NVUkUgICAgIDEwDQojU0NJX0NURDQxQ1BfVElNRVNUQU1QICAxMA==",
"static": {
"SCI_WATER_COND": 10,
"SCI_WATER_TEMP": 10,
"SCI_WATER_PRESSURE": 10
}
},
{
"name": "sample99.ma",
"content": "YmVoYXZpb3JfbmFtZT1zYW1wbGUNCjxzdGFydDpiX2FyZz4NCiAgICBiX2FyZzogbnRoX3lvX3RvX3NhbXBsZShub2RpbSkgICAgICAgICAgICAJMiAgCSAjIENoZWNrIG1hc3RlcmRhdGENCiAgICBiX2FyZzogbWF4X2RlcHRoKG0pICAgICAgICAgICAgICAgICAgIAkgMjAwMCAgICAjIENoZWNrIG1hc3RlcmRhdGENCjxlbmQ6Yl9hcmc+DQo=",
"static": {
"nth_yo_to_sample": 2,
"max_depth": 2000
}
}
]
}
}
\ No newline at end of file
...@@ -89,7 +89,6 @@ ...@@ -89,7 +89,6 @@
], ],
"instructions": [ "instructions": [
{ {
"message_type": "instruction_set",
"categories": { "categories": {
"speed": "slow", "speed": "slow",
"data_transmission": "normal" "data_transmission": "normal"
......
{
"header": {
"message_ID": "b427003c-0000-11aa-a1eb-b1cdf2342fdd",
"timestamp": "2024-09-03T00:00:00Z",
"version": 1,
"source": "ori",
"destination": "internal.noc.slocum.unit_111.to_platform.instruction_set",
"delivery_type": "publish",
"encoded": false
},
"payload": {
"message_type": "platform_instruction_set",
"platform_ID": "unit_111",
"instruction_set": {
"categories": {
"speed": "slow",
"data_transmission": "normal"
},
"files": [
{
"name": "yo95.ma",
"content": "YmVoYXZpb3JfbmFtZT15bw0KIyB5bzM1Lm1hDQojIFN0YW5kYXJkIFlPIEZpbGUgZmlsZSBnMiBvciBnMyBOT0MgZ2xpZGVycw0KIyAgMSBZTw0KIyAgMzBtIGRlcHRoDQojICBBbHRpbWV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content": "IyMjIG1hbmRhdG9yeSB0aW1lIGluZm9ybWF0aW9uIGF0IGZ1bGwgcmVzb2x1dGlvbg0KU0NJX01fUFJFU0VOVF9USU1FDQpTQ0lfTV9QUkVTRU5UX1NFQ1NfSU5UT19NSVNTSU9ODQoNCiMjIyMjIyMjIyBzdGFuZGFyZCBDVEQgaW5mb3JtYXRpb24gIyMjIyMjIyMjIyMjIyMjIyMNCiMjIyByZWNvbW1lbmRlZCBzYW1wbGUgcmF0ZSA6IDwgMTAgc2Vjb25kcw0KU0NJX1dBVEVSX0NPTkQgICAgICAgICAxMCAjIHRvIHNhbXBsZSBldmVyeSBvdGhlciB5byBvbiBkb3duY2FzdCBvbmx5LCB1c2UgMTAgMSAtMSAyDQpTQ0lfV0FURVJfVEVNUCAgICAgICAgIDEwDQpTQ0lfV0FURVJfUFJFU1NVUkUgICAgIDEwDQojU0NJX0NURDQxQ1BfVElNRVNUQU1QICAxMA==",
"static": {
"SCI_WATER_COND": 10,
"SCI_WATER_TEMP": 10,
"SCI_WATER_PRESSURE": 10
}
},
{
"name": "sample99.ma",
"content": "YmVoYXZpb3JfbmFtZT1zYW1wbGUNCjxzdGFydDpiX2FyZz4NCiAgICBiX2FyZzogbnRoX3lvX3RvX3NhbXBsZShub2RpbSkgICAgICAgICAgICAJMiAgCSAjIENoZWNrIG1hc3RlcmRhdGENCiAgICBiX2FyZzogbWF4X2RlcHRoKG0pICAgICAgICAgICAgICAgICAgIAkgMjAwMCAgICAjIENoZWNrIG1hc3RlcmRhdGENCjxlbmQ6Yl9hcmc+DQo=",
"static": {
"nth_yo_to_sample": 2,
"max_depth": 2000
}
}
]
}
}
}
\ No newline at end of file
...@@ -3,13 +3,13 @@ payload_schema = { ...@@ -3,13 +3,13 @@ payload_schema = {
"propertyName": "message_type", "propertyName": "message_type",
"mapping": { "mapping": {
"alert": "#/components/schemas/alert", "alert": "#/components/schemas/alert",
"instruction_set": "#/components/schemas/instruction_set",
"mission_plan": "#/components/schemas/mission_plan", "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": "#/components/schemas/observation",
"observation_encoded": "#/components/schemas/observation_encoded", "observation_encoded": "#/components/schemas/observation_encoded",
"planning_configuration": "#/components/schemas/" "planning_configuration": "#/components/schemas/"
+ "planning_configuration", + "planning_configuration",
"platform_instruction_set": "#/components/schemas/platform_instruction_set",
"platform_status": "#/components/schemas/platform_status", "platform_status": "#/components/schemas/platform_status",
"platform_status_encoded": "#/components/schemas/" "platform_status_encoded": "#/components/schemas/"
+ "platform_status_encoded", + "platform_status_encoded",
...@@ -22,12 +22,12 @@ payload_schema = { ...@@ -22,12 +22,12 @@ payload_schema = {
"oneOf": [ "oneOf": [
{"$ref": "#/components/schemas/alert"}, {"$ref": "#/components/schemas/alert"},
{"$ref": "#/components/schemas/acknowledgement"}, {"$ref": "#/components/schemas/acknowledgement"},
{"$ref": "#/components/schemas/instruction_set"},
{"$ref": "#/components/schemas/mission_plan"}, {"$ref": "#/components/schemas/mission_plan"},
{"$ref": "#/components/schemas/mission_plan_encoded"}, {"$ref": "#/components/schemas/mission_plan_encoded"},
{"$ref": "#/components/schemas/observation"}, {"$ref": "#/components/schemas/observation"},
{"$ref": "#/components/schemas/observation_encoded"}, {"$ref": "#/components/schemas/observation_encoded"},
{"$ref": "#/components/schemas/planning_configuration"}, {"$ref": "#/components/schemas/planning_configuration"},
{"$ref": "#/components/schemas/platform_instruction_set"},
{"$ref": "#/components/schemas/platform_status"}, {"$ref": "#/components/schemas/platform_status"},
{"$ref": "#/components/schemas/platform_status_encoded"}, {"$ref": "#/components/schemas/platform_status_encoded"},
{"$ref": "#/components/schemas/survey"}, {"$ref": "#/components/schemas/survey"},
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
schemas: configuration sent to Autonomy Engine (i.e. during an emergency, schemas: configuration sent to Autonomy Engine (i.e. during an emergency,
if a platform needs to be removed from the mission planning) if a platform needs to be removed from the mission planning)
""" """
from .instruction_set import instruction_set_schema from .platform_instruction_set import instruction_set_schema
emergency_schema = { emergency_schema = {
"type": "object", "type": "object",
......
...@@ -33,12 +33,6 @@ config_file_schema = { ...@@ -33,12 +33,6 @@ config_file_schema = {
instruction_set_schema = { instruction_set_schema = {
"type": "object", "type": "object",
"properties": { "properties": {
"message_type": {
"type": "string",
"description": "Type of message",
"example": "instruction_set",
"enum": ["instruction_set"],
},
"categories": { "categories": {
"type": "object", "type": "object",
}, },
...@@ -48,7 +42,26 @@ instruction_set_schema = { ...@@ -48,7 +42,26 @@ instruction_set_schema = {
}, },
}, },
"required": [ "required": [
"message_type",
"files", "files",
], ],
} }
platform_instruction_set_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"description": "Type of message",
"example": "platform_instruction_set",
"enum": ["platform_instruction_set"],
},
"platform_ID": {
"type": "string",
"description": "Unique identifier for this platform",
"example": "reav-x-1",
},
"instruction_set": instruction_set_schema,
},
"required": ["message_type", "platform_ID", "instruction_set"],
}
...@@ -13,7 +13,11 @@ from formats.survey import survey_schema ...@@ -13,7 +13,11 @@ from formats.survey import survey_schema
from formats.survey_encoded import survey_encoded_schema from formats.survey_encoded import survey_encoded_schema
from formats.acknowledgement import acknowledgement_schema from formats.acknowledgement import acknowledgement_schema
from formats.alert import alert_schema from formats.alert import alert_schema
from formats.instruction_set import config_file_schema, instruction_set_schema from formats.platform_instruction_set import (
config_file_schema,
instruction_set_schema,
platform_instruction_set_schema,
)
from flasgger import Swagger from flasgger import Swagger
from flask import Flask from flask import Flask
...@@ -67,6 +71,7 @@ def get_swagger_config(reload=False): ...@@ -67,6 +71,7 @@ def get_swagger_config(reload=False):
"observation": observation_schema, "observation": observation_schema,
"observation_encoded": observation_encoded_schema, "observation_encoded": observation_encoded_schema,
"planning_configuration": planning_configuration_schema, "planning_configuration": planning_configuration_schema,
"platform_instruction_set": platform_instruction_set_schema,
"platform_status": platform_status_schema, "platform_status": platform_status_schema,
"platform_status_encoded": platform_status_encoded_schema, "platform_status_encoded": platform_status_encoded_schema,
"survey": survey_schema, "survey": survey_schema,
......
...@@ -1511,18 +1511,9 @@ ...@@ -1511,18 +1511,9 @@
"type": "object" "type": "object"
}, },
"type": "array" "type": "array"
},
"message_type": {
"description": "Type of message",
"enum": [
"instruction_set"
],
"example": "instruction_set",
"type": "string"
} }
}, },
"required": [ "required": [
"message_type",
"files" "files"
], ],
"type": "object" "type": "object"
...@@ -1818,12 +1809,12 @@ ...@@ -1818,12 +1809,12 @@
"mapping": { "mapping": {
"acknowledgement": "#/components/schemas/acknowledgement", "acknowledgement": "#/components/schemas/acknowledgement",
"alert": "#/components/schemas/alert", "alert": "#/components/schemas/alert",
"instruction_set": "#/components/schemas/instruction_set",
"mission_plan": "#/components/schemas/mission_plan", "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": "#/components/schemas/observation",
"observation_encoded": "#/components/schemas/observation_encoded", "observation_encoded": "#/components/schemas/observation_encoded",
"planning_configuration": "#/components/schemas/planning_configuration", "planning_configuration": "#/components/schemas/planning_configuration",
"platform_instruction_set": "#/components/schemas/platform_instruction_set",
"platform_status": "#/components/schemas/platform_status", "platform_status": "#/components/schemas/platform_status",
"platform_status_encoded": "#/components/schemas/platform_status_encoded", "platform_status_encoded": "#/components/schemas/platform_status_encoded",
"survey": "#/components/schemas/survey", "survey": "#/components/schemas/survey",
...@@ -1839,9 +1830,6 @@ ...@@ -1839,9 +1830,6 @@
{ {
"$ref": "#/components/schemas/acknowledgement" "$ref": "#/components/schemas/acknowledgement"
}, },
{
"$ref": "#/components/schemas/instruction_set"
},
{ {
"$ref": "#/components/schemas/mission_plan" "$ref": "#/components/schemas/mission_plan"
}, },
...@@ -1857,6 +1845,9 @@ ...@@ -1857,6 +1845,9 @@
{ {
"$ref": "#/components/schemas/planning_configuration" "$ref": "#/components/schemas/planning_configuration"
}, },
{
"$ref": "#/components/schemas/platform_instruction_set"
},
{ {
"$ref": "#/components/schemas/platform_status" "$ref": "#/components/schemas/platform_status"
}, },
...@@ -1912,18 +1903,9 @@ ...@@ -1912,18 +1903,9 @@
"type": "object" "type": "object"
}, },
"type": "array" "type": "array"
},
"message_type": {
"description": "Type of message",
"enum": [
"instruction_set"
],
"example": "instruction_set",
"type": "string"
} }
}, },
"required": [ "required": [
"message_type",
"files" "files"
], ],
"type": "object" "type": "object"
...@@ -2217,6 +2199,71 @@ ...@@ -2217,6 +2199,71 @@
], ],
"type": "object" "type": "object"
}, },
"platform_instruction_set": {
"properties": {
"instruction_set": {
"properties": {
"categories": {
"type": "object"
},
"files": {
"items": {
"properties": {
"content": {
"description": "Base64 encoded file content",
"example": "SDQke4uwyP/YQQAgAhA2AND/nu8nvQAAAAAAAAAACtejPa5HHUGkcBAAAAIAAAAQAAAAAAAAAA9P2cP166ab+9cg==",
"type": "string"
},
"mime_type": {
"description": "MIME type",
"example": "text/plain",
"type": "string"
},
"name": {
"description": "Name of file",
"example": "yo95.ma",
"type": "string"
},
"static": {
"description": "list of the fixed values set by the config file",
"type": "object"
}
},
"required": [
"name",
"content"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"files"
],
"type": "object"
},
"message_type": {
"description": "Type of message",
"enum": [
"platform_instruction_set"
],
"example": "platform_instruction_set",
"type": "string"
},
"platform_ID": {
"description": "Unique identifier for this platform",
"example": "reav-x-1",
"type": "string"
}
},
"required": [
"message_type",
"platform_ID",
"instruction_set"
],
"type": "object"
},
"platform_status": { "platform_status": {
"oneOf": [ "oneOf": [
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment