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.
external_object_list_to_sdsm_component.hpp
Go to the documentation of this file.
1// Copyright 2023 Leidos
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef CARMA_COOPERATIVE_PERCEPTION__EXTERNAL_OBJECT_LIST_TO_SDSM_COMPONENT_HPP_
16#define CARMA_COOPERATIVE_PERCEPTION__EXTERNAL_OBJECT_LIST_TO_SDSM_COMPONENT_HPP_
17
18#include <carma_perception_msgs/msg/external_object_list.hpp>
19#include <carma_ros2_utils/carma_lifecycle_node.hpp>
20#include <carma_v2x_msgs/msg/sensor_data_sharing_message.hpp>
21#include <rclcpp/rclcpp.hpp>
22#include <std_msgs/msg/string.hpp>
23
24#include <geometry_msgs/msg/pose_stamped.hpp>
25
26#include <lanelet2_core/geometry/Lanelet.h>
27#include <lanelet2_extension/projection/local_frame_projector.h>
28
29#include <memory>
30#include <string>
31
33{
34class ExternalObjectListToSdsmNode : public carma_ros2_utils::CarmaLifecycleNode
35{
36 using sdsm_msg_type = carma_v2x_msgs::msg::SensorDataSharingMessage;
37 using external_objects_msg_type = carma_perception_msgs::msg::ExternalObjectList;
38 using georeference_msg_type = std_msgs::msg::String;
39
40 using pose_msg_type = geometry_msgs::msg::PoseStamped;
41
42public:
43 explicit ExternalObjectListToSdsmNode(const rclcpp::NodeOptions & options);
44
45 auto handle_on_configure(const rclcpp_lifecycle::State & /* previous_state */)
46 -> carma_ros2_utils::CallbackReturn override;
47
48 auto handle_on_cleanup(const rclcpp_lifecycle::State & /* previous_state */)
49 -> carma_ros2_utils::CallbackReturn override;
50
51 auto handle_on_shutdown(const rclcpp_lifecycle::State & /* previous_state */)
52 -> carma_ros2_utils::CallbackReturn override;
53
54 auto publish_as_sdsm(const external_objects_msg_type & msg) const -> void;
55
56 auto update_georeference(const georeference_msg_type & proj_string) -> void;
57
58 auto update_current_pose(const pose_msg_type & pose) -> void;
59
60private:
61 rclcpp_lifecycle::LifecyclePublisher<sdsm_msg_type>::SharedPtr sdsm_publisher_{nullptr};
62 rclcpp::Subscription<external_objects_msg_type>::SharedPtr external_objects_subscription_{
63 nullptr};
64 rclcpp::Subscription<georeference_msg_type>::SharedPtr georeference_subscription_{nullptr};
65 rclcpp::Subscription<pose_msg_type>::SharedPtr current_pose_subscription_{nullptr};
66
67 std::string map_georeference_{""};
68 geometry_msgs::msg::PoseStamped current_pose_;
69
70 std::shared_ptr<lanelet::projection::LocalFrameProjector> map_projector_{nullptr};
71 OnSetParametersCallbackHandle::SharedPtr on_set_parameters_callback_{nullptr};
72};
73} // namespace carma_cooperative_perception
74
75#endif // CARMA_COOPERATIVE_PERCEPTION__EXTERNAL_OBJECT_LIST_TO_SDSM_COMPONENT_HPP_
std::shared_ptr< lanelet::projection::LocalFrameProjector > map_projector_
auto publish_as_sdsm(const external_objects_msg_type &msg) const -> void
auto handle_on_shutdown(const rclcpp_lifecycle::State &) -> carma_ros2_utils::CallbackReturn override
auto handle_on_cleanup(const rclcpp_lifecycle::State &) -> carma_ros2_utils::CallbackReturn override
rclcpp::Subscription< external_objects_msg_type >::SharedPtr external_objects_subscription_
rclcpp::Subscription< georeference_msg_type >::SharedPtr georeference_subscription_
auto handle_on_configure(const rclcpp_lifecycle::State &) -> carma_ros2_utils::CallbackReturn override
auto update_georeference(const georeference_msg_type &proj_string) -> void
rclcpp_lifecycle::LifecyclePublisher< sdsm_msg_type >::SharedPtr sdsm_publisher_