Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
ssc_driver_manager.hpp
Go to the documentation of this file.
1#pragma once
2
3/*
4 * Copyright (C) 2023 LEIDOS.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7 * use this file except in compliance with the License. You may obtain a copy of
8 * the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 * License for the specific language governing permissions and limitations under
16 * the License.
17 */
18
19#include <gtest/gtest_prod.h>
20#include <rmw/types.h>
21
22#include <chrono>
23#include <functional>
24#include <map>
25#include <memory>
26#include <unordered_set>
27#include <vector>
28
29#include "entry.hpp"
30#include <ros2_lifecycle_manager/lifecycle_manager_interface.hpp>
31
32#include <carma_driver_msgs/msg/driver_status.hpp>
33#include <carma_msgs/msg/system_alert.hpp>
34#include <carma_planning_msgs/msg/plugin.hpp>
35#include <carma_planning_msgs/srv/get_plugin_api.hpp>
36#include <carma_planning_msgs/srv/plugin_activation.hpp>
37#include <carma_planning_msgs/srv/plugin_list.hpp>
38
40{
46{
47public:
52
60 SSCDriverManager(const std::string & ssc_driver_name, const long driver_timeout);
61
66 const carma_driver_msgs::msg::DriverStatus::SharedPtr msg, long current_time);
67
71 bool is_ssc_driver_operational(long current_time);
72
76 carma_msgs::msg::SystemAlert get_latest_system_alert(
77 long time_now, long start_up_timestamp, long startup_duration);
78
79protected:
80 // list of critical drivers
81 std::string ssc_driver_name_ = "";
82
84 std::shared_ptr<Entry> latest_ssc_status_entry_ = std::make_shared<Entry>();
85
86 // timeout for critical driver timeout in milliseconds
87 long driver_timeout_ = 1000;
88
89 bool starting_up_ = true;
90
91 FRIEND_TEST(DriverManagerTest, testCarTruckHandleSpinFatalUnknown);
92};
93} // namespace subsystem_controllers
The SSCDriverManager serves as a component to manage ROS1 SSC Driver in CARMA which is primarily in R...
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::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.
FRIEND_TEST(DriverManagerTest, testCarTruckHandleSpinFatalUnknown)
carma_msgs::msg::SystemAlert get_latest_system_alert(long time_now, long start_up_timestamp, long startup_duration)
Handle the spin and publisher.