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.. ", "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", ], }