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.
template_control_plugin_node.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) <SUB><year> LEIDOS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16
17#pragma once
18
19#include <rclcpp/rclcpp.hpp>
20#include <functional>
21#include <std_msgs/msg/string.hpp>
22#include <std_srvs/srv/empty.hpp>
23
25#include "<SUB><package_name>/<SUB><package_name>_config.hpp"
26
27namespace <SUB><package_name>
28{
29
34 class Node : public carma_guidance_plugins::ControlPlugin
35 {
36
37 private:
38 // Subscribers
39 carma_ros2_utils::SubPtr<std_msgs::msg::String> example_sub_;
40
41 // Publishers
42 carma_ros2_utils::PubPtr<std_msgs::msg::String> example_pub_;
43
44 // Service Clients
45 carma_ros2_utils::ClientPtr<std_srvs::srv::Empty> example_client_;
46
47 // Service Servers
48 carma_ros2_utils::ServicePtr<std_srvs::srv::Empty> example_service_;
49
50 // Timers
51 rclcpp::TimerBase::SharedPtr example_timer_;
52
53 // Node configuration
54 Config config_;
55
56 public:
60 explicit Node(const rclcpp::NodeOptions &);
61
65 rcl_interfaces::msg::SetParametersResult
66 parameter_update_callback(const std::vector<rclcpp::Parameter> &parameters);
67
71 void example_timer_callback();
72
76 void example_callback(std_msgs::msg::String::UniquePtr msg);
77
81 void example_service_callback(const std::shared_ptr<rmw_request_id_t> header,
82 const std::shared_ptr<std_srvs::srv::Empty::Request> request,
83 std::shared_ptr<std_srvs::srv::Empty::Response> response);
84
86 // Overrides
88 autoware_msgs::msg::ControlCommandStamped generate_command() override;
89
90 bool get_availability() override;
91
92 std::string get_version_id() override;
93
97 carma_ros2_utils::CallbackReturn on_configure_plugin();
98
108 };
109
110} // <SUB><package_name>