waypoints.py 2.87 KB
Newer Older
Dan Jones's avatar
Dan Jones committed
1 2
"""
Temporary message definition to handle the MAS-DT dry-run mode 
3

Dan Jones's avatar
Dan Jones committed
4 5 6 7 8 9 10 11 12 13
In dry-run the SFMC adapter will receive misson_plan messages from ORI
These messages will be parsed and compiled into a goto file which will
not be sent on to the glider 

To confirm the message flow is working the SFMC will instead publish 
a waypoints message back to the backbone which C2 can receive and 
process - adding simulated waypoints to C2 positions 
"""

waypoint_schema = {
14 15 16
    "type": "object",
    "oneOf": [
        {
Dan Jones's avatar
Dan Jones committed
17
            "$ref": "https://geojson.org/schema/Point.json",
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
        },
        {
            "type": "object",
            "properties": {
                "latitude": {
                    "type": "number",
                    "format": "float",
                    "description": "Latitude (Y-coordinate) in decimal degrees.",
                    "example": 178.2,
                },
                "longitude": {
                    "type": "number",
                    "format": "float",
                    "description": "Longitude (X-coordinate) in decimal degrees.",
                    "example": -10.122,
                },
                "depth": {
                    "type": "number",
                    "format": "float",
                    "description": "Target depth in metres",
                    "example": 50.0,
                    "default": 0.0,
                },
                "altitude": {
                    "type": "number",
                    "format": "float",
                    "description": "Target altitude in metres",
                    "example": 20.0,
                },
            },
            "required": [
Dan Jones's avatar
Dan Jones committed
49 50
                "latitude",
                "longitude",
51 52 53
            ],
        },
    ],
Dan Jones's avatar
Dan Jones committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
}

waypoints_schema = {
    "type": "object",
    "properties": {
        "message_type": {
            "type": "string",
            "description": "Type of message",
            "example": "waypoints",
            "enum": ["waypoints"],
        },
        "platform_ID": {
            "type": "string",
            "description": "Unique identifier for this platform",
            "example": "reav-x-1",
        },
        "status_source": {
            "type": "string",
            "enum": ["onboard_platform", "simulated", "autonomy"],
            "description": "Indicate if this status message is from the"
            + " platform or USBL",
            "example": "usbl",
        },
        "platform_timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp for onboard platform status message",
            "example": "2022-12-21T00:00:00Z",
        },
        "waypoints": {
Dan Jones's avatar
Dan Jones committed
84
            "type": "array",
Dan Jones's avatar
Dan Jones committed
85
            "items": waypoint_schema,
Dan Jones's avatar
Dan Jones committed
86
        },
Dan Jones's avatar
Dan Jones committed
87
    },
88 89 90 91 92
    "required": [
        "message_type",
        "platform_ID",
        "status_source",
        "platform_timestamp",
Dan Jones's avatar
Dan Jones committed
93
        "waypoints",
94 95
    ],
}