23#ifndef EASYNAV_SENSORS_TYPES__ODOMETRYPERCEPTIONS_HPP_
24#define EASYNAV_SENSORS_TYPES__ODOMETRYPERCEPTIONS_HPP_
29#include "nav_msgs/msg/odometry.hpp"
51 return t ==
"nav_msgs/msg/Odometry";
56 [[maybe_unused]]
static const bool _ = [] {
59 std::ostringstream ret;
60 const auto & pose = perception.
data.pose.pose;
61 const auto & twist = perception.
data.twist.twist;
62 ret <<
"{ " << perception.
stamp.seconds()
63 <<
" } OdometryPerception pose = ("
64 << pose.position.x <<
", "
65 << pose.position.y <<
", "
66 << pose.position.z <<
"), twist = ("
67 << twist.linear.x <<
", "
68 << twist.linear.y <<
", "
70 <<
") in frame [" << perception.
frame_id
71 <<
"] with ts " << perception.
stamp.seconds() <<
"\n";
79 nav_msgs::msg::Odometry
data;
101 bool cycle_rt([[maybe_unused]] std::shared_ptr<NavState> nav_state)
override;
105 std::shared_ptr<OdometryPerception> perception_data_ {
nullptr};
108 rclcpp::SubscriptionBase::SharedPtr perception_sub_;
111 std::string odom_ns_key_;
121 std::vector<std::shared_ptr<OdometryPerception>>;
Defines data structures and utilities for representing and processing sensor perceptions.
static void register_printer(std::function< std::string(const T &)> printer)
Registers a pretty-printer for type T used by debug_string().
Definition NavState.hpp:384
Handles the creation and updating of OdometryPerception instances from nav_msgs::msg::Odometry messag...
Definition OdometryPerception.hpp:87
bool cycle_rt(std::shared_ptr< NavState > nav_state) override
Run one real-time sensor processing cycle.
Definition OdometryPerception.cpp:73
void on_initialize() override
Optional post-initialization hook for subclasses.
Definition OdometryPerception.cpp:27
static bool supports_msg_type(std::string_view t)
Returns whether the given ROS 2 type name is supported by this perception.
Definition OdometryPerception.hpp:49
static constexpr std::string_view default_group_
Group identifier for odometry perceptions.
Definition OdometryPerception.hpp:44
OdometryPerception()
Definition OdometryPerception.hpp:54
nav_msgs::msg::Odometry data
Odometry data received from the sensor.
Definition OdometryPerception.hpp:79
Abstract base class for representing a single sensor perception.
Definition Perceptions.hpp:44
rclcpp::Time stamp
Timestamp of the perception (ROS time).
Definition Perceptions.hpp:49
std::string frame_id
Coordinate frame associated with the perception.
Definition Perceptions.hpp:52
Abstract base class for pluginlib-based sensor perception handlers.
Definition Perceptions.hpp:108
Definition CircularBuffer.hpp:23
std::vector< std::shared_ptr< OdometryPerception > > OdometryPerceptions
Alias for a vector of shared pointers to OdometryPerception objects.
Definition OdometryPerception.hpp:120
rclcpp::Time get_latest_odometry_perceptions_stamp(const OdometryPerceptions &perceptions)
Retrieves the latest timestamp among a set of odometry perceptions.
Definition OdometryPerception.cpp:85