diff --git a/protobuf_definitions/message_formats.proto b/protobuf_definitions/message_formats.proto index 390469ae..986cf854 100644 --- a/protobuf_definitions/message_formats.proto +++ b/protobuf_definitions/message_formats.proto @@ -686,6 +686,8 @@ enum NotificationType { NOTIFICATION_TYPE_VIDEO_PARTITION_NOT_MOUNTED = 33; // Video partition not mounted. NOTIFICATION_TYPE_DVL_PROTOCOL_UNSUPPORTED = 34; // DVL firmware speaks a protocol version Blunux does not support. NOTIFICATION_TYPE_INSTRUCTION_STARTED = 35; // A mission instruction started; the value names it. + NOTIFICATION_TYPE_MISSION_PAUSED_BY_INSTRUCTION = 36; // Paused after an instruction with pause_on_completion. + NOTIFICATION_TYPE_MISSION_UPDATED = 37; // The loaded mission was changed; the value is its revision. } // List of available notification levels. diff --git a/protobuf_definitions/mission_planning.proto b/protobuf_definitions/mission_planning.proto index 1b5c3cba..55f6451f 100644 --- a/protobuf_definitions/mission_planning.proto +++ b/protobuf_definitions/mission_planning.proto @@ -18,13 +18,14 @@ message Mission { float default_surge_speed = 7; // Default cruise speed of the mission (m/s) (optional). float default_heave_speed = 8; // Default heave speed of the mission (m/s) (optional). float default_circle_of_acceptance = 9; // Default circle of acceptance for waypoints (m) (optional). + uint32 revision = 10; // Set by the drone, increases with every SetInstructionUpdateReq. } // A mission consists of one or multiple instructions. One instruction can be of different types. message Instruction { uint32 id = 1; uint32 group_id = 2; // Group id used for polygons. - bool auto_continue = 3; // False will pause the mission after this instruction. + bool pause_on_completion = 3; // Pause the mission after this instruction. RunMissionCtrl continues it. oneof command { WaypointCommand waypoint_command = 4; // Go to waypoint. DepthSetPointCommand depth_set_point_command = 5; // Go to depth. @@ -100,6 +101,12 @@ message ControlModeCommand { } // A WaypointCommand will request the drone to drive to a point automatically. +// InsertInstruction adds an instruction to the loaded mission. +message InsertInstruction { + Instruction instruction = 1; // The instruction to add. Its id must be new to the mission. + uint32 before_id = 2; // Id of the instruction to insert in front of. 0 appends to the end. +} + message WaypointCommand { Waypoint waypoint = 1; // Waypoint to go to. } @@ -358,6 +365,9 @@ message MissionStatus { repeated uint32 completed_path_segment_ids = 7; // Ids of the completed path segments. uint32 total_number_of_path_segments = 8; // Total number of path segments in the mission. uint32 id = 9; // Mission id of the active mission. + uint32 active_instruction_id = 10; // Id of the instruction that is running, 0 when none. + uint32 revision = 11; // Revision of the loaded mission, see Mission.revision. + string failure_reason = 12; // Why the mission failed to load or start or was aborted by the drone. } // Outcome of an instruction started with RunInstructionCtrl. diff --git a/protobuf_definitions/req_rep.proto b/protobuf_definitions/req_rep.proto index 796735eb..f0d18c68 100644 --- a/protobuf_definitions/req_rep.proto +++ b/protobuf_definitions/req_rep.proto @@ -145,13 +145,23 @@ message GetMissionRep { Mission mission = 1; // Active mission with waypoints. } -// Updates an instruction in current mission with a new instruction payload. +// Changes one instruction of the loaded mission. The mission is validated and +// planned again as a whole and Mission.revision increases. An instruction that +// has completed cannot be changed. Replacing or removing the instruction that +// is running stops it; a replacement starts from where the drone is. message SetInstructionUpdateReq { - Instruction instruction = 1; // instruction that will replace the desired instruction. + oneof operation { + Instruction replace = 1; // Replace the instruction that has the same id. + InsertInstruction insert = 2; // Add an instruction. + uint32 remove_id = 3; // Remove the instruction with this id. + } } // Response after updating an instruction in the current mission. message SetInstructionUpdateRep { + bool accepted = 1; // True when the mission was changed. + string reason = 2; // Why the change was refused. + uint32 revision = 3; // Revision of the mission after the change. } // Set the heading mode used in dead reckoning.