diff --git a/CHANGELOG.md b/CHANGELOG.md index 65831cc093427dafc450713776342fa0becc8b09..3dcce35519081fda2d9d65500cd31008fb3ce38e 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. ### Added +- Add definition of instruction_set message - Added optional primitives to squad schema ### Changed @@ -16,10 +17,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Refactor action schema to accept geojson.Points - Use geojson Point for platform_status - Add waypoint to platform_status +- Updated header version to accept semver, branch or commit - Store remote schemas as committed local files This prevents the live runtime loading untested changes -- Updated header version to accept semver, branch or commit -- Store remote schemas as committed local files - Refactored planning_configuration message definition - Remove region_of_interest and exclusion_zones - Add primitives array of classified geojson Features diff --git a/examples/mas-dt/instruction_set.json b/examples/mas-dt/instruction_set.json new file mode 100644 index 0000000000000000000000000000000000000000..2ed3e6cf8e49bc3c74c035d457be333932f2f243 --- /dev/null +++ b/examples/mas-dt/instruction_set.json @@ -0,0 +1,47 @@ +{ + "header": { + "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", + "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 diff --git a/examples/mas-dt/planning_configuration.json b/examples/mas-dt/planning_configuration.json index ea4b7af462da3cfb249b4c8afd4521ea8520ddfc..cf785e3a9df6922fd2c6a6ca4012f0e13afbd653 100644 --- a/examples/mas-dt/planning_configuration.json +++ b/examples/mas-dt/planning_configuration.json @@ -87,6 +87,44 @@ } } ], + "instructions": [ + { + "message_type": "instruction_set", + "categories": { + "speed": "slow", + "data_transmission": "normal" + }, + "files": [ + { + "name": "yo95.ma", + "content": "YmVoYXZpb3JfbmFtZT15bw0KIyB5bzM1Lm1hDQojIFN0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XJnPg0K", + "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 + } + } + ] + } + ], "squads": [ { "squad_ID": 1, diff --git a/formats/instruction_set.py b/formats/instruction_set.py new file mode 100644 index 0000000000000000000000000000000000000000..2fadbb64f9e844d37c7c7a2ca4de61047476afbf --- /dev/null +++ b/formats/instruction_set.py @@ -0,0 +1,54 @@ +""" + schemas: Instruction set message containing a collection of configuration files +""" + +config_file_schema = { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of file", + "example": "yo95.ma", + }, + "content": { + "type": "string", + "description": "Base64 encoded file content", + "example": "SDQke4uwyP/YQQAgAhA2AND/nu8nvQAAAAAAAAAACtejPa5HHUGkcB" + + "AAAAIAAAAQAAAAAAAAAA9P2cP166ab+9cg==", + }, + "mime_type": { + "type": "string", + "description": "MIME type", + "example": "text/plain", + }, + "static": { + "type": "object", + "description": "list of the fixed values set by the config file", + }, + }, + "required": ["name", "content"], +} + + +instruction_set_schema = { + "type": "object", + "properties": { + "message_type": { + "type": "string", + "description": "Type of message", + "example": "instruction_set", + "enum": ["instruction_set"], + }, + "categories": { + "type": "object", + }, + "files": { + "type": "array", + "items": config_file_schema, + }, + }, + "required": [ + "message_type", + "files", + ], +} diff --git a/formats/payload.py b/formats/payload.py index 062527f48de04a9642655b9a0b7ea8caeeccff79..0868657e81a5208ed8e9a4cbe0cd278777655db7 100644 --- a/formats/payload.py +++ b/formats/payload.py @@ -3,6 +3,7 @@ payload_schema = { "propertyName": "message_type", "mapping": { "alert": "#/components/schemas/alert", + "instruction_set": "#/components/schemas/instruction_set", "mission_plan": "#/components/schemas/mission_plan", "mission_plan_encoded": "#/components/schemas/" + "mission_plan_encoded", "observation": "#/components/schemas/observation", @@ -20,6 +21,7 @@ payload_schema = { "oneOf": [ {"$ref": "#/components/schemas/alert"}, {"$ref": "#/components/schemas/acknowledgement"}, + {"$ref": "#/components/schemas/instruction_set"}, {"$ref": "#/components/schemas/mission_plan"}, {"$ref": "#/components/schemas/mission_plan_encoded"}, {"$ref": "#/components/schemas/observation"}, diff --git a/formats/planning_configuration.py b/formats/planning_configuration.py index 7fff4b5f7bba948add737d435766c5302501efc2..485c2ac066d36c9e44c46d4405109f26e4f65a00 100644 --- a/formats/planning_configuration.py +++ b/formats/planning_configuration.py @@ -2,6 +2,7 @@ schemas: configuration sent to Autonomy Engine (i.e. during an emergency, if a platform needs to be removed from the mission planning) """ +from .instruction_set import instruction_set_schema emergency_schema = { "type": "object", @@ -263,6 +264,10 @@ planning_configuration_schema = { "description": "Specification primitives " + "- campaign-wide such as operating area and obstacles", }, + "instructions": { + "type": "array", + "items": instruction_set_schema, + }, "squads": { "type": "array", "items": squad_metadata_schema, diff --git a/generate_schema_config.py b/generate_schema_config.py index 57cadb697866fbdfe092e63a9dfc2417e5b82236..3c0f530a8635479c1af949877718cc11afa89f21 100644 --- a/generate_schema_config.py +++ b/generate_schema_config.py @@ -12,6 +12,7 @@ from formats.survey import survey_schema from formats.survey_encoded import survey_encoded_schema from formats.acknowledgement import acknowledgement_schema from formats.alert import alert_schema +from formats.instruction_set import config_file_schema, instruction_set_schema from flasgger import Swagger from flask import Flask @@ -71,6 +72,8 @@ def get_swagger_config(reload=False): "survey_encoded": survey_encoded_schema, "acknowledgement": acknowledgement_schema, "alert": alert_schema, + "instruction_set": instruction_set_schema, + "config_file": config_file_schema, } }, } diff --git a/project/soar/swagger.json b/project/soar/swagger.json index e76d2ff1c94467e82b7a9715f077b451543ffed1..a22f75b22baab69212788648a5d970da071e333b 100644 --- a/project/soar/swagger.json +++ b/project/soar/swagger.json @@ -111,6 +111,34 @@ ], "type": "object" }, + "config_file": { + "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" + }, "geojson.org.schema.Feature.json": { "properties": { "bbox": { @@ -1446,6 +1474,57 @@ ], "type": "object" }, + "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" + }, + "message_type": { + "description": "Type of message", + "enum": [ + "instruction_set" + ], + "example": "instruction_set", + "type": "string" + } + }, + "required": [ + "message_type", + "files" + ], + "type": "object" + }, "mission_plan": { "properties": { "autonomy_engine_plan_ID": { @@ -1730,6 +1809,7 @@ "mapping": { "acknowledgement": "#/components/schemas/acknowledgement", "alert": "#/components/schemas/alert", + "instruction_set": "#/components/schemas/instruction_set", "mission_plan": "#/components/schemas/mission_plan", "mission_plan_encoded": "#/components/schemas/mission_plan_encoded", "observation": "#/components/schemas/observation", @@ -1749,6 +1829,9 @@ { "$ref": "#/components/schemas/acknowledgement" }, + { + "$ref": "#/components/schemas/instruction_set" + }, { "$ref": "#/components/schemas/mission_plan" }, @@ -1780,6 +1863,60 @@ }, "planning_configuration": { "properties": { + "instructions": { + "items": { + "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" + }, + "message_type": { + "description": "Type of message", + "enum": [ + "instruction_set" + ], + "example": "instruction_set", + "type": "string" + } + }, + "required": [ + "message_type", + "files" + ], + "type": "object" + }, + "type": "array" + }, "message_type": { "description": "Type of message", "enum": [