SMACC2
Loading...
Searching...
No Matches
cp_transforms.hpp
Go to the documentation of this file.
1// Copyright 2026 RobosoftAI Inc.
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#pragma once
16
17#include <tf2/LinearMath/Transform.h>
18#include <tf2_ros/buffer.h>
19#include <tf2_ros/transform_listener.h>
20#include <rclcpp/rclcpp.hpp>
21#include <smacc2/smacc.hpp>
22
23#include <memory>
24#include <optional>
25#include <string>
26
27namespace cl_rgb
28{
29
30// The transform tree, shared by the cameras of the client.
32{
33public:
35 ~CpTransforms() override;
36
37 void onInitialize() override;
38
39 // pose of the source frame in the target frame at the given time; nothing when not known
40 std::optional<tf2::Transform> lookup(
41 const std::string & targetFrame, const std::string & sourceFrame,
42 const rclcpp::Time & stamp) const;
43
44private:
45 std::shared_ptr<tf2_ros::Buffer> buffer_;
46 std::shared_ptr<tf2_ros::TransformListener> listener_;
47};
48
49} // namespace cl_rgb
std::optional< tf2::Transform > lookup(const std::string &targetFrame, const std::string &sourceFrame, const rclcpp::Time &stamp) const
std::shared_ptr< tf2_ros::Buffer > buffer_
void onInitialize() override
std::shared_ptr< tf2_ros::TransformListener > listener_