Class FaultManager
Defined in File fault_manager.hpp
Class Documentation
-
class FaultManager
Application service for fault-management operations.
Pure C++; ROS-side I/O is performed by the injected FaultServiceTransport adapter (typically Ros2FaultServiceTransport). All
rclcpp::Client<ros2_medkit_msgs::srv::*>instances, the seven per-client mutexes, and the message-to-JSON conversion helpers live in the adapter.The manager body delegates each of the eight SOVD operations to the transport and returns its neutral FaultResult / FaultWithEnvJsonResult structures. The handler-facing public API is preserved verbatim across the refactor; the only behaviour change is that get_fault_with_env now returns the response body as JSON (“fault” + “environment_data”) rather than as raw message types - the transport performs the conversion.
Public Functions
- Parameters:
transport – Concrete FaultServiceTransport adapter. Manager takes shared ownership.
-
~FaultManager() = default
-
FaultManager(const FaultManager&) = delete
-
FaultManager &operator=(const FaultManager&) = delete
-
FaultManager(FaultManager&&) = delete
-
FaultManager &operator=(FaultManager&&) = delete
-
FaultResult report_fault(const std::string &fault_code, uint8_t severity, const std::string &description, const std::string &source_id)
Report a fault from a component.
- Parameters:
fault_code – Unique fault identifier
severity – Fault severity (0=INFO, 1=WARN, 2=ERROR, 3=CRITICAL)
description – Human-readable description
source_id – Component identifier (namespace path)
-
FaultResult list_faults(const std::string &source_id = "", bool include_prefailed = true, bool include_confirmed = true, bool include_cleared = false, bool include_healed = false, bool include_muted = false, bool include_clusters = false)
Get all faults, optionally filtered by component (prefix match on source_id).
-
FaultWithEnvJsonResult get_fault_with_env(const std::string &fault_code, const std::string &source_id = "")
Get a specific fault by code with environment data, returned as JSON.
datacarries{ "fault": {...}, "environment_data": {...} }. The rosbag-snapshot bulk_data_uri is intentionally NOT included; per-request URL building belongs to the handler that knows the entity path.
-
FaultResult get_fault(const std::string &fault_code, const std::string &source_id = "")
Get a specific fault by code (JSON result - “fault” body only).
-
FaultResult clear_fault(const std::string &fault_code)
Clear a fault.
-
FaultResult get_snapshots(const std::string &fault_code, const std::string &topic = "")
Get snapshots for a fault (optional topic filter).
-
FaultResult get_rosbag(const std::string &fault_code)
Get rosbag file info for a fault.
-
FaultResult list_rosbags(const std::string &entity_fqn)
Get all rosbag files for an entity (batch operation).
-
bool is_available() const
Check if fault manager services are available.
-
bool wait_for_services(std::chrono::duration<double> timeout)
Wait for fault manager services to become available (forwards to transport).