Easy Navigation
Toggle main menu visibility
Loading...
Searching...
No Matches
easynav_common
include
easynav_common
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
19
#include "
easynav_common/Singleton.hpp
"
20
#include "
easynav_common/types/TFInfo.hpp
"
21
22
#include "tf2_ros/buffer.hpp"
23
24
namespace
easynav
25
{
26
32
class
RTTFBuffer
:
public
tf2_ros::Buffer,
public
Singleton
<RTTFBuffer>
33
{
34
public
:
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
66
private
:
67
TFInfo
tf_info_;
68
69
SINGLETON_DEFINITIONS
(
RTTFBuffer
)
70
};
71
72
}
// namespace easynav
73
74
75
#endif
// EASYNAV_COMMON_TYPES__RTTFBUFFER_HPP_
Singleton.hpp
SINGLETON_DEFINITIONS
#define SINGLETON_DEFINITIONS(ClassName)
Definition
Singleton.hpp:70
TFInfo.hpp
easynav::RTTFBuffer
Provides functionality for RTTFBuffer.
Definition
RTTFBuffer.hpp:33
easynav::RTTFBuffer::get_tf_info
const TFInfo & get_tf_info() const
Definition
RTTFBuffer.hpp:47
easynav::RTTFBuffer::RTTFBuffer
RTTFBuffer()
Definition
RTTFBuffer.hpp:39
easynav::RTTFBuffer::set_tf_info
void set_tf_info(const TFInfo &tf_info)
Definition
RTTFBuffer.hpp:52
easynav::RTTFBuffer::RTTFBuffer
RTTFBuffer(const rclcpp::Clock::SharedPtr &clock)
Definition
RTTFBuffer.hpp:35
easynav::Singleton< RTTFBuffer >::Singleton
Singleton()=default
easynav
Definition
CircularBuffer.hpp:23
std
Definition
PointPerception.hpp:49
easynav::TFInfo
Aggregated TF configuration used across EasyNav.
Definition
TFInfo.hpp:25
Generated by
1.17.0