AWViz-ROS
Loading...
Searching...
No Matches
transformation_manager.hpp
Go to the documentation of this file.
1// Copyright 2024 Kotaro Uetake.
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#ifndef AWVIZ_COMMON__TRANSFORMATION_MANAGER_HPP_
16#define AWVIZ_COMMON__TRANSFORMATION_MANAGER_HPP_
17
19
20#include <rclcpp/rclcpp.hpp>
21#include <rerun.hpp>
22
23#include <tf2_ros/buffer.h>
24#include <tf2_ros/transform_listener.h>
25
26#include <memory>
27#include <optional>
28#include <string>
29#include <unordered_map>
30
31namespace awviz_common
32{
37{
38public:
46 rclcpp::Node::SharedPtr node, std::shared_ptr<rerun::RecordingStream> stream);
47
53 const std::shared_ptr<std::unordered_map<std::string, std::string>> entities() const
54 {
55 return entities_;
56 }
57
58private:
63 void timer_callback();
64
68 void update_tree();
69
75 void update_entity(const TfFrame & frame);
76
82 void log_transform(const TfFrame & frame);
83
84private:
85 rclcpp::Node::SharedPtr node_;
86 std::shared_ptr<rerun::RecordingStream> stream_;
87 std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
88 std::shared_ptr<tf2_ros::TransformListener> tf_listener_;
89 rclcpp::TimerBase::SharedPtr timer_;
90 std::unique_ptr<TfTree> tf_tree_;
91 std::shared_ptr<std::unordered_map<std::string, std::string>>
92 entities_;
93 std::unordered_map<std::string, double> last_log_stamps_;
94};
95} // namespace awviz_common
96#endif // AWVIZ_COMMON__TRANSFORMATION_MANAGER_HPP_
A class to represent a TF frame information.
Definition: tf_tree.hpp:35
A class to manage transform frames.
Definition: transformation_manager.hpp:37
const std::shared_ptr< std::unordered_map< std::string, std::string > > entities() const
Return the entity paths.
Definition: transformation_manager.hpp:53
Definition: display.hpp:30