Easy Navigation
Loading...
Searching...
No Matches
Perceptions.hpp
Go to the documentation of this file.
1// Copyright 2025 Intelligent Robotics Lab
2//
3// This file is part of the project Easy Navigation (EasyNav in short)
4// licensed under the GNU General Public License v3.0.
5// See <http://www.gnu.org/licenses/> for details.
6//
7// Easy Navigation program is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19
27
28#ifndef EASYNAV_COMMON_TYPES__PERCEPTIONS_HPP_
29#define EASYNAV_COMMON_TYPES__PERCEPTIONS_HPP_
30
31#include <string>
32
33#include "sensor_msgs/msg/laser_scan.hpp"
34#include "sensor_msgs/msg/point_cloud2.hpp"
35
36#include "pcl/point_cloud.h"
37#include "pcl/point_types.h"
38
39#include "rclcpp/time.hpp"
40#include "rclcpp_lifecycle/lifecycle_node.hpp"
41
42namespace easynav
43{
44
50{
51public:
52 virtual ~PerceptionBase() = default;
53
55 rclcpp::Time stamp;
56
58 std::string frame_id;
59
61 bool valid = false;
62
64 bool new_data = false;
65};
66
73{
75 std::shared_ptr<PerceptionBase> perception;
76
78 rclcpp::SubscriptionBase::SharedPtr subscription;
79};
80
87{
88public:
89 virtual ~PerceptionHandler() = default;
90
94 virtual std::shared_ptr<PerceptionBase> create(const std::string & sensor_id) = 0;
95
107 virtual rclcpp::SubscriptionBase::SharedPtr create_subscription(
108 rclcpp_lifecycle::LifecycleNode & node,
109 const std::string & topic,
110 const std::string & type,
111 std::shared_ptr<PerceptionBase> target,
112 rclcpp::CallbackGroup::SharedPtr cb_group) = 0;
113
120 virtual std::string group() const = 0;
121};
122
123} // namespace easynav
124
125#endif // EASYNAV_COMMON_TYPES__PERCEPTIONS_HPP_
Abstract base class for representing a single sensor perception.
Definition Perceptions.hpp:50
virtual ~PerceptionBase()=default
bool valid
Whether the perception contains valid data.
Definition Perceptions.hpp:61
rclcpp::Time stamp
Timestamp of the perception (ROS time).
Definition Perceptions.hpp:55
bool new_data
Whether the data has changed since the last observation.
Definition Perceptions.hpp:64
std::string frame_id
Coordinate frame associated with the perception.
Definition Perceptions.hpp:58
Abstract base interface for group-specific perception handlers.
Definition Perceptions.hpp:87
virtual std::shared_ptr< PerceptionBase > create(const std::string &sensor_id)=0
Creates a new instance of a perception object managed by this handler.
virtual ~PerceptionHandler()=default
virtual 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)=0
Creates a subscription that processes messages into PerceptionBase instances.
virtual std::string group() const =0
Returns the group identifier associated with this handler.
Definition RTTFBuffer.hpp:30
Represents a perception entry with its state and ROS subscription.
Definition Perceptions.hpp:73
rclcpp::SubscriptionBase::SharedPtr subscription
ROS 2 subscription to the sensor topic that provides data.
Definition Perceptions.hpp:78
std::shared_ptr< PerceptionBase > perception
Atomic shared pointer to the current perception object.
Definition Perceptions.hpp:75