mission_plan.py 5.67 KB
Newer Older
1
"""
2
    schemas: Mission plan (un-compiled) generated by the Autonomy Engine
3 4
    sent to the respective platform's C2 to compile into a platform-specific
    mission plan.
5 6
"""

7 8 9 10 11 12
action_schema = {
    "type": "object",
    "properties": {
        "action": {
            "type": "string",
            "description": "Autonomy Engine's action from `move`, `payload`,"
13
            + " `dive`, `send_hits`, `scanline`, `scanpoint`.",
14 15 16 17 18 19 20 21 22 23 24 25
            "enum": [
                "move",
                "payload",
                "dive",
                "send_hits",
                "scanline",
                "scanpoint",
                "go_home",
                "surface_now",
                "stop_mission",
                "abort_now",
            ],
26 27 28 29 30
            "example": "move",
        },
        "activate_payload": {
            "type": "boolean",
            "description": "To activate/deactivate sensor for Autosub "
31
            + "Hover-1 --> `MBES` sensor and for EcoSUB --> `Sidescan`",
32 33
            "example": True,
        },
34 35 36 37 38 39
        "timeout": {
            "type": "number",
            "format": "float",
            "description": "Timeout set to perform action",
            "example": 1800.0,
        },
40
    },
41 42 43 44 45 46 47 48 49 50 51 52 53 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
    "oneOf": [
        {
            "type": "object",
            "properties": {
                "start": {
                    "$ref": "https://geojson.org/schema/Point.json",
                },
                "target": {
                    "$ref": "https://geojson.org/schema/Point.json",
                },
            },
            "required": [
                "target",
            ],
        },
        {
            "type": "object",
            "properties": {
                "start_point_latitude": {
                    "type": "number",
                    "format": "float",
                    "description": "Start point, y-coordinate",
                    "example": 50.37072283932642,
                },
                "start_point_longitude": {
                    "type": "number",
                    "format": "float",
                    "description": "Start point, x-coordinate",
                    "example": -4.187143188645706,
                },
                "target_waypoint_latitude": {
                    "type": "number",
                    "format": "float",
                    "description": "Target waypoint, y-coordinate",
                    "example": 50.37072283932642,
                },
                "target_waypoint_longitude": {
                    "type": "number",
                    "format": "float",
                    "description": "Target waypoint, x-coordinate",
                    "example": -4.187143188645706,
                },
                "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,
                },
            },
            "required": [
                "target_waypoint_latitude",
                "target_waypoint_longitude",
            ],
        },
101 102
    ],
}
103

104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
goal_schema = {
    "type": "object",
    "properties": {
        "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of last state change when autonomy model"
            + " sets this goal",
            "example": "2024-11-21T00:00:00Z",
        },
        "feature": {
            "$ref": "https://geojson.org/schema/Feature.json",
        },
    },
}
119 120 121
mission_plan_schema = {
    "type": "object",
    "properties": {
122 123 124 125
        "message_type": {
            "type": "string",
            "description": "Type of message",
            "example": "mission_plan",
126
            "enum": ["mission_plan"],
127
        },
128
        "platform_ID": {
129
            "type": "string",
130
            "description": "Unique identifier for this platform",
131
            "example": "reav-x-1",
132
        },
133 134
        "emergency": {
            "type": "boolean",
Trishna Saeharaseelan's avatar
Trishna Saeharaseelan committed
135
            "description": "To indicate if this is an emergency. "
136
            + "true = emergency and false = no emergency",
137 138 139
            "default": False,
            "example": False,
        },
140 141 142 143 144 145 146
        "partial": {
            "type": "boolean",
            "description": "To indicate if this mission plan represents a "
            + "partial (`true`) or the entire (`false`) mission plan. E.g."
            + "Partial would be `true` if a full mission plan is broken down into multiple plans.",
            "example": False,
        },
147 148 149 150
        "plan": {
            "type": "array",
            "items": action_schema,
        },
151
        "goal": goal_schema,
152
    },
Dan Jones's avatar
Dan Jones committed
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
    "oneOf": [
        {
            "properties": {
                "autonomy_engine_plan_ID": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",
                    "description": "Unique identifier for this plan"
                    + "generated by the Autonomy Engine",
                },
            },
        },
        {
            "properties": {
                "autonomy_engine_plan_ID": {
                    "type": "integer",
                    "description": "Unique identifier for this plan"
                    + "generated by the Autonomy Engine",
                    "example": 3,
                },
            },
        },
    ],
Trishna Saeharaseelan's avatar
Trishna Saeharaseelan committed
176 177 178 179 180 181
    "required": [
        "message_type",
        "autonomy_engine_plan_ID",
        "platform_ID",
        "plan",
    ],
182
}