Skip to content

Depth, altitude and location triggers combined with AND in mission rules - #308

Draft
jp-pino wants to merge 2 commits into
jp-pino/set-mission-repfrom
jp-pino/mission-rule-triggers
Draft

Depth, altitude and location triggers combined with AND in mission rules#308
jp-pino wants to merge 2 commits into
jp-pino/set-mission-repfrom
jp-pino/mission-rule-triggers

Conversation

@jp-pino

@jp-pino jp-pino commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Adds three more mission rule triggers and lets a rule require several at once.

  • DepthTrigger { min_depth, max_depth } — satisfied between two depths below the surface. max_depth zero means no upper bound.
  • AltitudeTrigger { min_altitude, max_altitude } — satisfied between two heights above the seabed, from a DVL or an altimeter. max_altitude zero means no upper bound.
  • LocationTrigger { position, circle_of_acceptance } — satisfied inside a circle around a position.
  • Trigger wraps the four kinds in a oneof condition (detection_trigger 1, depth_trigger 2, altitude_trigger 3, location_trigger 4), with a TriggerKind enum whose values are those field numbers.
  • MissionRule takes repeated Trigger triggers = 7, all of which must be satisfied at once. The single detection_trigger field 4 is reserved. hold_ms (8), release_ms (9) and cooldown_ms (10) move from DetectionTrigger to MissionRule, where they apply to the combination; DetectionTrigger reserves 6, 7 and 8.
  • MissionRuleStatus takes repeated TriggerStatus triggers = 7. TriggerStatus { kind, satisfied, sensor_unavailable } says which condition is holding a rule back, and whether the reading it needs is missing. A trigger whose sensor is unavailable is simply not satisfied.
  • SetMultibeamConfigCommand and MultibeamDriverCommand take a GuestPortDeviceID expected_device_id — the sonar the configuration was made for. The comments describe the contract: the drone compares it with the sonar the multibeam driver reports and skips the configuration when they differ.
  • NOTIFICATION_TYPE_MULTIBEAM_SONAR_MISMATCH (40) for that skip.

Review follow-ups

Comments that did not match the behaviour they describe:

  • DepthTrigger and AltitudeTrigger: neither bound may be negative, and a maximum that is set has to be above the minimum. A band whose bounds are equal is only ever satisfied by an exact float match, so it is refused rather than accepted as a condition that never holds. A depth trigger reports sensor_unavailable while no depth has arrived at all, not never.
  • MissionRule: a rule needs at least one instruction in one of its lists.
  • SetMultibeamConfigCommand and MultibeamDriverCommand: the configuration is also measured against the range, the frequency modes and the beam count of the sonar, and one outside them skips the instruction with a reason instead of being clamped. For the driver command that means the driver is not started.

Depends on #307.

🤖 Generated with Claude Code

Add DepthTrigger, AltitudeTrigger and LocationTrigger next to DetectionTrigger
and wrap the four in a Trigger message with a oneof. MissionRule now carries a
repeated list of triggers that must all be satisfied at once, and hold_ms,
release_ms and cooldown_ms move from DetectionTrigger to the rule, where they
apply to the combination. MissionRuleStatus gains a TriggerStatus per trigger
so a client can show which condition is holding a rule back and whether the
sensor for it is missing.

SetMultibeamConfigCommand and MultibeamDriverCommand carry the
GuestPortDeviceID the configuration was made for, and the drone skips the
configuration with NOTIFICATION_TYPE_MULTIBEAM_SONAR_MISMATCH when the
multibeam driver reports a different sonar.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jp-pino jp-pino self-assigned this Sep 10, 2026
Say what the drone actually does with a trigger band and with a multibeam
configuration:

- DepthTrigger and AltitudeTrigger: neither bound may be negative and a
  maximum that is set has to be above the minimum, so a band with no width
  is refused rather than accepted as a rule that never fires. A depth
  trigger reports sensor_unavailable while no depth has reached the mission
  at all, rather than never.
- MissionRule: a rule needs at least one instruction in one of its lists.
- SetMultibeamConfigCommand and MultibeamDriverCommand: the configuration is
  also measured against the range, frequency modes and beam count of the
  sonar, and a configuration outside them skips the instruction rather than
  being clamped. For the driver command that means the driver is not started.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jp-pino jp-pino added this to the Blunux v5.2 milestone Sep 10, 2026
@jp-pino
jp-pino added this pull request to stack #304 September 10, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant