Commit fd3f162a authored by Trishna Saeharaseelan's avatar Trishna Saeharaseelan
Browse files

Merge branch '7-message-formats-initial' into 'master'

Create initial message schemas

See merge request !2
parents defa0678 28857644
import os
__all__ = [
os.path.splitext(os.path.basename(x))[0]
for x in os.listdir(os.path.dirname(__file__))
if x.endswith(".py") and x != "__init__.py"
]
message_header = {
"type": "object",
"discriminator": {
"propertyName": "message_type",
},
"properties": {
"message_ID": {
"type": "string",
"description": "An identifier for the type of message received.",
"example": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "Timestamp of message",
"example": "2022-11-16T00:00:00Z",
},
"version": {
"type": "number",
"format": "float",
"description": "Version of comms backbone message format protocol",
"example": 2.0,
},
"source": {
"type": "string",
"description": "The sender; Where is this message from",
"example": "autonomy_engine",
},
"destination": {
"type": "string",
"description": "Publisher topic; What is the destination"
+ " of this message",
"example": "ah1",
},
"encoded": {
"type": "boolean",
"description": "Indicate that message raw (encoded) or decoded. "
+ "Options: encoded=True, decoded=False",
"example": False,
},
"delivery_type": {
"type": "string",
"description": "To publish or broadcast this message.",
"enum": ["broadcast", "publish"],
"example": "publish",
"default": "publish",
},
},
}
"""
schemas: Acknowledgement status sent by the surface platform to report
receipt of message.
"""
acknowledgement_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"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",
},
"status": {
"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",
},
},
"required": ["message_type", "acknowledged_message_ID", "status"],
}
"""
schemas: Mission plan (un-compiled) generated by the Autonomy Engine
sent to the respective platform's C2 to compile into a platform-specific
mission plan.
"""
action_schema = {
"type": "object",
"properties": {
"action": {
"type": "string",
"description": "Autonomy Engine's action from `move`, `payload`,"
+ " `dive`, `send_hits`, `scanline`, `scanpoint`.",
"example": "move",
},
"flight_style": {
"type": "string",
"description": "Platform-specific modes/flight styles to perform"
+ " next action",
"example": "orbit",
},
"latitude_waypoint": {
"type": "number",
"format": "float",
"description": "Next waypoint, x-coordinate",
"example": -4.187143188645706,
},
"longitude_waypoint": {
"type": "number",
"format": "float",
"description": "Next waypoint, y-coordinate",
"example": 50.37072283932642,
},
"altitude": {
"type": "number",
"format": "float",
"description": "Altitude of next action",
"example": 15.0,
},
"depth": {
"type": "number",
"format": "float",
"description": "Depth of next action",
"example": 15.0,
},
"activate_payload": {
"type": "boolean",
"description": "To activate/deactivate sensor for Autosub "
+ "Hover-1 --> `MBES` sensor and for EcoSUB --> `Sidescan`",
"example": True,
},
"send_environmental_data": {
"type": "boolean",
"description": "To trigger the platform to send list of"
+ " observations if any found",
"example": False,
},
},
"required": [
"latitude_waypoint",
"longitude_waypoint",
],
}
mission_plan_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"description": "Type of message",
"example": "mission_plan",
},
"autonomy_engine_plan_ID": {
"type": "integer",
"description": "Unique identifier for this plan"
+ "generated by the Autonomy Engine",
"example": 3,
},
"platform_ID": {
"type": "string",
"description": "Unique identifier for this platform",
"example": "reav-x-1",
},
"plan": {
"type": "array",
"items": action_schema,
},
},
"required": [
"message_type",
"autonomy_engine_plan_ID",
"platform_ID",
"plan",
],
}
"""
schema: Observation Message sent by platforms when points of
interest are found.
"""
hits_schema = {
"type": "object",
"properties": {
"latitude": {
"type": "number",
"format": "float",
"description": "Identified x-coordinate of point of interest",
"example": 178.2,
},
"longitude": {
"type": "number",
"format": "float",
"description": "Identified y-coordinate of point of interest",
"example": -10.122,
},
"quality_of_point": {
"type": "number",
"format": "float",
"description": "Quality/strength of points from features of"
+ " interest identified by platform.", # TODO: DEFINE FORMAT.
"example": 0.98,
},
},
"required": ["latitude", "longitude"],
}
observation_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"description": "Type of message",
"example": "observation",
},
"platform_ID": {
"type": "string",
"description": "Unique identifier for this platform",
"example": "reav-x-1",
},
"points_of_interest": {
"type": "array",
"items": hits_schema,
"description": "Points from features of interest identified by"
+ " platform if any found.", # TODO: DEFINE FORMAT.
},
"region_surveyed": {
"nullable": True,
"description": "Region surveyed by given platform."
+ " GEOJSON", # TODO: DEFINE FORMAT.
"example": "",
},
"additional_data": {
"description": "Placeholder field for any additional data",
"example": {"sensor_payload": False},
},
},
"required": ["message_type", "platform_ID"],
}
"""
schemas: configuration sent to Autonomy Engine (i.e. during an emergency,
if a platform needs to be removed from the mission planning)
"""
emergency_schema = {
"type": "object",
"properties": {
"safe_command": {
"type": "string",
"enum": ["go_home", "abort_now", "stop_mission"],
"description": "Command/Action that is native to respective"
+ " partner's platform/C2",
"example": "go_home",
},
"latitude_waypoint": {
"type": "number",
"format": "float",
"description": "X-coordinate safe place for respective platform",
"example": -7.432,
},
"longitude_waypoint": {
"type": "number",
"format": "float",
"description": "Y-coordinate safe place for respective platform",
"example": 50.365,
},
"target_depth": {
"type": "number",
"format": "float",
"description": "Z-coordinate safe place for respective platform"
+ " . If platform to NOT stay at depth, key in `0.0`",
"example": 10,
},
"additional_data": {
"description": "Any addition fields/data to be added here",
"example": {},
},
},
"required": ["latitude_waypoint", "longitude_waypoint", "target_depth"],
}
platform_schema = {
"type": "object",
"properties": {
"platform_ID": {
"type": "string",
"description": "Unique identifier for this platform",
"example": "reav-x-1",
},
"serial": {
"type": "string",
"description": "platform serial number",
"example": "reav-60",
},
"model": {
"type": "string",
"example": "reav",
},
"emergency": emergency_schema,
"min_altitude": {
"type": "number",
"format": "float",
"description": "Minimum altitude set for squad.",
"example": 15.2,
},
"min_velocity": {
"type": "number",
"format": "float",
"description": "Minimum velocity set for squad.",
"example": 0.1,
},
"max_velocity": {
"type": "number",
"format": "float",
"description": "Maximum altitude set for squad.",
"example": 0.9,
},
"additional_specs": {
"description": "Any addition fields/data to be added here",
"example": {"swath_width": 10.0, "scan_type": "DVL"},
},
},
"required": [
"platform_ID",
"serial",
"model",
"emergency",
"min_altitude",
"min_velocity",
"max_velocity",
],
}
region_schema = {
"type": "object",
"properties": {
"geometry_coordinates": {
"type": "array", # TODO: Check if config defn is right.
"example": [
[
[-4.187143188645706, 50.37072283932642],
[-4.202697005964865, 50.368816892405874],
[-4.203156724702808, 50.365640144076906],
[-4.19449868846155, 50.362267670845654],
]
],
},
},
"description": "Using GEOJSON, exact 4-point region (rectangle shaped)",
}
squad_metadata_schema = {
"type": "object",
"properties": {
"squad_ID": {
"type": "integer",
"description": "Identifier of given squad",
"example": 23,
},
"no_of_platforms": {
"type": "integer",
"description": "Number of platforms",
"example": 3,
},
"platforms": {
"type": "array",
"items": platform_schema,
"description": "Squad consists of these platforms",
},
"squad_mission_type": {
"type": "string",
"enum": ["tracking", "survey", "inspection"],
"description": "Mission of given squad: `tracking`, `survey`"
+ ", `inspection`",
"example": "survey",
},
"squad_state": {
"type": "string",
"description": "In execution, Waiting.. <define further>",
"example": False,
},
"region_of_interest": region_schema,
},
"required": [
"squad_ID",
"no_of_platforms",
"platforms",
"squad_mission_type",
"squad_state",
],
}
planning_configuration_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"description": "Type of message",
"example": "planning_configuration",
},
"planning_config_ID": {
"type": "integer",
"description": "Unique identifier tagged to version of this"
+ " configuration plan",
"example": 3,
},
"exclusion_zones": {
"type": "array",
"items": region_schema,
"description": "Exclusion zones for all platforms",
},
"squads": {
"type": "array",
"items": squad_metadata_schema,
},
},
"required": [
"message_type",
"planning_config_ID",
"squads",
"exclusion_zones",
],
}
"""
schema: platform-specific decoded status message
"""
sensor_schema = {
"type": "object",
"description": "Scanning sensor on platform available"
+ " to be controlled by the Autonomy Engine",
"properties": {
"sensor_serial": {
"type": "string",
"description": "serial number of sensor",
"example": "mbes-002a",
},
"sensor_on": {
"type": "boolean",
"description": "Sensor switched on (True) or off (False)",
"example": True,
},
"additional_data": {
"description": "Any addition fields/data to be added here",
"example": {"payload": [1.2, 434]},
},
},
}
platform_status_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"description": "Type of message",
"example": "platform_status",
},
"platform_ID": {
"type": "string",
"description": "Unique identifier for this platform",
"example": "reav-x-1",
},
"status_source": {
"type": "string",
"enum": ["usbl", "onboard_platform"],
"description": "Indicate if this status message is from the"
+ " platform or USBL",
"example": "usbl",
},
"transmission_mode": {
"type": "string",
"enum": ["acoustics", "iridium", "wifi", "starlink"],
"description": "Mode in which status message was transmitted"
+ " when on the surface (e.g. iridium/wifi) or underwater"
+ " (e.g. acoustics)",
"example": "wifi",
},
"platform_timestamp": {
"type": "string",
"format": "date-time",
"description": "Timestamp for onboard platform status message",
"example": "2022-12-21T00:00:00Z",
},
"platform_state": {
"type": "string",
"description": "Current state executed by platform. E.g. "
+ "STOP, IDLE, ABORT.",
"example": "ABORT",
}, # TODO: Define enum with potential STATES of each platform
"autonomy_engine_plan_ID": {
"type": "integer",
"description": "Last mission plan ID (according to Autonomy"
+ " Engine's mission plan number sent) executed by platform",
"example": 1,
},
"latitude": {
"type": "number",
"format": "float",
"description": "Latitude in decimal degrees.",
"example": 178.2,
},
"longitude": {
"type": "number",
"format": "float",
"description": "Longitude in decimal degrees.",
"example": -10.122,
},
"depth": {
"type": "number",
"format": "float",
"description": "Target depth in metres",
"example": 50,
"default": 0,
},
"altitude": {
"type": "number",
"format": "float",
"description": "Target altitude in metres",
"example": 20,
},
"mission_track_ID": {
"type": "integer",
"description": "Track number - stage in mission (e.g. "
+ "4 --> Waypoint 3 to Waypoint 4)",
"example": 4,
},
"mission_action_ID": {
"type": "integer",
"description": "", # TODO: Add description
"example": 1,
},
"range_to_go": {
"type": "number",
"format": "float",
"description": "Estimated distance to reach next waypoint",
"example": 124.3,
},
"speed_over_ground": {
"type": "number",
"format": "float",
"description": "", # TODO: Add description
"example": 124.3,
},
"water_current_velocity": {
"type": "number",
"format": "float",
"description": "", # TODO: Add description
"example": 124.3,
},
"thrust_applied": {
"type": "number",
"format": "float",
"description": "", # TODO: Add description
"example": 124.3,
},
"heading": {
"type": "number",
"format": "float",
"description": "Angular distance relative to north, usually 000°"
+ " at north, clockwise through 359°, in degrees",
"example": 124.3,
},
"health_status": {
"type": "string",
"description": "Health status extracted by respective platform "
+ "if any diagnosis is available to check sensors",
"example": "Warning",
},
"localisation_error": {
"type": "number",
"format": "float",
"description": "Localisation error at last USBL update.",
"example": 0.000129,
},
"usbl_fix_seconds_ago": {
"type": "number",
"format": "float",
"description": "USBL Fix received x second ago.",
"example": 10.0,
},
"battery_remaining_capacity": {
"type": "number",
"format": "float",
"description": "Battery remaining % provided by respective C2",
"example": 80.2,
},
"current_pitch": {
"type": "number",
"format": "float",
"description": "Current pitch of platform",
"example": -4.0,
},
"sensor_config": sensor_schema,
},
"required": [
"message_type",
"platform_ID",
"status_source",
"platform_timestamp",
"latitude",
"longitude",
],
}
from formats import message_header
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_schema
from formats.acknowledgement import acknowledgement_schema
from flasgger import Swagger
from flask import Flask
app = Flask(__name__)
swagger_config = {
"openapi": "3.0.2",
"swagger_ui": True,
"specs_route": "/",
"info": {
"title": "SoAR Backbone Message Formats",
"version": "1.0",
"description": "SoAR message protocol in schemas",
},
"specs": [
{
"endpoint": "swagger",
"route": "/soar_protocol.json",
}
],
"paths": {},
"components": {
"schemas": {
"MESSAGE": {
"type": "object",
"description": "Full message definition with"
+ " message-metadata in `header` and different"
+ " message type schemas under `payload`",
"properties": {
"header": {
"$ref": "#/components/schemas/header",
},
"payload": {"$ref": "#/components/schemas/payload"},
},
"required": ["header", "payload"],
},
"payload": {
"discriminator": {
"propertyName": "message_type",
"mapping": {
"mission_plan": "#/components/schemas/mission_plan",
"observation": "#/components/schemas/observation",
"planning_configuration": "#/components/schemas/"
+ "planning_configuration",
"platform_status": "#/components/schemas/platform_status",
"acknowledgement": "#/components/schemas/acknowledgement",
},
},
"oneOf": [
{"$ref": "#/components/schemas/acknowledgement"},
{"$ref": "#/components/schemas/mission_plan"},
{"$ref": "#/components/schemas/observation"},
{"$ref": "#/components/schemas/planning_configuration"},
{"$ref": "#/components/schemas/platform_status"},
],
},
"header": message_header,
"mission_plan": mission_plan_schema,
"observation": observation_schema,
"planning_configuration": planning_configuration_schema,
"platform_status": platform_status_schema,
"acknowledgement": acknowledgement_schema,
}
},
}
swag = Swagger(app, config=swagger_config, merge=True)
if __name__ == "__main__":
app.run(debug=True)
# SoAR Project
Squad of Adaptive Robots Project
-----------------------------------
## Message Data Flow Summary
| Partner | Message Type | Source | Destination | Via Comms Backbone? | Contains Serialized Vehicle-Specific File? | Comment |
| --------------------- | ------------------------ | --------------------- | ------------------------------------------ | ------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------- |
| Hydrosurv (reav) | platform status-compiled | Reav-60 | Hydrosurv Adapter | No | Yes | N/A |
| Hydrosurv (reav) | platform status | Hydrosurv Adapter | Autonomy Engine | Yes | No | N/A |
| Hydrosurv (reav) | mission plan | Autonomy Engine | Hydrosurv Adapter | Yes | No | N/A |
| Hydrosurv (reav) | mission plan-compiled | Hydrosurv Adapter | Reav-60 | No | Yes | N/A |
| Hydrosurv (reav) | acknowledgement | Hydrosurv Adapter | Comms Backbone (Audit) | Yes | No | When hydrosurv adapter has (a) Received, (b) Sent Plan to Reav, and (c) Executed by Reav |
| RHU (autonomy engine) | platform status | C2’s Hydrosurv/Ecosub | Autonomy Engine | Yes | No | N/A |
| RHU (autonomy engine) | mission plan | Autonomy Engine | C2’s Hydrosurv/Ecosub | Yes | No | N/A |
| RHU (autonomy engine) | planning configuration | GUI | Autonomy Engine | Yes | No | N/A |
| RHU (autonomy engine) | observation | Ecosub C2 | Autonomy Engine | Yes | No | N/A |
| RHU (autonomy engine) | survey progress | Ecosub/AH1 C2 | Autonomy Engine | TBD | TBD | N/A |
| RHU (autonomy engine) | scanline | TBD | TBD | TBD | TBD | N/A |
| RHU (autonomy engine) | emergency | GUI | TBD – all | TBD | TBD | TBD – all platforms pre-compiled ABORT via Black box |
| Planet Ocean (ecosub) | platform status-compiled | Ecosub | Black Box TBC | No | Yes | Via Hermes + Router |
| Planet Ocean (ecosub) | platform status-compiled | Black Box TBC | Ecosub C2 | Yes | Yes | N/A |
| Planet Ocean (ecosub) | platform status | Ecosub C2 | Autonomy Engine | Yes | No | N/A |
| Planet Ocean (ecosub) | mission plan | Autonomy Engine | Ecosub C2 | Yes | No | N/A |
| Planet Ocean (ecosub) | mission plan | Ecosub C2 | Black Box TBC | Yes | Yes | N/A |
| Planet Ocean (ecosub) | mission plan-compiled | Black Box TBC | Ecosub | No | Yes | Via Hermes + Router |
| Planet Ocean (ecosub) | observation-compiled | Ecosub | Black Box TBC | No | Yes | Via Hermes + Router |
| Planet Ocean (ecosub) | observation-compiled | Black Box TBC | Ecosub C2 | Yes | Yes | N/A |
| Planet Ocean (ecosub) | observation | Ecosub C2 | Autonomy Engine | Yes | No | N/A |
| Planet Ocean (ecosub) | survey progress | TBD | TBD | TBD | TBD | N/A |
| Planet Ocean (ecosub) | survey progress | TBD | TBD | TBD | TBD | N/A |
| Planet Ocean (ecosub) | scanline | TBD | TBD | TBD | TBD | N/A |
| Planet Ocean (ecosub) | scanline | TBD | TBD | TBD | TBD | N/A |
| Planet Ocean (ecosub) | emergency | GUI | TBD – Ecosub (ABORT command via Black Box) | TBD | TBD | TBD – all platforms pre-compiled ABORT via Black box |
| NOC (AH1) | platform status-compiled | AH1 | Black Box TBC | No | Yes | Via Hermes + Router |
| NOC (AH1) | platform status-compiled | Black Box TBC | NOC C2 | Yes | Yes | N/A |
| NOC (AH1) | platform status | NOC C2 | Autonomy Engine | Yes | No | N/A |
| NOC (AH1) | scan point | Autonomy Engine | NOC C2 | Yes | No | N/A |
| NOC (AH1) | scan point-compiled | NOC C2 | Black Box TBC | Yes | Yes | Would this technically be a mission plan-compiled? |
| NOC (AH1) | scan point | Black Box TBC | Ecosub | No | Yes | Via Hermes + Router |
| NOC (AH1) | survey progress | TBD | TBD | TBD | TBD | TBD |
| NOC (AH1) | survey progress | TBD | TBD | TBD | TBD | TBD |
| 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/`
This diff is collapsed.
Flask
flask-restx
flasgger
flask-marshmallow
openapi-schema-validator==0.4.1
openapi-spec-validator==0.5.2
\ No newline at end of file
import os
__all__ = [
os.path.splitext(os.path.basename(x))[0]
for x in os.listdir(os.path.dirname(__file__))
if x.endswith(".py") and x != "__init__.py"
]
import os
__all__ = [
os.path.splitext(os.path.basename(x))[0]
for x in os.listdir(os.path.dirname(__file__))
if x.endswith(".py") and x != "__init__.py"
]
message_header = {
"type": "object",
"discriminator": {
"propertyName": "message_type",
},
"properties": {
"message_ID": {
"type": "string",
"description": "An identifier for the type of message received.",
"example": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "Timestamp of message",
"example": "2022-11-16T00:00:00Z",
},
"version": {
"type": "number",
"format": "float",
"description": "Version of comms backbone message format protocol",
"example": 2.0,
},
"source": {
"type": "string",
"description": "The sender; Where is this message from",
"example": "autonomy_engine",
},
"destination": {
"type": "string",
"description": "Publisher topic; What is the destination"
+ " of this message",
"example": "ah1",
},
"encoded": {
"type": "boolean",
"description": "Indicate that message raw (encoded) or decoded. "
+ "Options: encoded=True, decoded=False",
"example": False,
},
"delivery_type": {
"type": "string",
"description": "To publish or broadcast this message.",
"enum": ["broadcast", "publish"],
"example": "publish",
"default": "publish",
},
},
}
acknowledgement_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"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",
},
"status": {
"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",
},
},
"required": ["message_type", "acknowledged_message_ID", "status"],
}
action_schema = {
"type": "object",
"properties": {
"action": {
"type": "string",
"description": "Autonomy Engine's action from `move`, `payload`,"
+ " `dive`, `send_hits`, `scanline`, `scanpoint`.",
"example": "move",
},
"flight_style": {
"type": "string",
"description": "Platform-specific modes/flight styles to perform"
+ " next action",
"example": "orbit",
},
"latitude_waypoint": {
"type": "number",
"format": "float",
"description": "Next waypoint, x-coordinate",
"example": -4.187143188645706,
},
"longitude_waypoint": {
"type": "number",
"format": "float",
"description": "Next waypoint, y-coordinate",
"example": 50.37072283932642,
},
"altitude": {
"type": "number",
"format": "float",
"description": "Altitude of next action",
"example": 15.0,
},
"depth": {
"type": "number",
"format": "float",
"description": "Depth of next action",
"example": 15.0,
},
"activate_payload": {
"type": "boolean",
"description": "To activate/deactivate sensor for Autosub "
+ "Hover-1 --> `MBES` sensor and for EcoSUB --> `Sidescan`",
"example": True,
},
"send_environmental_data": {
"type": "boolean",
"description": "To trigger the platform to send list of"
+ " observations if any found",
"example": False,
},
},
"required": [
"latitude_waypoint",
"longitude_waypoint",
],
}
mission_plan_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"description": "Type of message",
"example": "mission_plan",
},
"autonomy_engine_plan_ID": {
"type": "integer",
"description": "Unique identifier for this plan"
+ "generated by the Autonomy Engine",
"example": 3,
},
"platform_ID": {
"type": "string",
"description": "Unique identifier for this platform",
"example": "reav-x-1",
},
"plan": {
"type": "array",
"items": action_schema,
},
},
"required": [
"message_type",
"autonomy_engine_plan_ID",
"platform_ID",
"plan",
],
}
hits_schema = {
"type": "object",
"properties": {
"latitude": {
"type": "number",
"format": "float",
"description": "Identified x-coordinate of point of interest",
"example": 178.2,
},
"longitude": {
"type": "number",
"format": "float",
"description": "Identified y-coordinate of point of interest",
"example": -10.122,
},
"quality_of_point": {
"type": "number",
"format": "float",
"description": "Quality/strength of points from features of"
+ " interest identified by platform.", # TODO: DEFINE FORMAT.
"example": 0.98,
},
},
"required": ["latitude", "longitude"],
}
observation_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"description": "Type of message",
"example": "observation",
},
"platform_ID": {
"type": "string",
"description": "Unique identifier for this platform",
"example": "reav-x-1",
},
"points_of_interest": {
"type": "array",
"items": hits_schema,
"description": "Points from features of interest identified by"
+ " platform if any found.", # TODO: DEFINE FORMAT.
},
"region_surveyed": {
"nullable": True,
"description": "Region surveyed by given platform."
+ " GEOJSON", # TODO: DEFINE FORMAT.
"example": "",
},
"additional_data": {
"description": "Placeholder field for any additional data",
"example": {"sensor_payload": False},
},
},
"required": ["message_type", "platform_ID"],
}
emergency_schema = {
"type": "object",
"properties": {
"safe_command": {
"type": "string",
"enum": ["go_home", "abort_now", "stop_mission"],
"description": "Command/Action that is native to respective"
+ " partner's platform/C2",
"example": "go_home",
},
"latitude_waypoint": {
"type": "number",
"format": "float",
"description": "X-coordinate safe place for respective platform",
"example": -7.432,
},
"longitude_waypoint": {
"type": "number",
"format": "float",
"description": "Y-coordinate safe place for respective platform",
"example": 50.365,
},
"target_depth": {
"type": "number",
"format": "float",
"description": "Z-coordinate safe place for respective platform"
+ " . If platform to NOT stay at depth, key in `0.0`",
"example": 10,
},
"additional_data": {
"description": "Any addition fields/data to be added here",
"example": {},
},
},
"required": ["latitude_waypoint", "longitude_waypoint", "target_depth"],
}
platform_schema = {
"type": "object",
"properties": {
"platform_ID": {
"type": "string",
"description": "Unique identifier for this platform",
"example": "reav-x-1",
},
"serial": {
"type": "string",
"description": "platform serial number",
"example": "reav-60",
},
"model": {
"type": "string",
"example": "reav",
},
"emergency": emergency_schema,
"min_altitude": {
"type": "number",
"format": "float",
"description": "Minimum altitude set for squad.",
"example": 15.2,
},
"min_velocity": {
"type": "number",
"format": "float",
"description": "Minimum velocity set for squad.",
"example": 0.1,
},
"max_velocity": {
"type": "number",
"format": "float",
"description": "Maximum altitude set for squad.",
"example": 0.9,
},
"additional_specs": {
"description": "Any addition fields/data to be added here",
"example": {"swath_width": 10.0, "scan_type": "DVL"},
},
},
"required": [
"platform_ID",
"serial",
"model",
"emergency",
"min_altitude",
"min_velocity",
"max_velocity",
],
}
region_schema = {
"type": "object",
"properties": {
"geometry_coordinates": {
"type": "array", # TODO: Check if config defn is right.
"example": [
[
[-4.187143188645706, 50.37072283932642],
[-4.202697005964865, 50.368816892405874],
[-4.203156724702808, 50.365640144076906],
[-4.19449868846155, 50.362267670845654],
]
],
},
},
"description": "Using GEOJSON, exact 4-point region (rectangle shaped)",
}
squad_metadata_schema = {
"type": "object",
"properties": {
"squad_ID": {
"type": "integer",
"description": "Identifier of given squad",
"example": 23,
},
"no_of_platforms": {
"type": "integer",
"description": "Number of platforms",
"example": 3,
},
"platforms": {
"type": "array",
"items": platform_schema,
"description": "Squad consists of these platforms",
},
"squad_mission_type": {
"type": "string",
"enum": ["tracking", "survey", "inspection"],
"description": "Mission of given squad: `tracking`, `survey`"
+ ", `inspection`",
"example": "survey",
},
"squad_state": {
"type": "string",
"description": "In execution, Waiting.. <define further>",
"example": False,
},
"region_of_interest": region_schema,
},
"required": [
"squad_ID",
"no_of_platforms",
"platforms",
"squad_mission_type",
"squad_state",
],
}
planning_configuration_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"description": "Type of message",
"example": "planning_configuration",
},
"planning_config_ID": {
"type": "integer",
"description": "Unique identifier tagged to version of this"
+ " configuration plan",
"example": 3,
},
"exclusion_zones": {
"type": "array",
"items": region_schema,
"description": "Exclusion zones for all platforms",
},
"squads": {
"type": "array",
"items": squad_metadata_schema,
},
},
"required": [
"message_type",
"planning_config_ID",
"squads",
"exclusion_zones",
],
}
sensor_schema = {
"type": "object",
"description": "Scanning sensor on platform available"
+ " to be controlled by the Autonomy Engine",
"properties": {
"sensor_serial": {
"type": "string",
"description": "serial number of sensor",
"example": "mbes-002a",
},
"sensor_on": {
"type": "boolean",
"description": "Sensor switched on (True) or off (False)",
"example": True,
},
"additional_data": {
"description": "Any addition fields/data to be added here",
"example": {"payload": [1.2, 434]},
},
},
}
platform_status_schema = {
"type": "object",
"properties": {
"message_type": {
"type": "string",
"description": "Type of message",
"example": "platform_status",
},
"platform_ID": {
"type": "string",
"description": "Unique identifier for this platform",
"example": "reav-x-1",
},
"status_source": {
"type": "string",
"enum": ["usbl", "onboard_platform"],
"description": "Indicate if this status message is from the"
+ " platform or USBL",
"example": "usbl",
},
"transmission_mode": {
"type": "string",
"enum": ["acoustics", "iridium", "wifi", "starlink"],
"description": "Mode in which status message was transmitted"
+ " when on the surface (e.g. iridium/wifi) or underwater"
+ " (e.g. acoustics)",
"example": "wifi",
},
"platform_timestamp": {
"type": "string",
"format": "date-time",
"description": "Timestamp for onboard platform status message",
"example": "2022-12-21T00:00:00Z",
},
"platform_state": {
"type": "string",
"description": "Current state executed by platform. E.g. "
+ "STOP, IDLE, ABORT.",
"example": "ABORT",
},
"autonomy_engine_plan_ID": {
"type": "integer",
"description": "Last mission plan ID (according to Autonomy"
+ " Engine's mission plan number sent) executed by platform",
"example": 1,
},
"latitude": {
"type": "number",
"format": "float",
"description": "Latitude in decimal degrees.",
"example": 178.2,
},
"longitude": {
"type": "number",
"format": "float",
"description": "Longitude in decimal degrees.",
"example": -10.122,
},
"depth": {
"type": "number",
"format": "float",
"description": "Target depth in metres",
"example": 50,
"default": 0,
},
"altitude": {
"type": "number",
"format": "float",
"description": "Target altitude in metres",
"example": 20,
},
"mission_track_ID": {
"type": "integer",
"description": "Track number - stage in mission (e.g. "
+ "4 --> Waypoint 3 to Waypoint 4)",
"example": 4,
},
"mission_action_ID": {
"type": "integer",
"description": "", # TODO: Add description
"example": 1,
},
"range_to_go": {
"type": "number",
"format": "float",
"description": "Estimated distance to reach next waypoint",
"example": 124.3,
},
"speed_over_ground": {
"type": "number",
"format": "float",
"description": "", # TODO: Add description
"example": 124.3,
},
"water_current_velocity": {
"type": "number",
"format": "float",
"description": "", # TODO: Add description
"example": 124.3,
},
"thrust_applied": {
"type": "number",
"format": "float",
"description": "", # TODO: Add description
"example": 124.3,
},
"heading": {
"type": "number",
"format": "float",
"description": "Angular distance relative to north, usually 000°"
+ " at north, clockwise through 359°, in degrees",
"example": 124.3,
},
"health_status": {
"type": "string",
"description": "Health status extracted by respective platform "
+ "if any diagnosis is available to check sensors",
"example": "Warning",
},
"localisation_error": {
"type": "number",
"format": "float",
"description": "Localisation error at last USBL update.",
"example": 0.000129,
},
"usbl_fix_seconds_ago": {
"type": "number",
"format": "float",
"description": "USBL Fix received x second ago.",
"example": 10.0,
},
"battery_remaining_capacity": {
"type": "number",
"format": "float",
"description": "Battery remaining % provided by respective C2",
"example": 80.2,
},
"current_pitch": {
"type": "number",
"format": "float",
"description": "Current pitch of platform",
"example": -4.0,
},
"sensor_config": sensor_schema,
},
"required": [
"message_type",
"platform_ID",
"status_source",
"platform_timestamp",
"latitude",
"longitude",
],
}
This diff is collapsed.
{
"header":{
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 1,
"source": "hydrosurv_adapter",
"destination": "autonomy_engine",
"delivery_type": "publish",
"encoded": false
},
"payload":{
"message_type": "acknowledgement",
"acknowledged_message_ID": "11111111-7bc8-11ed-a1eb-0242ac999999",
"status": "c2_received"
}
}
\ No newline at end of file
{
"header": {
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 2,
"source": "autonomy_engine",
"destination": "noc_c2",
"delivery_type": "publish",
"encoded": false
},
"payload":{
"message_type": "mission_plan",
"platform_ID": "5-ah1",
"autonomy_engine_plan_ID": 1,
"plan": [
{
"action": "move",
"flight_style": "go to waypoint",
"latitude_waypoint": -3.237143188645706,
"longitude_waypoint": 52.37072283932642,
"depth": 0.0,
"activate_payload": false,
"send_environmental_data": false
},
{
"action": "dive",
"flight_style": "dive to depth",
"latitude_waypoint": -3.237143188645706,
"longitude_waypoint": 52.37072283932642,
"altitude": 10,
"activate_payload": false,
"send_environmental_data": false
},
{
"action": "scanline",
"flight_style": "go to waypoint",
"latitude_waypoint": -0.237143188645706,
"longitude_waypoint": 60.00000000000000,
"altitude": 10,
"activate_payload": true,
"send_environmental_data": false
},
{
"action": "climb",
"flight_style": "go to surface",
"latitude_waypoint": -0.237143188645706,
"longitude_waypoint": 52.37072283932642,
"depth": 0.0,
"activate_payload": false,
"send_environmental_data": true
}
]
}
}
\ No newline at end of file
{
"header": {
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 2,
"source": "autonomy_engine",
"destination": "ecosub_c2",
"delivery_type": "publish",
"encoded": false
},
"payload":{
"message_type": "mission_plan",
"platform_ID": "ecosub-5",
"autonomy_engine_plan_ID": 1,
"plan": [
{
"action": "move",
"flight_style": "go to waypoint",
"latitude_waypoint": -3.237143188645706,
"longitude_waypoint": 52.37072283932642,
"depth": 0.0,
"activate_payload": false,
"send_environmental_data": false
},
{
"action": "dive",
"flight_style": "dive to depth",
"latitude_waypoint": -3.237143188645706,
"longitude_waypoint": 52.37072283932642,
"altitude": 10,
"activate_payload": false,
"send_environmental_data": false
},
{
"action": "scanline",
"flight_style": "go to waypoint",
"latitude_waypoint": -0.237143188645706,
"longitude_waypoint": 60.00000000000000,
"altitude": 10,
"activate_payload": true,
"send_environmental_data": false
},
{
"action": "climb",
"flight_style": "go to surface",
"latitude_waypoint": -0.237143188645706,
"longitude_waypoint": 52.37072283932642,
"depth": 0,
"activate_payload": false,
"send_environmental_data": true
}
]
}
}
\ No newline at end of file
{
"header":{
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 2,
"source": "autonomy_engine",
"destination": "hydrosurv_adapter",
"delivery_type": "publish",
"encoded": false
},
"payload":{
"message_type": "mission_plan",
"platform_ID": "reav-60-1",
"autonomy_engine_plan_ID": 1,
"plan": [
{
"latitude_waypoint": -4.187143188645706,
"longitude_waypoint": 50.37072283932642
},
{
"latitude_waypoint": -3.187143188645706,
"longitude_waypoint": 51.37072283932642
},
{
"latitude_waypoint": -3.237143188645706,
"longitude_waypoint": 52.37072283932642
}
]
}
}
\ No newline at end of file
{
"header":{
"message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd",
"timestamp": "2022-11-16T00:00:00Z",
"version": 2,
"source": "ecosub_c2",
"destination": "autonomy_engine",
"delivery_type": "publish",
"encoded": false
},
"payload":{
"message_type": "platform_status",
"planning_config_ID": 3,
"exclusion_zones": [
{
"geometry_coordinates": [
[
[
-4.187143188645706,
50.37072283932642
],
[
-4.202697005964865,
50.368816892405874
],
[
-4.203156724702808,
50.365640144076906
],
[
-4.19449868846155,
50.362267670845654
]
]
]
}
],
"squads": [
{
"squad_ID": 1,
"no_of_platforms": 1,
"squad_mission_type": "tracking",
"squad_state": "active",
"platforms": [
{
"model": "reav",
"platform_ID": "reav-60-1",
"serial": "reav-60",
"emergency": {
"additional_data": {},
"latitude_waypoint": -7.432,
"longitude_waypoint": 50.365,
"safe_command": "go_home",
"target_depth": 10
},
"max_velocity": 0.9,
"min_altitude": 15.2,
"min_velocity": 0.1,
"additional_data": {}
}
],
"region_of_interest": {
"geometry_coordinates": [
[
[
-4.187143188645706,
50.37072283932642
],
[
-4.202697005964865,
50.368816892405874
],
[
-4.203156724702808,
50.365640144076906
],
[
-4.19449868846155,
50.362267670845654
]
]
]
}
},
{
"squad_ID": 2,
"no_of_platforms": 3,
"squad_mission_type": "survey",
"squad_state": "active",
"platforms": [
{
"platform_ID": "ecosub-1",
"serial": "ecosub-2",
"model": "ecosub",
"emergency": {
"additional_data": {},
"latitude_waypoint": -7.432,
"longitude_waypoint": 50.365,
"safe_command": "go_home",
"target_depth": 10.0
},
"max_velocity": 0.9,
"min_altitude": 15.2,
"min_velocity": 0.1,
"additional_data": {
"scan_type": "DVL",
"swath_width": 10
}
},
{
"platform_ID": "ecosub-2",
"serial": "ecosubxyz-5",
"model": "ecosub",
"emergency": {
"additional_data": {},
"latitude_waypoint": -0.432,
"longitude_waypoint": 20.365,
"safe_command": "go_home",
"target_depth": 0.0
},
"max_velocity": 0.9,
"min_altitude": 15.2,
"min_velocity": 0.1,
"additional_data": {
"scan_type": "DVL",
"swath_width": 10
}
}
],
"region_of_interest": {}
},
{
"squad_ID": 3,
"no_of_platforms": 1,
"squad_mission_type": "inspection",
"squad_state": "active",
"platforms": [
{
"platform_ID": "ah-1",
"serial": "autosubhover-1",
"model": "autosub",
"emergency": {
"additional_data": {},
"latitude_waypoint": 20.432,
"longitude_waypoint": 50.365,
"safe_command": "abort_now",
"target_depth": 0.0
},
"max_velocity": 0.9,
"min_altitude": 15.2,
"min_velocity": 0.1,
"additional_data": {
"scan_type": "MBES"
}
}
],
"region_of_interest": {}
}
]
}
}
\ No newline at end of file
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