Skip to main content

ados_swarm/
lib.rs

1#![doc = include_str!("../README.md")]
2#![warn(missing_docs)]
3
4pub mod barrier;
5pub mod cbba;
6pub mod config;
7pub mod controller;
8pub mod flocking;
9pub mod formation;
10pub mod geo;
11pub mod neighbor;
12pub mod precedence;
13pub mod scenarios;
14pub mod separation;
15pub mod setpoint;
16pub mod sim;
17pub mod status;
18
19pub use barrier::{BarrierOutcome, BARRIER_GAIN_HZ};
20pub use cbba::{
21    conflicts, consensus_reached, converge_broadcast, BidVector, CbbaAgent, CbbaTask,
22    ConvergenceReport, TaskAssignment,
23};
24pub use config::SwarmControlConfig;
25pub use controller::{
26    ControlOutcome, NeighborFix, OperatorDirective, OwnState, Suppression, SwarmControlCounters,
27    SwarmController, SwarmMode, CONTROL_HZ, CONTROL_PERIOD, OPERATOR_DIRECTIVE_TTL,
28};
29pub use flocking::{FlockTerms, FlockTuning};
30pub use formation::{Formation, FormationAnchor, FormationName};
31pub use geo::{GeoOrigin, Ned};
32pub use neighbor::{NearestSet, NeighborState};
33pub use precedence::{arbitrate, precedence_rank, ModePrecedence};
34pub use separation::{HardBreach, SeparationTuning};
35pub use setpoint::{Setpoint, SetpointKind, MAX_COMMAND_SPEED_MPS};
36pub use status::{
37    STATUS_ARMED, STATUS_EMERGENCY, STATUS_GPS_OK, STATUS_GUIDED, STATUS_HERO,
38    STATUS_PRECEDENCE_MASK, STATUS_PRECEDENCE_SHIFT,
39};
40
41/// How long a neighbour survives without a beacon, and how long an empty
42/// neighbour table is tolerated before the controller stops emitting setpoints.
43///
44/// Six missed beacons at a 2 Hz beacon rate. Six rather than two because
45/// outages of about a second are normal in real formation flight, and dropping
46/// a neighbour that is still there is worse than carrying a slightly old one:
47/// the separation layer would stop avoiding an aircraft that has not gone
48/// anywhere. A transport that prunes its neighbour table should use this same
49/// constant so the table and the control loop agree.
50pub const NEIGHBOR_STALE: std::time::Duration = std::time::Duration::from_secs(3);
51
52/// How stale this drone's OWN position may be before the controller stops
53/// commanding, and before a transport should stop broadcasting it.
54///
55/// Tighter than [`NEIGHBOR_STALE`] on purpose. A neighbour going quiet empties
56/// the picture, which the controller already refuses to fly on. Our own fix
57/// going quiet does something worse: it stays plausible. The frame every
58/// neighbour is measured in is anchored on it, so a frozen fix keeps producing
59/// confident geometry, and every other drone dead-reckons a beacon built from
60/// it forward in a direction the aircraft is no longer going. At 10 Hz a
61/// three-second window is thirty ticks of commanding on a dead fix, so this is
62/// one second.
63pub const OWN_STATE_STALE: std::time::Duration = std::time::Duration::from_secs(1);