24#ifndef EASYNAV_SENSORS__TYPES__ODOMETRYPERCEPTION_HPP_
25#define EASYNAV_SENSORS__TYPES__ODOMETRYPERCEPTION_HPP_
32#include "nav_msgs/msg/odometry.hpp"
53 return t ==
"nav_msgs/msg/Odometry";
58 [[maybe_unused]]
static const bool _ = [] {
61 std::ostringstream ret;
62 const auto & pose = perception.
data.pose.pose;
63 const auto & twist = perception.
data.twist.twist;
64 ret <<
"{ " << perception.
stamp.seconds()
65 <<
" } OdometryPerception pose = ("
66 << pose.position.x <<
", "
67 << pose.position.y <<
", "
68 << pose.position.z <<
"), twist = ("
69 << twist.linear.x <<
", "
70 << twist.linear.y <<
", "
72 <<
") in frame [" << perception.
frame_id
73 <<
"] with ts " << perception.
stamp.seconds() <<
"\n";
81 nav_msgs::msg::Odometry
data;
105 bool cycle_rt([[maybe_unused]] std::shared_ptr<NavState> nav_state)
override;
108 std::shared_ptr<PerceptionBase>
get_perception()
const override {
return perception_data_;}
112 std::shared_ptr<OdometryPerception> perception_data_ {
nullptr};
115 rclcpp::SubscriptionBase::SharedPtr perception_sub_;
118 std::string odom_ns_key_;
128 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:458
Handles the creation and updating of OdometryPerception instances from nav_msgs::msg::Odometry messag...
Definition OdometryPerception.hpp:91
bool cycle_rt(std::shared_ptr< NavState > nav_state) override
Run one real-time sensor processing cycle.
Definition OdometryPerception.cpp:70
void on_initialize() override
Optional post-initialization hook for subclasses.
Definition OdometryPerception.cpp:28
std::shared_ptr< PerceptionBase > get_perception() const override
The perception this handler keeps up to date.
Definition OdometryPerception.hpp:108
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:51
static constexpr std::string_view default_group_
Group identifier for odometry perceptions.
Definition OdometryPerception.hpp:46
OdometryPerception()
Definition OdometryPerception.hpp:56
nav_msgs::msg::Odometry data
Odometry data received from the sensor.
Definition OdometryPerception.hpp:81
Abstract base class for representing a single sensor perception.
Definition Perceptions.hpp:48
rclcpp::Time stamp
Timestamp of the perception (ROS time).
Definition Perceptions.hpp:53
std::string frame_id
Coordinate frame associated with the perception.
Definition Perceptions.hpp:56
Abstract base class for pluginlib-based sensor perception handlers.
Definition Perceptions.hpp:117
Definition CircularBuffer.hpp:24
std::vector< std::shared_ptr< OdometryPerception > > OdometryPerceptions
Alias for a vector of shared pointers to OdometryPerception objects.
Definition OdometryPerception.hpp:127
rclcpp::Time get_latest_odometry_perceptions_stamp(const OdometryPerceptions &perceptions)
Retrieves the latest timestamp among a set of odometry perceptions.
Definition OdometryPerception.cpp:82