Easy Navigation
Loading...
Searching...
No Matches
RTTFBuffer.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
15
16#ifndef EASYNAV_COMMON_TYPES__RTTFBUFFER_HPP_
17#define EASYNAV_COMMON_TYPES__RTTFBUFFER_HPP_
18
21
22#include "tf2_ros/buffer.hpp"
23
24namespace easynav
25{
26
32class RTTFBuffer : public tf2_ros::Buffer, public Singleton<RTTFBuffer>
33{
34public:
35 explicit RTTFBuffer(const rclcpp::Clock::SharedPtr & clock)
36 : tf2_ros::Buffer(clock)
37 {}
38
39 explicit RTTFBuffer()
40 : Buffer(std::make_shared<rclcpp::Clock>(RCL_ROS_TIME))
41 {
42 RCLCPP_WARN(rclcpp::get_logger("RTTFBuffer"),
43 "You should be creating this RTTFBuffer with your clock."
44 "Using default clock RCL_ROS_TIME");
45 }
46
47 const TFInfo & get_tf_info() const
48 {
49 return tf_info_;
50 }
51
52 void set_tf_info(const TFInfo & tf_info)
53 {
54 tf_info_ = tf_info;
55
56 // Apply tf_prefix to all frames
57 if (tf_info_.tf_prefix != "") {
58 tf_info_.map_frame = tf_info_.tf_prefix + "/" + tf_info_.map_frame;
59 tf_info_.odom_frame = tf_info_.tf_prefix + "/" + tf_info_.odom_frame;
60 tf_info_.robot_frame = tf_info_.tf_prefix + "/" + tf_info_.robot_frame;
61 tf_info_.robot_footprint_frame = tf_info_.tf_prefix + "/" + tf_info_.robot_footprint_frame;
62 tf_info_.world_frame = tf_info_.tf_prefix + "/" + tf_info_.world_frame;
63 }
64 }
65
66private:
67 TFInfo tf_info_;
68
70};
71
72} // namespace easynav
73
74
75#endif // EASYNAV_COMMON_TYPES__RTTFBUFFER_HPP_
#define SINGLETON_DEFINITIONS(ClassName)
Definition Singleton.hpp:70
Provides functionality for RTTFBuffer.
Definition RTTFBuffer.hpp:33
const TFInfo & get_tf_info() const
Definition RTTFBuffer.hpp:47
RTTFBuffer()
Definition RTTFBuffer.hpp:39
void set_tf_info(const TFInfo &tf_info)
Definition RTTFBuffer.hpp:52
RTTFBuffer(const rclcpp::Clock::SharedPtr &clock)
Definition RTTFBuffer.hpp:35
Definition CircularBuffer.hpp:23
Definition PointPerception.hpp:49
Aggregated TF configuration used across EasyNav.
Definition TFInfo.hpp:25