19#include <boost/algorithm/string.hpp>
20#include <rclcpp/logger.hpp>
21#include <rclcpp/logging.hpp>
23#include <lifecycle_msgs/msg/state.hpp>
32: ssc_driver_name_(ssc_driver_name), driver_timeout_(driver_timeout)
37 long time_now,
long start_up_timestamp,
long startup_duration)
39 carma_msgs::msg::SystemAlert alert;
42 if (ssc_is_operational) {
44 alert.description =
"All essential drivers are ready";
45 alert.type = carma_msgs::msg::SystemAlert::DRIVERS_READY;
47 }
else if (
starting_up_ && (time_now - start_up_timestamp <= startup_duration)) {
48 alert.description =
"System is starting up...";
49 alert.type = carma_msgs::msg::SystemAlert::NOT_READY;
51 }
else if (!ssc_is_operational) {
52 alert.description =
"SSC Failed";
56 alert.description =
"Unknown problem assessing SSC driver availability";
57 alert.type = carma_msgs::msg::SystemAlert::FATAL;
63 const carma_driver_msgs::msg::DriverStatus::SharedPtr msg,
long current_time)
70 msg->status == carma_driver_msgs::msg::DriverStatus::OPERATIONAL ||
71 msg->status == carma_driver_msgs::msg::DriverStatus::DEGRADED,
72 msg->name, current_time);
91 rclcpp::get_logger(
"subsystem_controller"),
92 "latest_ssc_status_entry_->name_: "
std::chrono::milliseconds std_msec
bool is_ssc_driver_operational(long current_time)
Check if all critical drivers are operational.
SSCDriverManager()
Default constructor for SSCDriverManager with driver_timeout_ = 1000ms.
std::string ssc_driver_name_
std::shared_ptr< Entry > latest_ssc_status_entry_
Latest SSC Status entry to keep track.
void update_driver_status(const carma_driver_msgs::msg::DriverStatus::SharedPtr msg, long current_time)
Update driver status.
carma_msgs::msg::SystemAlert get_latest_system_alert(long time_now, long start_up_timestamp, long startup_duration)
Handle the spin and publisher.
An entry represents a driver details for the purposes of tracking.