21namespace std_ph = std::placeholders;
24: carma_ros2_utils::CarmaLifecycleNode(options)
29 -> carma_ros2_utils::CallbackReturn
31 RCLCPP_INFO_STREAM(get_logger(),
"RoadwayObjectsNode trying to configure");
33 wm_listener_ = std::make_shared<carma_wm::WMListener>(
34 get_node_base_interface(), get_node_logging_interface(), get_node_topics_interface(),
35 get_node_parameters_interface());
38 create_publisher<carma_perception_msgs::msg::RoadwayObstacleList>(
"roadway_objects", 10);
40 external_objects_sub_ = create_subscription<carma_perception_msgs::msg::ExternalObjectList>(
41 "external_objects", 10,
42 [
this](
const carma_perception_msgs::msg::ExternalObjectList::SharedPtr msg_ptr) {
43 publish_obstacles(*msg_ptr);
46 return CallbackReturn::SUCCESS;
50 const carma_perception_msgs::msg::ExternalObjectList & msg) ->
void
52 carma_perception_msgs::msg::RoadwayObstacleList obstacle_list;
54 const auto map{wm_listener_->getWorldModel()->getMap()};
59 "roadway_objects could not process external objects as no semantic map was available");
64 if (std::size(map->laneletLayer) == 0) {
67 "roadway_objects could not process external objects as the semantic map does not contain any "
73 const auto world_model{wm_listener_->getWorldModel()};
74 for (
auto object : msg.objects) {
75 const auto obstacle{world_model->toRoadwayObstacle(
object)};
77 if (!obstacle.has_value()) {
79 get_logger(),
"roadway_objects dropping detected object with id: "
80 <<
object.
id <<
" as it is off the road.");
85 obstacle_list.roadway_obstacles.emplace_back(obstacle.get());
88 roadway_obs_pub_->publish(obstacle_list);
93#include "rclcpp_components/register_node_macro.hpp"
The class responsible for converting detected objects into objects that are mapped onto specific lane...
auto publish_obstacles(const carma_perception_msgs::msg::ExternalObjectList &msg) -> void
auto handle_on_configure(const rclcpp_lifecycle::State &) -> carma_ros2_utils::CallbackReturn override
RoadwayObjectsNode(const rclcpp::NodeOptions &)