Commit 46142c35 authored by Trishna Saeharaseelan's avatar Trishna Saeharaseelan
Browse files

fix(acknowledgement): schema for swagger, update hydrosurv egs#

parent e113878b
......@@ -8,7 +8,14 @@ Each message below will be wrapped in a `message_wrapper`:
* `platform_status`: these would be two message types, i. encoded (platform-specific serialized message) and ii. parsed, human-readable message.
* `observation`: this would be desired scientific data sent by the platform
* `acknowledgement`: level of acknowledgment where an acknowledgement is sent when a message is i. received, ii. sent to the next destination (e.g. platform in the water).
* `planning_configuration`: sent from the GUI to initialise the AI model (autonomy engine).
# Run Docs
1. Run the command below
```
python3 generate_swagger.py
```
2. Go to `http://127.0.0.1:5000/soardocs/`
# Quick Links
1. [Schema Fields Definitions](https://git.noc.ac.uk/communications-backbone-system/backbone-message-format/-/tree/7-message-formats-initial/formats)
......
{
"message_ID": "b427003c-7bc8-11ed-a1eb-0242ac120002",
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 1,
"source": "hydrosurv_adapter",
"destination": "autonomy_engine",
"version": 2,
"source": "autonomy_engine",
"destination": "ah1",
"delivery_type": "publish",
"encoded": false,
"type": "acknowledgement",
"payload": {
"message_ID": "b427003c-7bc8-11ed-a1eb-0242ac999999",
"status": "executed"
}
"message_type": "platform_status",
"acknowledged_message_ID": "02125022255-7bc8-11ed-a1eb-0242ac999999",
"status": "executed by platform"
}
\ No newline at end of file
{
"message_ID": "b427003c-7bc8-11ed-a1eb-0242ac120002",
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 2,
"source": "autonomy_engine",
"destination": "ah-1",
"destination": "hydrosurv_adapter",
"delivery_type": "publish",
"encoded": false,
"type": "platform_status",
"payload": {
"plan_ID": 1,
"platform_serial": "reav-60",
"plan": [
{
"action": "move",
"flight_style": "orbit",
"latitude_waypoint": -4.187143188645706,
"longitude_waypoint": 50.37072283932642,
"altitude": 0,
"depth": 0,
"activate_payload": false,
"send_environmental_data": false
}
]
}
}
\ No newline at end of file
"message_type": "mission_plan",
"plan_ID": 1,
"plan": [
{
"action": "move",
"flight_style": "orbit",
"activate_payload": true,
"altitude": 15,
"depth": 15,
"latitude_waypoint": -4.187143188645706,
"longitude_waypoint": 50.37072283932642,
"send_environmental_data": false
}
],
"platform_serial": "reav-60"
}
{
"message_ID": "b427003c-7bc8-11ed-a1eb-0242ac120002",
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 1,
"version": 2,
"source": "hydrosurv_adapter",
"destination": "autonomy_engine",
"delivery_type": "publish",
"encoded": false,
"type": "platform_status",
"payload": {
"platform_ID": 1,
"active": true,
"platform_state": "ORBIT",
"autonomy_plan_ID": 1,
"mission_track_ID": 4,
"mission_action_ID": 1,
"range_to_go": 0.3,
"speed_over_ground": 0.3,
"water_current_velocity": 0.3,
"thrust_applied": 0.3,
"health_status": "Warning",
"gps_data": [
{
"gps_source": "internal",
"latitude_type": "",
"longitude_type": "",
"latitude": -7.432,
"longitude": 50.365,
"depth": 0.0,
"altitude": 0.0
}
],
"localisation_error": null,
"usbl_fix_seconds_ago": null,
"battery_remaining_capacity": 80,
"sensor_config": {
"sensor_name": null,
"sensor_status": false,
"additional_data": null
"message_type": "platform_status",
"active": true,
"autonomy_plan_ID": 1,
"battery_remaining_capacity": 80.2,
"gps_data": [
{
"altitude": 20,
"depth": 50,
"gps_source": "internal",
"latitude": 178.2,
"latitude_type": "string",
"longitude": -10.122,
"longitude_type": "string"
}
}
}
\ No newline at end of file
],
"health_status": "Warning",
"localisation_error": null,
"mission_action_ID": 1,
"mission_track_ID": 4,
"platform_ID": 1,
"platform_state": "ABORT",
"platform_timestamp": "2022-12-21T00:00:00Z",
"range_to_go": 124.3,
"sensor_config": {
"additional_data": {},
"sensor_serial": null,
"sensor_status": null
},
"speed_over_ground": 124.3,
"thrust_applied": 124.3,
"usbl_fix_seconds_ago": null,
"water_current_velocity": 124.3
}
{
"message_ID": "b427003c-7bc8-11ed-a1eb-0242ac120002",
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 1,
"source": "hydrosurv_adapter",
"destination": "autonomy_engine",
"version": 2,
"source": "autonomy_engine",
"destination": "ah1",
"delivery_type": "publish",
"encoded": false,
"type": "acknowledgement",
"payload": {
"message_ID": "b427003c-7bc8-11ed-a1eb-0242ac999999",
"status": "executed"
}
"message_type": "platform_status",
"acknowledged_message_ID": "02125022255-7bc8-11ed-a1eb-0242ac999999",
"status": "executed by platform"
}
\ No newline at end of file
{
"message_ID": "b427003c-7bc8-11ed-a1eb-0242ac120002",
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 2,
"source": "autonomy_engine",
"destination": "ah-1",
"destination": "hydrosurv_adapter",
"delivery_type": "publish",
"encoded": false,
"type": "platform_status",
"payload": {
"plan_ID": 1,
"platform_serial": "reav-60",
"plan": [
{
"action": "move",
"flight_style": "orbit",
"latitude_waypoint": -4.187143188645706,
"longitude_waypoint": 50.37072283932642,
"altitude": 0,
"depth": 0,
"activate_payload": false,
"send_environmental_data": false
}
]
}
}
\ No newline at end of file
"message_type": "mission_plan",
"plan_ID": 1,
"plan": [
{
"action": "move",
"flight_style": "orbit",
"activate_payload": true,
"altitude": 15,
"depth": 15,
"latitude_waypoint": -4.187143188645706,
"longitude_waypoint": 50.37072283932642,
"send_environmental_data": false
}
],
"platform_serial": "reav-60"
}
{
"message_ID": "b427003c-7bc8-11ed-a1eb-0242ac120002",
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 1,
"version": 2,
"source": "hydrosurv_adapter",
"destination": "autonomy_engine",
"delivery_type": "publish",
"encoded": false,
"type": "platform_status",
"payload": {
"platform_ID": 1,
"active": true,
"platform_state": "ORBIT",
"autonomy_plan_ID": 1,
"mission_track_ID": 4,
"mission_action_ID": 1,
"range_to_go": 0.3,
"speed_over_ground": 0.3,
"water_current_velocity": 0.3,
"thrust_applied": 0.3,
"health_status": "Warning",
"gps_data": [
{
"gps_source": "internal",
"latitude_type": "",
"longitude_type": "",
"latitude": -7.432,
"longitude": 50.365,
"depth": 0.0,
"altitude": 0.0
}
],
"localisation_error": null,
"usbl_fix_seconds_ago": null,
"battery_remaining_capacity": 80,
"sensor_config": {
"sensor_name": null,
"sensor_status": false,
"additional_data": null
"message_type": "platform_status",
"active": true,
"autonomy_plan_ID": 1,
"battery_remaining_capacity": 80.2,
"gps_data": [
{
"altitude": 20,
"depth": 50,
"gps_source": "internal",
"latitude": 178.2,
"latitude_type": "string",
"longitude": -10.122,
"longitude_type": "string"
}
}
}
\ No newline at end of file
],
"health_status": "Warning",
"localisation_error": null,
"mission_action_ID": 1,
"mission_track_ID": 4,
"platform_ID": 1,
"platform_state": "ABORT",
"platform_timestamp": "2022-12-21T00:00:00Z",
"range_to_go": 124.3,
"sensor_config": {
"additional_data": {},
"sensor_serial": null,
"sensor_status": null
},
"speed_over_ground": 124.3,
"thrust_applied": 124.3,
"usbl_fix_seconds_ago": null,
"water_current_velocity": 124.3
}
......@@ -3,12 +3,14 @@
receipt of message.
"""
acknowledgement_schema = {
"allOf": [{"$ref": "#/components/schemas/Message"}],
"type": "object",
"properties": {
"message_ID": {
"acknowledged_message_ID": {
"type": "string",
"description": "Identifier of message received and executed with "
+ "success for mission plans sent by the Autonomy Engine.",
"example": "b427003c-7bc8-11ed-a1eb-0242ac999999",
"example": "02125022255-7bc8-11ed-a1eb-0242ac999999",
},
"status": {
"type": "string",
......@@ -18,7 +20,7 @@ acknowledgement_schema = {
"example": "executed by platform",
},
},
"required": ["message_ID", "status"],
"required": ["acknowledged_message_ID", "status"],
}
# acknowledgement_schema = api.model(
......
......@@ -13,7 +13,7 @@ message_wrapper_schema = {
"message_ID": {
"type": "string",
"description": "An identifier for the type of " + "message received.",
"example": "PlatformStatus",
"example": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
},
"timestamp": {
"type": "date-time",
......
"""
schema: platform-specific decoded status message (DRAFT)
schema: Observation Message sent by platforms when points of interest are found.
"""
# from . import full_message_schema, api
# from flask_restx import fields
......
......@@ -7,6 +7,7 @@ from formats.mission_plan import mission_plan_schema
from formats.observation import observation_schema
from formats.planning_configuration import planning_configuration_schema
from formats.platform_status import platform_status_message_schema
from formats.acknowledgement import acknowledgement_schema
app = Flask(__name__)
......@@ -35,6 +36,7 @@ swagger_config = {
"Observation": observation_schema,
"PlanningConfiguration": planning_configuration_schema,
"PlatformStatus": platform_status_message_schema,
"Acknowledgement": acknowledgement_schema,
},
},
"paths": {
......@@ -50,7 +52,7 @@ swagger_config = {
"oneOf": [
{
"$ref": "#/components/"
+ "schemas/Coordinate"
+ "schemas/Acknowledgement"
},
{
"$ref": "#/components/"
......
......@@ -42,3 +42,10 @@ Squad of Adaptive Robots Project
| NOC (AH1) | emergency | GUI | TBD – AH1 (ABORT command via Black Box) | TBD | TBD | TBD – all platforms pre-compiled ABORT via Black box |
| NOC (GUI) | planning configuration | GUI | Autonomy Engine | Yes | No | N/A |
| NOC (GUI) | emergency | GUI | TBD | TBD | TBD | TBD |
## Run Docs
1. Run the command below
```
python3 generate_swagger.py
```
2. Go to `http://127.0.0.1:5000/soardocs/`
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