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.
drivers_controller_node.hpp
Go to the documentation of this file.
1#pragma once
2
3/*
4 * Copyright (C) 2021 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
20
21#include <memory>
22
23#include "carma_msgs/msg/system_alert.hpp"
24#include "ros2_lifecycle_manager/ros2_lifecycle_manager.hpp"
25#include "rclcpp/rclcpp.hpp"
26#include <carma_driver_msgs/msg/driver_status.hpp>
29#include "driver_manager.hpp"
30#include <boost/algorithm/string.hpp>
31
33{
34
36 {
37 public:
38
40
42
48 explicit DriversControllerNode(const rclcpp::NodeOptions &options);
49
50
51 private:
52
53 // DriverManager to handle all the driver specific discovery and reporting
54 std::shared_ptr<DriverManager> driver_manager_;
55
58
60 carma_ros2_utils::SubPtr<carma_driver_msgs::msg::DriverStatus> driver_status_sub_;
61
62 // message/service callbacks
63 void driver_discovery_cb(const carma_driver_msgs::msg::DriverStatus::SharedPtr msg);
64
66 void timer_callback();
67
68 carma_ros2_utils::CallbackReturn handle_on_configure(const rclcpp_lifecycle::State &prev_state);
69 carma_ros2_utils::CallbackReturn handle_on_activate(const rclcpp_lifecycle::State &prev_state);
70
72 std::vector<std::string> ros1_required_drivers_;
73 std::vector<std::string> ros1_camera_drivers_;
74
75 // record of startup timestamp
77
78 rclcpp::TimerBase::SharedPtr timer_;
79
80 // Previously published alert message
81 boost::optional<carma_msgs::msg::SystemAlert> prev_alert;
82
83 };
84
85} // namespace v2x_controller
86
A base class for all subsystem_controllers which provides default lifecycle behavior for subsystems.
std::vector< std::string > ros1_required_drivers_
ROS parameters.
DriversControllerConfig config_
Config for user provided parameters.
carma_ros2_utils::SubPtr< carma_driver_msgs::msg::DriverStatus > driver_status_sub_
ROS handles.
boost::optional< carma_msgs::msg::SystemAlert > prev_alert
void driver_discovery_cb(const carma_driver_msgs::msg::DriverStatus::SharedPtr msg)
void timer_callback()
Timer callback function to check status of required ros1 drivers.
carma_ros2_utils::CallbackReturn handle_on_activate(const rclcpp_lifecycle::State &prev_state)
carma_ros2_utils::CallbackReturn handle_on_configure(const rclcpp_lifecycle::State &prev_state)
Stuct containing the algorithm configuration values for the GuidanceController.