AWViz-ROS
Loading...
Searching...
No Matches
transform_logger.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__TRANSFORM_LOGGER_HPP_
16#define AWVIZ_COMMON__TRANSFORMATION__TRANSFORM_LOGGER_HPP_
17
19
20#include <rclcpp/rclcpp.hpp>
21#include <rerun.hpp>
22
23#include <tf2_ros/buffer.h>
24
25#include <memory>
26#include <mutex>
27#include <string>
28#include <unordered_map>
29
30namespace awviz_common
31{
36{
37public:
38 virtual ~ITransformLogger() = default;
39
45 virtual void log_transform(const TfFrame & frame) = 0;
46};
47
52{
53public:
55 rclcpp::Node::SharedPtr node, std::shared_ptr<rerun::RecordingStream> stream,
56 std::shared_ptr<tf2_ros::Buffer> tf_buffer,
57 std::shared_ptr<std::unordered_map<std::string, std::string>> entities,
58 std::shared_ptr<std::mutex> entities_mtx);
59
60 void log_transform(const TfFrame & frame) override;
61
62private:
63 rclcpp::Node::SharedPtr node_;
64 std::shared_ptr<rerun::RecordingStream> stream_;
65 std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
66 std::shared_ptr<std::unordered_map<std::string, std::string>> entities_;
67 std::unordered_map<std::string, double> last_log_stamps_;
68 std::shared_ptr<std::mutex> entities_mtx_;
69};
70} // namespace awviz_common
71
72#endif // AWVIZ_COMMON__TRANSFORMATION__TRANSFORM_LOGGER_HPP_
Interface for logging transforms to a recording stream.
Definition: transform_logger.hpp:36
virtual ~ITransformLogger()=default
virtual void log_transform(const TfFrame &frame)=0
Log a transform for the given frame.
A class to represent a TF frame information.
Definition: tf_tree.hpp:36
Default transform logger that uses TF buffer and entity paths.
Definition: transform_logger.hpp:52
void log_transform(const TfFrame &frame) override
Log a transform for the given frame.
Definition: transform_logger.cpp:65
Definition: display.hpp:32