mission_plan.py 4.84 KB
Newer Older
1
"""
2 3 4
    schemas: Mission plan (un-complied) geenrated by the  Autonomy Engine
    sent to the respective platform's C2 to compile into a platform-specific
    mission plan.
5
"""
6 7
# from . import api, full_message_schema
# from flask_restx import fields
8

9 10 11 12 13 14
action_schema = {
    "type": "object",
    "properties": {
        "action": {
            "type": "string",
            "description": "Autonomy Engine's action from `move`, `payload`,"
15
            + " `dive`, `send_hits`, `scanline`, `scanpoint`.",
16 17 18 19 20
            "example": "move",
        },
        "flight_style": {
            "type": "string",
            "description": "Platform-specific modes/flight styles to perform"
21
            + " next action",
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
            "example": "orbit",
        },
        "latitude_waypoint": {
            "type": "number",
            "description": "Next waypoint, x-coordinate",
            "example": -4.187143188645706,
        },
        "longitude_waypoint": {
            "type": "number",
            "description": "Next waypoint, y-coordinate",
            "example": 50.37072283932642,
        },
        "altitude": {
            "type": "number",
            "description": "Altitude of next action",
            "example": 15.0,
        },
        "depth": {
            "type": "number",
            "description": "Depth of next action",
            "example": 15.0,
        },
        "activate_payload": {
            "type": "boolean",
            "description": "To activate/deactivate sensor for Autosub "
47
            + "Hover-1 --> `MBES` sensor and for EcoSUB --> `Sidescan`",
48 49 50 51 52
            "example": True,
        },
        "send_environmental_data": {
            "type": "boolean",
            "description": "To trigger the platform to send list of observations"
53
            + " if any found",
54 55
            "example": False,
        },
56
    },
57 58 59 60 61 62
    "required": [
        "action",
        "latitude_waypoint",
        "longitude_waypoint",
    ],
}
63

64 65 66 67 68 69 70 71 72 73
mission_plan_schema = {
    "allOf": [{"$ref": "#/components/schemas/Message"}],
    "type": "object",
    "properties": {
        "plan_ID": {"type": "integer"},
        "platform_serial": {"type": "string"},
        "plan": {
            "type": "array",
            "items": action_schema,
        },
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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
    "required": ["plan_ID", "platform_serial", "plan"],
}

# action_schema = api.model(
#     "AutonomyEngineAction",
#     {
#         "action": fields.String(
#             required=True,
#             description="Autonomy Engine's action from `move`, `payload`,"
#             + " `dive`, `send_hits`, `scanline`, `scanpoint`.",
#             example="move",
#         ),
#         "flight_style": fields.String(
#             required=False,
#             description="Platform-specific modes/flight styles to perform"
#             + " next action",
#             example="orbit",
#         ),
#         "latitude_waypoint": fields.Float(
#             required=True,
#             description="Next waypoint, x-coordinate",
#             example=-4.187143188645706,
#         ),
#         "longitude_waypoint": fields.Float(
#             required=True,
#             description="Next waypoint, y-coordinate",
#             example=50.37072283932642,
#         ),
#         "altitude": fields.Float(
#             required=False,
#             description="Altitude of next action",
#             example=15.0,
#         ),
#         "depth": fields.Float(
#             required=False,
#             description="Depth of next action",
#             example=15.0,
#         ),
#         "activate_payload": fields.Boolean(
#             required=False,
#             description="To activate/deactivate sensor for Autosub "
#             + "Hover-1 --> `MBES` sensor and for EcoSUB --> `Sidescan`",
#             example=True,
#         ),
#         "send_environmental_data": fields.Boolean(
#             required=False,
#             description="To trigger the platform to send list of observations"
#             + " if any found",
#             example=False,
#         ),
#     },
# )

# mission_plan_schema = api.model(
#     "MissionPlan",
#     {
#         "message": fields.Nested(
#             full_message_schema,
#             required=True,
#             description="Message header",
#         ),
#         "plan_ID": fields.Integer(
#             required=True,
#             description="Identifier of given mission sequence planned",
#             example=1,
#         ),
#         "platform_serial": fields.String(
#             required=True,
#             description="Serial of target platform to send mission to",
#             example="reav-60",
#         ),
#         "plan": fields.List(
#             fields.Nested(action_schema),
#             required=True,
#             description="Sequence of actions/instructions generated by the "
#             + " Autonomy Engine that should be compiled by the respective C2.",
#         ),
#     },
# )