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.
route_node.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 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 <carma_planning_msgs/msg/route.hpp>
23#include <carma_planning_msgs/msg/route_state.hpp>
24#include <carma_planning_msgs/msg/route_event.hpp>
25#include <visualization_msgs/msg/marker.hpp>
26#include <carma_planning_msgs/srv/get_available_routes.hpp>
27#include <carma_planning_msgs/srv/set_active_route.hpp>
28#include <carma_planning_msgs/srv/abort_active_route.hpp>
29#include <geometry_msgs/msg/twist_stamped.hpp>
30
33#include <tf2_ros/transform_listener.h>
34
35#include <carma_ros2_utils/carma_lifecycle_node.hpp>
38
39namespace route
40{
41
50 class Route : public carma_ros2_utils::CarmaLifecycleNode
51 {
52
53 private:
54 // Subscribers
55 carma_ros2_utils::SubPtr<geometry_msgs::msg::TwistStamped> twist_sub_;
56 carma_ros2_utils::SubPtr<std_msgs::msg::String> geo_sub_;
57
58 // Publishers
59 carma_ros2_utils::PubPtr<carma_planning_msgs::msg::Route> route_pub_;
60 carma_ros2_utils::PubPtr<carma_planning_msgs::msg::RouteState> route_state_pub_;
61 carma_ros2_utils::PubPtr<carma_planning_msgs::msg::RouteEvent> route_event_pub_;
62 carma_ros2_utils::PubPtr<visualization_msgs::msg::Marker> route_marker_pub_;
63
64 // Service Servers
65 carma_ros2_utils::ServicePtr<carma_planning_msgs::srv::GetAvailableRoutes> get_available_route_srv_;
66 carma_ros2_utils::ServicePtr<carma_planning_msgs::srv::SetActiveRoute> set_active_route_srv_;
67 carma_ros2_utils::ServicePtr<carma_planning_msgs::srv::AbortActiveRoute> abort_active_route_srv_;
68
69 // Timers
70 rclcpp::TimerBase::SharedPtr spin_timer_;
71
72 // Node configuration
74
75 // tf2 buffer holds the tree of transforms
76 tf2_ros::Buffer tf2_buffer_;
77
78 // wm listener and pointer to the actual wm object
81
82 // route generator worker
84
85 public:
89 explicit Route(const rclcpp::NodeOptions &);
90
94 rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector<rclcpp::Parameter> &parameters);
95
97 // Overrides
99 carma_ros2_utils::CallbackReturn handle_on_configure(const rclcpp_lifecycle::State &);
100 carma_ros2_utils::CallbackReturn handle_on_activate(const rclcpp_lifecycle::State &);
101 };
102
103} // route
Class which provies automated subscription and threading support for the world model.
Definition: WMListener.hpp:47
The route package provides the following functionality:
Definition: route_node.hpp:51
carma_wm::WorldModelConstPtr wm_
Definition: route_node.hpp:80
RouteGeneratorWorker rg_worker_
Definition: route_node.hpp:83
Route(const rclcpp::NodeOptions &)
Route constructor.
Definition: route_node.cpp:22
rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector< rclcpp::Parameter > &parameters)
Function callback for dynamic parameter updates.
Definition: route_node.cpp:40
carma_ros2_utils::SubPtr< geometry_msgs::msg::TwistStamped > twist_sub_
Definition: route_node.hpp:55
carma_ros2_utils::CallbackReturn handle_on_configure(const rclcpp_lifecycle::State &)
Definition: route_node.cpp:56
rclcpp::TimerBase::SharedPtr spin_timer_
Definition: route_node.hpp:70
carma_ros2_utils::CallbackReturn handle_on_activate(const rclcpp_lifecycle::State &)
Definition: route_node.cpp:124
carma_ros2_utils::ServicePtr< carma_planning_msgs::srv::GetAvailableRoutes > get_available_route_srv_
Definition: route_node.hpp:65
Config config_
Definition: route_node.hpp:73
carma_ros2_utils::SubPtr< std_msgs::msg::String > geo_sub_
Definition: route_node.hpp:56
tf2_ros::Buffer tf2_buffer_
Definition: route_node.hpp:76
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::Route > route_pub_
Definition: route_node.hpp:59
carma_ros2_utils::ServicePtr< carma_planning_msgs::srv::SetActiveRoute > set_active_route_srv_
Definition: route_node.hpp:66
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::RouteState > route_state_pub_
Definition: route_node.hpp:60
carma_ros2_utils::ServicePtr< carma_planning_msgs::srv::AbortActiveRoute > abort_active_route_srv_
Definition: route_node.hpp:67
carma_ros2_utils::PubPtr< visualization_msgs::msg::Marker > route_marker_pub_
Definition: route_node.hpp:62
carma_ros2_utils::PubPtr< carma_planning_msgs::msg::RouteEvent > route_event_pub_
Definition: route_node.hpp:61
carma_wm::WMListener wml_
Definition: route_node.hpp:79
std::shared_ptr< const WorldModel > WorldModelConstPtr
Definition: WorldModel.hpp:452
Struct containing the algorithm configuration values for the route node.