diff --git a/protobuf_definitions/control.proto b/protobuf_definitions/control.proto index 3fdfe36d..7e161e8b 100644 --- a/protobuf_definitions/control.proto +++ b/protobuf_definitions/control.proto @@ -135,10 +135,12 @@ message ClearMissionRulesCtrl { // Run a single instruction right away, outside any mission. // -// Instructions that do not move the drone (camera, tilt, lights, multibeam) run in any mission -// state, alongside a running mission. Instructions that move the drone run only while no mission -// is running, and are rejected otherwise. The outcome is reported in InstructionResultTel with -// the same request_id. +// Instructions that do not move the drone (camera, tilt, lights, laser, multibeam, tilt +// stabilization, CV model, annotation, set speed) run in any mission state, alongside a running +// mission. Instructions that move the drone (waypoint, go to home, transect, survey, depth set +// point, relative depth, go to surface or seabed, control mode, set heading) run only while no +// mission is running, one at a time, and are rejected otherwise. A wait is rejected. The outcome +// is reported in InstructionResultTel with the same request_id. message RunInstructionCtrl { Instruction instruction = 1; // Instruction to execute. uint32 request_id = 2; // Client-chosen id, echoed in InstructionResultTel. diff --git a/protobuf_definitions/message_formats.proto b/protobuf_definitions/message_formats.proto index 7562f2ec..66507918 100644 --- a/protobuf_definitions/message_formats.proto +++ b/protobuf_definitions/message_formats.proto @@ -685,8 +685,8 @@ enum NotificationType { NOTIFICATION_TYPE_DVL_THERMAL_PROTECTION_MODE_DETECTED = 32; // DVL thermal protection mode detected. 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_INSTRUCTION_STARTED = 35; // An instruction started; the value names it or is its target. + NOTIFICATION_TYPE_MISSION_PAUSED_BY_INSTRUCTION = 36; // Paused after the instruction whose id is the value. NOTIFICATION_TYPE_MISSION_UPDATED = 37; // The loaded mission was changed; the value says what changed. NOTIFICATION_TYPE_MISSION_RULE_FIRED = 38; // A mission rule fired; the value is its name. NOTIFICATION_TYPE_MISSION_RULE_RELEASED = 39; // A mission rule released; the value is its name. diff --git a/protobuf_definitions/mission_planning.proto b/protobuf_definitions/mission_planning.proto index eed243e3..63f124fb 100644 --- a/protobuf_definitions/mission_planning.proto +++ b/protobuf_definitions/mission_planning.proto @@ -101,7 +101,6 @@ message ControlModeCommand { ControlModeHorizontal control_mode_horizontal = 6; // Desired control mode in surge and yaw. } -// A WaypointCommand will request the drone to drive to a point automatically. // DetectionTrigger fires a rule on what the computer vision models see. message DetectionTrigger { repeated string class_names = 1; // Any of these class names; empty matches every class. @@ -109,20 +108,24 @@ message DetectionTrigger { Camera camera = 3; // Only detections from this camera; unspecified matches every camera. float min_confidence = 4; // Detections below this confidence are ignored (0..1). float min_area_fraction = 5; // Least bounding box area over image area a detection must have (0..1). - uint32 hold_ms = 6; // How long the trigger must match before the rule fires. - uint32 release_ms = 7; // How long the trigger must stay unmatched before the rule releases. - uint32 cooldown_ms = 8; // Time after a release before the rule can fire again. + uint32 hold_ms = 6; // How long the trigger must match before the rule fires. At most an hour. + uint32 release_ms = 7; // How long the trigger must stay unmatched before the rule releases. At most an hour. + uint32 cooldown_ms = 8; // Time after a release before the rule can fire again. At most an hour. } -// MissionRule runs instructions when its trigger fires and when it releases. +// MissionRule runs instructions when its trigger fires and when it releases. A drone runs at +// most 16 rules with at most 8 instructions per list. Instructions that move the drone (waypoint, +// go to home, transect, survey, depth set point, relative depth, go to surface or seabed, control +// mode, set heading) and waits are refused in rules; camera, tilt, lights, laser, multibeam, +// tilt stabilization, CV model, annotation and set speed are allowed. message MissionRule { - uint32 id = 1; // Rule id, defined by the client. + uint32 id = 1; // Rule id, defined by the client. Must be greater than zero and unique. string name = 2; // Rule name, for the log and the app. - bool enabled = 3; // A disabled rule never fires. + bool disabled = 3; // A disabled rule never fires. Rules run unless this is set. oneof trigger { DetectionTrigger detection_trigger = 4; // Fire on detections. } - repeated Instruction enter_instructions = 5; // Run when the rule fires. Instructions that move the drone are refused. + repeated Instruction enter_instructions = 5; // Run when the rule fires. repeated Instruction exit_instructions = 6; // Run when the rule releases. } @@ -139,9 +142,11 @@ message MissionRuleStatus { // 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. + uint32 before_id = 2; // Id of the instruction to insert in front of, unless append is set. + bool append = 3; // Add the instruction at the end of the mission. } +// A WaypointCommand will request the drone to drive to a point automatically. message WaypointCommand { Waypoint waypoint = 1; // Waypoint to go to. } @@ -269,7 +274,7 @@ message RelativeDepthCommand { // SetSpeedCommand changes the cruise speed used by the following instructions of the mission. message SetSpeedCommand { - float cruise_speed = 1; // Desired surge speed (m/s). + float cruise_speed = 1; // Desired surge speed (m/s). Must be greater than zero. } // A SurveyCommand defines a survey (lawn-mower) pattern over a polygon area. @@ -400,21 +405,12 @@ 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. + int32 active_instruction_id = 10; // Id of the instruction that is running, -1 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. -// MissionRuleState is where a rule is in its episode. -enum MissionRuleState { - MISSION_RULE_STATE_UNSPECIFIED = 0; // Unspecified. - MISSION_RULE_STATE_IDLE = 1; // Waiting for the trigger. - MISSION_RULE_STATE_ACTIVE = 2; // The rule has fired and has not released yet. - MISSION_RULE_STATE_COOLDOWN = 3; // Released; waiting for the cooldown before it can fire again. - MISSION_RULE_STATE_DISABLED = 4; // The rule is disabled. -} - enum InstructionResultState { INSTRUCTION_RESULT_STATE_UNSPECIFIED = 0; // Unspecified. INSTRUCTION_RESULT_STATE_ACCEPTED = 1; // The instruction was accepted and has started. @@ -424,6 +420,15 @@ enum InstructionResultState { INSTRUCTION_RESULT_STATE_CANCELLED = 5; // The instruction was cancelled by a client or by the drone. } +// MissionRuleState is where a rule is in its episode. +enum MissionRuleState { + MISSION_RULE_STATE_UNSPECIFIED = 0; // Unspecified. + MISSION_RULE_STATE_IDLE = 1; // Waiting for the trigger. + MISSION_RULE_STATE_ACTIVE = 2; // The rule has fired and has not released yet. + MISSION_RULE_STATE_COOLDOWN = 3; // Released; waiting for the cooldown before it can fire again. + MISSION_RULE_STATE_DISABLED = 4; // The rule is disabled. +} + // Result of an instruction started with RunInstructionCtrl. message InstructionResult { uint32 request_id = 1; // The request_id given to RunInstructionCtrl. diff --git a/protobuf_definitions/req_rep.proto b/protobuf_definitions/req_rep.proto index fd01ea23..67601cf1 100644 --- a/protobuf_definitions/req_rep.proto +++ b/protobuf_definitions/req_rep.proto @@ -134,6 +134,10 @@ message SetMissionReq { // Response after setting a new mission. message SetMissionRep { + // True when the mission was loaded. Drones without this field answer an empty message, so not + // accepted with no reason means the mission was loaded the old way. + bool accepted = 1; + string reason = 2; // Why the mission was refused. } // Service request to the reference_generator to get the active mission. diff --git a/protobuf_definitions/telemetry.proto b/protobuf_definitions/telemetry.proto index 075bc0ef..ce3e003c 100644 --- a/protobuf_definitions/telemetry.proto +++ b/protobuf_definitions/telemetry.proto @@ -68,15 +68,15 @@ message NotificationTel { // // Published when the instruction is accepted or rejected, and again when it completes, fails or // is cancelled. +message InstructionResultTel { + InstructionResult result = 1; // Result of the instruction. +} + // State of the mission rules. message MissionRulesTel { repeated MissionRuleStatus rules = 1; // One entry per rule. } -message InstructionResultTel { - InstructionResult result = 1; // Result of the instruction. -} - // Control force in all directions. message ControlForceTel { ControlForce control_force = 1; // Control force in all directions.