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`: ...@@ -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. * `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 * `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). * `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 # Quick Links
1. [Schema Fields Definitions](https://git.noc.ac.uk/communications-backbone-system/backbone-message-format/-/tree/7-message-formats-initial/formats) 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", "timestamp": "2022-11-16T00:00:00Z",
"version": 1, "version": 2,
"source": "hydrosurv_adapter", "source": "autonomy_engine",
"destination": "autonomy_engine", "destination": "ah1",
"delivery_type": "publish",
"encoded": false, "encoded": false,
"type": "acknowledgement", "message_type": "platform_status",
"payload": { "acknowledged_message_ID": "02125022255-7bc8-11ed-a1eb-0242ac999999",
"message_ID": "b427003c-7bc8-11ed-a1eb-0242ac999999", "status": "executed by platform"
"status": "executed"
}
} }
\ 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", "timestamp": "2022-11-16T00:00:00Z",
"version": 2, "version": 2,
"source": "autonomy_engine", "source": "autonomy_engine",
"destination": "ah-1", "destination": "hydrosurv_adapter",
"delivery_type": "publish",
"encoded": false, "encoded": false,
"type": "platform_status", "message_type": "mission_plan",
"payload": { "plan_ID": 1,
"plan_ID": 1, "plan": [
"platform_serial": "reav-60", {
"plan": [ "action": "move",
{ "flight_style": "orbit",
"action": "move", "activate_payload": true,
"flight_style": "orbit", "altitude": 15,
"latitude_waypoint": -4.187143188645706, "depth": 15,
"longitude_waypoint": 50.37072283932642, "latitude_waypoint": -4.187143188645706,
"altitude": 0, "longitude_waypoint": 50.37072283932642,
"depth": 0, "send_environmental_data": false
"activate_payload": false, }
"send_environmental_data": false ],
} "platform_serial": "reav-60"
] }
}
}
\ 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", "timestamp": "2022-11-16T00:00:00Z",
"version": 1, "version": 2,
"source": "hydrosurv_adapter", "source": "hydrosurv_adapter",
"destination": "autonomy_engine", "destination": "autonomy_engine",
"delivery_type": "publish",
"encoded": false, "encoded": false,
"type": "platform_status", "message_type": "platform_status",
"payload": { "active": true,
"platform_ID": 1, "autonomy_plan_ID": 1,
"active": true, "battery_remaining_capacity": 80.2,
"platform_state": "ORBIT", "gps_data": [
"autonomy_plan_ID": 1, {
"mission_track_ID": 4, "altitude": 20,
"mission_action_ID": 1, "depth": 50,
"range_to_go": 0.3, "gps_source": "internal",
"speed_over_ground": 0.3, "latitude": 178.2,
"water_current_velocity": 0.3, "latitude_type": "string",
"thrust_applied": 0.3, "longitude": -10.122,
"health_status": "Warning", "longitude_type": "string"
"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
} }
} ],
} "health_status": "Warning",
\ No newline at end of file "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", "timestamp": "2022-11-16T00:00:00Z",
"version": 1, "version": 2,
"source": "hydrosurv_adapter", "source": "autonomy_engine",
"destination": "autonomy_engine", "destination": "ah1",
"delivery_type": "publish",
"encoded": false, "encoded": false,
"type": "acknowledgement", "message_type": "platform_status",
"payload": { "acknowledged_message_ID": "02125022255-7bc8-11ed-a1eb-0242ac999999",
"message_ID": "b427003c-7bc8-11ed-a1eb-0242ac999999", "status": "executed by platform"
"status": "executed"
}
} }
\ 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", "timestamp": "2022-11-16T00:00:00Z",
"version": 2, "version": 2,
"source": "autonomy_engine", "source": "autonomy_engine",
"destination": "ah-1", "destination": "hydrosurv_adapter",
"delivery_type": "publish",
"encoded": false, "encoded": false,
"type": "platform_status", "message_type": "mission_plan",
"payload": { "plan_ID": 1,
"plan_ID": 1, "plan": [
"platform_serial": "reav-60", {
"plan": [ "action": "move",
{ "flight_style": "orbit",
"action": "move", "activate_payload": true,
"flight_style": "orbit", "altitude": 15,
"latitude_waypoint": -4.187143188645706, "depth": 15,
"longitude_waypoint": 50.37072283932642, "latitude_waypoint": -4.187143188645706,
"altitude": 0, "longitude_waypoint": 50.37072283932642,
"depth": 0, "send_environmental_data": false
"activate_payload": false, }
"send_environmental_data": false ],
} "platform_serial": "reav-60"
] }
}
}
\ 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", "timestamp": "2022-11-16T00:00:00Z",
"version": 1, "version": 2,
"source": "hydrosurv_adapter", "source": "hydrosurv_adapter",
"destination": "autonomy_engine", "destination": "autonomy_engine",
"delivery_type": "publish",
"encoded": false, "encoded": false,
"type": "platform_status", "message_type": "platform_status",
"payload": { "active": true,
"platform_ID": 1, "autonomy_plan_ID": 1,
"active": true, "battery_remaining_capacity": 80.2,
"platform_state": "ORBIT", "gps_data": [
"autonomy_plan_ID": 1, {
"mission_track_ID": 4, "altitude": 20,
"mission_action_ID": 1, "depth": 50,
"range_to_go": 0.3, "gps_source": "internal",
"speed_over_ground": 0.3, "latitude": 178.2,
"water_current_velocity": 0.3, "latitude_type": "string",
"thrust_applied": 0.3, "longitude": -10.122,
"health_status": "Warning", "longitude_type": "string"
"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
} }
} ],
} "health_status": "Warning",
\ No newline at end of file "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 @@ ...@@ -3,12 +3,14 @@
receipt of message. receipt of message.
""" """
acknowledgement_schema = { acknowledgement_schema = {
"allOf": [{"$ref": "#/components/schemas/Message"}],
"type": "object",
"properties": { "properties": {
"message_ID": { "acknowledged_message_ID": {
"type": "string", "type": "string",
"description": "Identifier of message received and executed with " "description": "Identifier of message received and executed with "
+ "success for mission plans sent by the Autonomy Engine.", + "success for mission plans sent by the Autonomy Engine.",
"example": "b427003c-7bc8-11ed-a1eb-0242ac999999", "example": "02125022255-7bc8-11ed-a1eb-0242ac999999",
}, },
"status": { "status": {
"type": "string", "type": "string",
...@@ -18,7 +20,7 @@ acknowledgement_schema = { ...@@ -18,7 +20,7 @@ acknowledgement_schema = {
"example": "executed by platform", "example": "executed by platform",
}, },
}, },
"required": ["message_ID", "status"], "required": ["acknowledged_message_ID", "status"],
} }
# acknowledgement_schema = api.model( # acknowledgement_schema = api.model(
......
...@@ -13,7 +13,7 @@ message_wrapper_schema = { ...@@ -13,7 +13,7 @@ message_wrapper_schema = {
"message_ID": { "message_ID": {
"type": "string", "type": "string",
"description": "An identifier for the type of " + "message received.", "description": "An identifier for the type of " + "message received.",
"example": "PlatformStatus", "example": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
}, },
"timestamp": { "timestamp": {
"type": "date-time", "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 . import full_message_schema, api
# from flask_restx import fields # from flask_restx import fields
......
...@@ -7,6 +7,7 @@ from formats.mission_plan import mission_plan_schema ...@@ -7,6 +7,7 @@ from formats.mission_plan import mission_plan_schema
from formats.observation import observation_schema from formats.observation import observation_schema
from formats.planning_configuration import planning_configuration_schema from formats.planning_configuration import planning_configuration_schema
from formats.platform_status import platform_status_message_schema from formats.platform_status import platform_status_message_schema
from formats.acknowledgement import acknowledgement_schema
app = Flask(__name__) app = Flask(__name__)
...@@ -35,6 +36,7 @@ swagger_config = { ...@@ -35,6 +36,7 @@ swagger_config = {
"Observation": observation_schema, "Observation": observation_schema,
"PlanningConfiguration": planning_configuration_schema, "PlanningConfiguration": planning_configuration_schema,
"PlatformStatus": platform_status_message_schema, "PlatformStatus": platform_status_message_schema,
"Acknowledgement": acknowledgement_schema,
}, },
}, },
"paths": { "paths": {
...@@ -50,7 +52,7 @@ swagger_config = { ...@@ -50,7 +52,7 @@ swagger_config = {
"oneOf": [ "oneOf": [
{ {
"$ref": "#/components/" "$ref": "#/components/"
+ "schemas/Coordinate" + "schemas/Acknowledgement"
}, },
{ {
"$ref": "#/components/" "$ref": "#/components/"
......
...@@ -42,3 +42,10 @@ Squad of Adaptive Robots Project ...@@ -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 (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) | planning configuration | GUI | Autonomy Engine | Yes | No | N/A |
| NOC (GUI) | emergency | GUI | TBD | TBD | TBD | TBD | | 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