38 #include <geometric_shapes/check_isometry.h>
39 #include <rclcpp/logger.hpp>
40 #include <rclcpp/logging.hpp>
41 #include <tf2_eigen/tf2_eigen.hpp>
42 #include <boost/algorithm/string/trim.hpp>
49 static const rclcpp::Logger LOGGER = rclcpp::get_logger(
"moveit_transforms.transforms");
56 RCLCPP_ERROR(LOGGER,
"The target frame for MoveIt Transforms cannot be empty.");
66 if (frame1.empty() || frame2.empty())
68 return frame1 == frame2;
85 for (
const auto& t : transforms)
87 ASSERT_ISOMETRY(t.second)
102 if (!from_frame.empty())
104 FixedTransformsMap::const_iterator it =
transforms_map_.find(from_frame);
110 RCLCPP_ERROR(LOGGER,
"Unable to transform from frame '%s' to frame '%s'. Returning identity.", from_frame.c_str(),
114 static const Eigen::Isometry3d IDENTITY = Eigen::Isometry3d::Identity();
120 if (from_frame.empty())
129 if (from_frame.empty())
131 RCLCPP_ERROR(LOGGER,
"Cannot record transform with empty name");
143 const auto& trans = transform.transform.translation;
144 const auto& rot = transform.transform.rotation;
145 Eigen::Translation3d translation(trans.x, trans.y, trans.z);
146 Eigen::Quaterniond rotation(rot.w, rot.x, rot.y, rot.z);
147 rotation.normalize();
149 setTransform(translation * rotation, transform.header.frame_id);
153 RCLCPP_ERROR(LOGGER,
"Given transform is to frame '%s', but frame '%s' was expected.",
160 for (
const geometry_msgs::msg::TransformStamped& transform : transforms)
170 transforms[i] = tf2::eigenToTransform(it->second);
172 transforms[i].header.frame_id = it->first;
std::map< std::string, Eigen::Isometry3d, std::less< std::string >, Eigen::aligned_allocator< std::pair< const std::string, Eigen::Isometry3d > > > FixedTransformsMap
Map frame names to the transformation matrix that can transform objects from the frame name to the pl...
Main namespace for MoveIt.