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.
object_visualizer_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 <carma_perception_msgs/msg/external_object_list.hpp>
22#include <carma_perception_msgs/msg/roadway_obstacle_list.hpp>
23#include <visualization_msgs/msg/marker_array.hpp>
24#include <visualization_msgs/msg/marker.hpp>
25
26#include <carma_ros2_utils/carma_lifecycle_node.hpp>
28
29namespace object_visualizer
30{
31
36 class Node : public carma_ros2_utils::CarmaLifecycleNode
37 {
38
39 private:
40 // Subscribers
41 carma_ros2_utils::SubPtr<carma_perception_msgs::msg::ExternalObjectList> external_objects_sub_;
42 carma_ros2_utils::SubPtr<carma_perception_msgs::msg::RoadwayObstacleList> roadway_obstacles_sub_;
43
44 // Publishers
45 carma_ros2_utils::PubPtr<visualization_msgs::msg::MarkerArray> external_objects_viz_pub_;
46 carma_ros2_utils::PubPtr<visualization_msgs::msg::MarkerArray> roadway_obstacles_viz_pub_;
47
48 // Node configuration
50
51 // Previous object report sizes for clearing visualization on deleted objects
54
65 void clear_and_update_old_objects(visualization_msgs::msg::MarkerArray &viz_msg, size_t &old_size);
66
67 public:
71 explicit Node(const rclcpp::NodeOptions &);
72
76 rcl_interfaces::msg::SetParametersResult
77 parameter_update_callback(const std::vector<rclcpp::Parameter> &parameters);
78
84 void external_objects_callback(carma_perception_msgs::msg::ExternalObjectList::UniquePtr msg);
85
91 void roadway_obstacles_callback(carma_perception_msgs::msg::RoadwayObstacleList::UniquePtr msg);
92
93
95 // Overrides
97 carma_ros2_utils::CallbackReturn handle_on_configure(const rclcpp_lifecycle::State &);
98
99 };
100
101} // object_visualizer
This node provides RViz visualization messages for recieved ExternalObject and RoadwayObstacle messag...
void roadway_obstacles_callback(carma_perception_msgs::msg::RoadwayObstacleList::UniquePtr msg)
Roadway obstacles callback. Converts the message to a visualization message to republish.
rcl_interfaces::msg::SetParametersResult parameter_update_callback(const std::vector< rclcpp::Parameter > &parameters)
Example callback for dynamic parameter updates.
carma_ros2_utils::CallbackReturn handle_on_configure(const rclcpp_lifecycle::State &)
carma_ros2_utils::PubPtr< visualization_msgs::msg::MarkerArray > roadway_obstacles_viz_pub_
void clear_and_update_old_objects(visualization_msgs::msg::MarkerArray &viz_msg, size_t &old_size)
Adds a marker deletion for a number of markers which is the delta between the new marker count and th...
carma_ros2_utils::SubPtr< carma_perception_msgs::msg::ExternalObjectList > external_objects_sub_
Node(const rclcpp::NodeOptions &)
Node constructor.
carma_ros2_utils::SubPtr< carma_perception_msgs::msg::RoadwayObstacleList > roadway_obstacles_sub_
carma_ros2_utils::PubPtr< visualization_msgs::msg::MarkerArray > external_objects_viz_pub_
void external_objects_callback(carma_perception_msgs::msg::ExternalObjectList::UniquePtr msg)
External objects callback. Converts the message to a visualization message to republish.
Stuct containing the algorithm configuration values for object_visualizer.