platform_status.py 5.89 KB
Newer Older
1
"""
2
    schema: platform-specific decoded status message
3
"""
4

5 6
sensor_schema = {
    "type": "object",
7 8
    "description": "Scanning sensor on platform available"
    + " to be controlled by  the Autonomy Engine",
9 10 11 12 13 14
    "properties": {
        "sensor_serial": {
            "type": "string",
            "description": "serial number of sensor",
            "example": "mbes-002a",
        },
15
        "sensor_on": {
16 17 18 19 20
            "type": "boolean",
            "description": "Sensor switched on (True) or off (False)",
            "example": True,
        },
        "additional_data": {
Trishna Saeharaseelan's avatar
Trishna Saeharaseelan committed
21
            "type": "object",  # TODO: Check 000
22 23 24 25 26
            "description": "Any addition fields/data to be added here",
            "example": {"payload": [1.2, 434]},
        },
    },
}
27

28
platform_status_schema = {
29 30
    "type": "object",
    "properties": {
31 32 33 34
        "message_type": {
            "type": "string",
            "description": "Type of message",
            "example": "platform_status",
Dan Jones's avatar
Dan Jones committed
35
            "enum": ["platform_status"],
36
        },
37
        "platform_ID": {
38 39 40
            "type": "string",
            "description": "Unique identifier for this platform",
            "example": "reav-x-1",
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
        },
        "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": {
Trishna Saeharaseelan's avatar
Trishna Saeharaseelan committed
64
            "type": "string",
65 66 67
            "description": "Current state executed by platform. E.g. "
            + "STOP, IDLE, ABORT.",
            "example": "ABORT",
Trishna Saeharaseelan's avatar
Trishna Saeharaseelan committed
68
        },  # TODO: Define enum with potential STATES of each platform
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
        "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",
91 92
            "example": 50.0,
            "default": 0.0,
93 94 95 96 97
        },
        "altitude": {
            "type": "number",
            "format": "float",
            "description": "Target altitude in metres",
98
            "example": 20.0,
99 100 101 102 103 104 105
        },
        "mission_track_ID": {
            "type": "integer",
            "description": "Track number - stage in mission (e.g. "
            + "4 --> Waypoint 3 to Waypoint 4)",
            "example": 4,
        },
106
        "mission_plan_ID": {
107
            "type": "integer",
Trishna Saeharaseelan's avatar
Trishna Saeharaseelan committed
108
            "description": "Mission plan ID according to platform-C2 system",
109 110 111 112 113 114 115 116 117 118 119
            "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",
120
            "description": "Speed over ground",
121 122 123
            "example": 124.3,
        },
        "water_current_velocity": {
124 125 126
            "type": "string",
            "description": "Water current magnitude and direction",
            "example": "124.3NE",
127 128 129 130
        },
        "thrust_applied": {
            "type": "number",
            "format": "float",
131
            "description": "Thrust applied",
132 133 134 135 136 137 138 139 140 141
            "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": {
142
            "type": "boolean",
Trishna Saeharaseelan's avatar
Trishna Saeharaseelan committed
143 144
            "description": "Health status where 0 is OK, 1 is platform has"
            + " an ERROR",
145
            "example": False,
146
        },
147
        "localisation_north_error": {
148 149
            "type": "number",
            "format": "float",
Trishna Saeharaseelan's avatar
Trishna Saeharaseelan committed
150 151
            "description": "Difference in NORTH between deadreckoning"
            + " and USBL update.",
152 153 154 155 156
            "example": 0.000129,
        },
        "localisation_east_error": {
            "type": "number",
            "format": "float",
Trishna Saeharaseelan's avatar
Trishna Saeharaseelan committed
157 158
            "description": "Difference in EAST between deadreckoning"
            + "and USBL update.",
159 160 161 162 163 164 165 166 167 168 169 170 171 172
            "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,
        },
173
        "sensor_config": sensor_schema,
174
    },
175
    "required": [
176
        "message_type",
177 178 179 180 181
        "platform_ID",
        "status_source",
        "platform_timestamp",
        "latitude",
        "longitude",
182 183
    ],
}