Easy Navigation
Toggle main menu visibility
Loading...
Searching...
No Matches
easynav_common
include
easynav_common
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
27
namespace
easynav
28
{
29
30
namespace
detail
31
{
32
33
// tf2_ros from Lyrical takes NodeInterfaces (TransformListener::RequiredInterfaces)
34
template
<
class
T,
class
=
void
>
35
struct
has_required_interfaces
: std::false_type {};
36
37
template
<
class
T>
38
struct
has_required_interfaces
<T,
std
::void_t<typename T::RequiredInterfaces>>
39
: std::true_type {};
40
41
}
// namespace detail
42
49
template
<
class
NodeT,
class
ListenerT = tf2_ros::TransformListener>
50
std::unique_ptr<ListenerT>
make_transform_listener
(
51
tf2::BufferCore & buffer,
const
std::shared_ptr<NodeT> & node,
bool
spin_thread =
true
)
52
{
53
if
constexpr
(
detail::has_required_interfaces<ListenerT>::value
) {
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_
easynav::detail
Definition
TransformListener.hpp:31
easynav
Definition
CircularBuffer.hpp:24
easynav::make_transform_listener
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
std
Definition
PointPerception.hpp:51
easynav::detail::has_required_interfaces
Definition
TransformListener.hpp:35
Generated by
1.18.0