Easy Navigation
Loading...
Searching...
No Matches
TransformListener.hpp
Go to the documentation of this file.
1// Copyright 2026 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
17
18#ifndef EASYNAV_COMMON__TRANSFORMLISTENER_HPP_
19#define EASYNAV_COMMON__TRANSFORMLISTENER_HPP_
20
21#include <memory>
22#include <type_traits>
23
24#include "tf2/buffer_core.hpp"
25#include "tf2_ros/transform_listener.hpp"
26
27namespace easynav
28{
29
30namespace detail
31{
32
33// tf2_ros from Lyrical takes NodeInterfaces (TransformListener::RequiredInterfaces)
34template<class T, class = void>
35struct has_required_interfaces : std::false_type {};
36
37template<class T>
38struct has_required_interfaces<T, std::void_t<typename T::RequiredInterfaces>>
39 : std::true_type {};
40
41} // namespace detail
42
49template<class NodeT, class ListenerT = tf2_ros::TransformListener>
50std::unique_ptr<ListenerT> make_transform_listener(
51 tf2::BufferCore & buffer, const std::shared_ptr<NodeT> & node, bool spin_thread = true)
52{
54 return std::make_unique<ListenerT>(buffer, *node, spin_thread);
55 } else {
56 return std::make_unique<ListenerT>(buffer, node, spin_thread);
57 }
58}
59
60} // namespace easynav
61
62#endif // EASYNAV_COMMON__TRANSFORMLISTENER_HPP_
Definition TransformListener.hpp:31
Definition CircularBuffer.hpp:24
std::unique_ptr< ListenerT > make_transform_listener(tf2::BufferCore &buffer, const std::shared_ptr< NodeT > &node, bool spin_thread=true)
Creates a TransformListener attached to node.
Definition TransformListener.hpp:50
Definition PointPerception.hpp:51
Definition TransformListener.hpp:35