Easy Navigation
Loading...
Searching...
No Matches
DetectionsPerception.hpp
Go to the documentation of this file.
1// Copyright 2025 Intelligent Robotics Lab
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
21
22#ifndef EASYNAV_COMMON_TYPES__DETECTIONSPERCEPTIONS_HPP_
23#define EASYNAV_COMMON_TYPES__DETECTIONSPERCEPTIONS_HPP_
24
25#include <string>
26#include <vector>
27
28#include "vision_msgs/msg/detection3_d_array.hpp"
29
30#include "rclcpp_lifecycle/lifecycle_node.hpp"
31
33
34namespace easynav
35{
36
42{
43public:
45 static constexpr std::string_view default_group_ = "detections";
46
50 static inline bool supports_msg_type(std::string_view t)
51 {
52 return t == "vision_msgs/msg/Detection3DArray";
53 }
54
56 vision_msgs::msg::Detection3DArray data;
57};
58
65{
66public:
69 std::string group() const override {return "detections";}
70
74 std::shared_ptr<PerceptionBase> create(const std::string &) override
75 {
76 return std::make_shared<DetectionsPerception>();
77 }
78
90 rclcpp::SubscriptionBase::SharedPtr create_subscription(
91 rclcpp_lifecycle::LifecycleNode & node,
92 const std::string & topic,
93 const std::string & type,
94 std::shared_ptr<PerceptionBase> target,
95 rclcpp::CallbackGroup::SharedPtr cb_group) override;
96};
97
105 std::vector<std::shared_ptr<DetectionsPerception>>;
106
110rclcpp::Time get_latest_detections_perceptions_stamp(const DetectionsPerceptions & perceptions);
111
112} // namespace easynav
113
114#endif // EASYNAV_COMMON_TYPES__DETECTIONSPERCEPTIONS_HPP_
Defines data structures and utilities for representing and processing sensor perceptions.
Definition DetectionsPerception.hpp:42
static bool supports_msg_type(std::string_view t)
Returns whether the given ROS 2 type name is supported by this perception.
Definition DetectionsPerception.hpp:50
static constexpr std::string_view default_group_
Group identifier for image perceptions.
Definition DetectionsPerception.hpp:45
vision_msgs::msg::Detection3DArray data
Detection3DArray data received from the an external processing system.
Definition DetectionsPerception.hpp:56
Handles the creation and updating of DetectionsPerceptions instances from sensor_msgs::msg::Image mes...
Definition DetectionsPerception.hpp:65
std::shared_ptr< PerceptionBase > create(const std::string &) override
Creates a new empty DetectionsPerceptions instance.
Definition DetectionsPerception.hpp:74
std::string group() const override
Returns the group managed by this handler.
Definition DetectionsPerception.hpp:69
rclcpp::SubscriptionBase::SharedPtr create_subscription(rclcpp_lifecycle::LifecycleNode &node, const std::string &topic, const std::string &type, std::shared_ptr< PerceptionBase > target, rclcpp::CallbackGroup::SharedPtr cb_group) override
Creates a subscription to an image topic that updates a target DetectionsPerceptions.
Definition DetectionsPerception.cpp:31
Abstract base class for representing a single sensor perception.
Definition Perceptions.hpp:40
Abstract base interface for group-specific perception handlers.
Definition Perceptions.hpp:116
Definition CircularBuffer.hpp:23
std::vector< std::shared_ptr< DetectionsPerception > > DetectionsPerceptions
Definition DetectionsPerception.hpp:104
rclcpp::Time get_latest_detections_perceptions_stamp(const DetectionsPerceptions &perceptions)
Retrieves the latest timestamp among a set of detection-based perceptions.
Definition DetectionsPerception.cpp:60