Expand description
Contract monitors on target, and the /diagnostics reporter they publish
through — issues 1635 and 1676, ONE implementation for every language.
RFC-0052 / phase-296 W3b: a contracted image bakes monitor tables
(min_rate_hz / max_latency_ms per publisher, max_age_ms per
subscriber), the executor checks them every spin and logs each violation at
detection (issue 0514’s floor). Issue 1635 made a C or C++ image also
PUBLISH each one as a DiagnosticArray on /diagnostics, through a
reporter nros-cpp armed when the tables were installed. The Rust entry
(nros::main!) installed no table at all (issue 1676), so it neither
monitored nor reported.
This module is that reporter, moved up to the umbrella so the three
languages share it: DiagSink (one /diagnostics publisher and its two
counters) and its violation sink, used by nros-cpp‘s
nros_cpp_install_monitors and by install_contract_monitors, which the
nros::main! expansion calls before the first node is created. The mapping
from a violation to a report is nros-diagnostics’
(DiagnosticReporter::report_violation, streamed by
write_violation_reports so the report never sits on the spin thread’s
stack as a value), so a violation reads the same from every road. The
executor hands the reporter its queued verdicts off the judged dispatch
(phase-474 I7), and one report carries as many as fit one message.
Structs§
- Contract
Reporter - Static storage for one executor’s
DiagSink— what a Rust entry owns in place of the C++ context’sdiagfield. - Diag
Sink - One executor’s
/diagnosticsreporter: the publisher and two counters.
Constants§
- DIAG_
TOPIC - The topic ROS 2’s diagnostics tooling reads.
Functions§
- arm_
reporter ⚠ - Arm one executor’s
/diagnosticsreporter inslot, and point the executor’s violation sink at it — THE arming step, shared byinstall_contract_monitors(Rust) andnros-cpp’snros_cpp_install_monitors(C and C++), issue 1693. - install_
contract_ ⚠hazards - phase-462 W3b – install a contracted Rust image’s hazard table on one
executor, after
install_contract_monitors(each hazard’s guards index the two tables that call installs).nros::main!emits this only for an executor whose tables observe a hazard; the observer then reportshazard-detected,hazard-reactionandhazard-recoveredthrough the reporter that call armed. - install_
contract_ ⚠monitors - Install a contracted Rust image’s monitor tables on one executor, and arm
its
/diagnosticsreporter — issue 1676.