mission_plan.py 4.69 KB
"""
    schemas: Mission plan (un-compiled) generated by the Autonomy Engine
    sent to the respective platform's C2 to compile into a platform-specific
    mission plan.
"""

action_schema = {
    "type": "object",
    "properties": {
        "action": {
            "type": "string",
            "description": "Autonomy Engine's action from `move`, `payload`,"
            + " `dive`, `send_hits`, `scanline`, `scanpoint`.",
            "enum": [
                "move",
                "payload",
                "dive",
                "send_hits",
                "scanline",
                "scanpoint",
                "go_home",
                "surface_now",
                "stop_mission",
                "abort_now",
            ],
            "example": "move",
        },
        "activate_payload": {
            "type": "boolean",
            "description": "To activate/deactivate sensor for Autosub "
            + "Hover-1 --> `MBES` sensor and for EcoSUB --> `Sidescan`",
            "example": True,
        },
        "timeout": {
            "type": "number",
            "format": "float",
            "description": "Timeout set to perform action",
            "example": 1800.0,
        },
    },
    "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",
            ],
        },
    ],
}

mission_plan_schema = {
    "type": "object",
    "properties": {
        "message_type": {
            "type": "string",
            "description": "Type of message",
            "example": "mission_plan",
            "enum": ["mission_plan"],
        },
        "autonomy_engine_plan_ID": {
            "oneOf": [
                {
                    "type": "string",
                    "format": "uuid",
                    "description": "Unique identifier for this plan"
                    + "generated by the Autonomy Engine",
                },
                {
                    "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",
        },
        "emergency": {
            "type": "boolean",
            "description": "To indicate if this is an emergency. "
            + "true = emergency and false = no emergency",
            "default": False,
            "example": False,
        },
        "plan": {
            "type": "array",
            "items": action_schema,
        },
    },
    "required": [
        "message_type",
        "autonomy_engine_plan_ID",
        "platform_ID",
        "plan",
    ],
}