planning_configuration.py 8.08 KB
Newer Older
1 2
"""
    schemas: configuration sent to Autonomy Engine (i.e. during an emergency,
3
    if a platform needs to be removed from the mission planning)
4 5
"""

6
emergency_schema = {
7 8
    "type": "object",
    "properties": {
9 10
        "safe_command": {
            "type": "string",
11
            "enum": ["go_home", "abort_now", "stop_now", "surface_now"],
12 13
            "description": "Command/Action that is native to respective"
            + " partner's platform/C2",
14 15
            "example": "go_home",
        },
16
        "target_waypoint_latitude": {
17
            "type": "number",
18
            "format": "float",
19 20
            "description": "Y-coordinate safe place for respective platform",
            "example": 50.365,
21
        },
22
        "target_waypoint_longitude": {
23
            "type": "number",
24
            "format": "float",
25 26
            "description": "X-coordinate safe place for respective platform",
            "example": -7.432,
27
        },
28
        "target_depth": {
29
            "type": "number",
30
            "format": "float",
31
            "description": "Z-coordinate safe place for respective platform"
32
            + " . If platform to NOT stay at depth, key in `0.0`",
33
            "example": 10.0,
34
        },
35
    },
Trishna Saeharaseelan's avatar
Trishna Saeharaseelan committed
36 37 38 39 40
    "required": [
        "target_waypoint_latitude",
        "target_waypoint_longitude",
        "target_depth",
    ],
41
}
42

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
endurance_relative_water_speed_schema = {
    "type": "object",
    "properties": {
        "min_battery_rating": {
            "type": "number",
            "format": "float",
            "description": "Battery endurance rating during maximum speed usage (m/s)",
            "example": 3.32,
        },
        "max_battery_rating": {
            "type": "number",
            "format": "float",
            "description": "Battery endurance rating during maximum speed usage (m/s)",
            "example": 1.23,
        },
        "avg_battery_rating": {
            "type": "number",
            "format": "float",
61 62 63 64
            "description": (
                "Battery endurance rating during standard operational"
                + " speed usage (m/s)"
            ),
65 66 67 68 69
            "example": 1.9,
        },
    },
}

70

71 72 73 74 75 76 77 78 79
scan_sensor_schema = {
    "type": "object",
    "properties": {
        "sensor_type": {
            "type": "string",
            "description": "Unique identifier for this platform",
            "example": "MBES",
            "enum": ["SIDESCAN", "MBES"],
        },
80 81 82 83 84 85
        "warmup_time": {
            "type": "number",
            "format": "float",
            "description": "Warmup time (seconds) for sensor to start up.",
            "example": 180.0,
        },
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
        "swath_width": {
            "type": "number",
            "format": "float",
            "description": "Function of `target_altitude` for the platform's "
            + "swath width (in metres)",
            "example": 38.0,
        },
        "frequency": {
            "type": "number",
            "format": "float",
            "description": "Frequency of scanning sensor (in kHz)",
            "example": 700.0,
        },
        "angle": {
            "type": "number",
            "format": "float",
            "description": "Angle of range of swath width (in degrees)",
            "example": 140.0,
        },
    },
}


109 110 111
platform_schema = {
    "type": "object",
    "properties": {
112 113 114 115 116
        "operator": {
            "type": "string",
            "description": "Operator of platform",
            "example": "noc",
        },
117
        "platform_ID": {
118 119 120
            "type": "string",
            "description": "Unique identifier for this platform",
            "example": "reav-x-1",
121 122 123 124 125
        },
        "model": {
            "type": "string",
            "example": "reav",
        },
126 127 128 129
        "beacon_ID": {
            "type": "number",
            "description": "Unique identifier (number) for the beacon "
            + "associated to this platform",
130
            "example": 2407,
131
        },
132 133 134 135 136
        "active": {
            "type": "boolean",
            "description": "If platform is active = True, and inactive = False",
            "example": True,
        },
137 138 139
        "emergency": emergency_schema,
        "min_altitude": {
            "type": "number",
140
            "format": "float",
141
            "description": "Minimum altitude set for platform",
142 143 144 145
            "example": 15.2,
        },
        "min_velocity": {
            "type": "number",
146
            "format": "float",
147
            "description": "Minimum velocity set for platform",
148 149 150 151
            "example": 0.1,
        },
        "max_velocity": {
            "type": "number",
152
            "format": "float",
153
            "description": "Maximum velocity set for platform",
154 155
            "example": 0.9,
        },
156 157 158
        "target_altitude": {
            "type": "number",
            "format": "float",
159
            "description": "Target altitude set for platform. This affects swath width",
160 161 162 163 164 165 166 167
            "example": 15.0,
        },
        "turning_radius": {
            "type": "number",
            "format": "float",
            "description": "Turning radius of platform (in metres)",
            "example": 1.0,
        },
168
        "endurance_relative_to_water_speed": endurance_relative_water_speed_schema,
169
        "scan_sensor": scan_sensor_schema,
170
        "additional_data": {
171
            "description": "Any addition fields/data to be added here",
172
            "example": {"new_sensor_a": "test_sensor", "range": 10.0},
173
            "type": "object",
174
        },
175
    },
176
    "required": [
177
        "operator",
178
        "platform_ID",
179
        "active",
180 181
        "model",
    ],
182 183 184 185 186 187
}

region_schema = {
    "type": "object",
    "properties": {
        "geometry_coordinates": {
188
            "type": "array",
189 190
            "example": [
                [
191 192 193 194 195
                    [-4.1777839187560915, 50.34173405662855],
                    [-4.1777839187560915, 50.33820949229701],
                    [-4.143667777943875, 50.33820949229701],
                    [-4.143667777943875, 50.34173405662855],
                    [-4.1777839187560915, 50.34173405662855],
196 197 198
                ]
            ],
        },
199
    },
200
    "description": "Using GEOJSON, exact 4-point region (rectangle shaped - 5 points)",
201
}
202

203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
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",
        },
    },
    "required": [
        "squad_ID",
        "no_of_platforms",
        "platforms",
        "squad_mission_type",
    ],
}
236

237 238 239
planning_configuration_schema = {
    "type": "object",
    "properties": {
240 241 242 243
        "message_type": {
            "type": "string",
            "description": "Type of message",
            "example": "planning_configuration",
244
            "enum": ["planning_configuration"],
245
        },
246
        "planning_config_ID": {
247 248
            "type": "integer",
            "description": "Unique identifier tagged to version of this"
249
            + " configuration plan",
250 251
            "example": 3,
        },
252 253 254 255 256
        "region_of_interest": {
            "type": "array",
            "items": region_schema,
            "description": "Region of interest for the entire operation",
        },
257 258 259 260 261
        "exclusion_zones": {
            "type": "array",
            "items": region_schema,
            "description": "Exclusion zones for all platforms",
        },
262 263 264 265
        "squads": {
            "type": "array",
            "items": squad_metadata_schema,
        },
266
    },
267
    "required": [
268
        "message_type",
269
        "planning_config_ID",
270 271
        "squads",
        "exclusion_zones",
272
        "region_of_interest",
273
    ],
274
}