/home/runner/work/beluga/beluga/beluga_ros/include/beluga_ros/tf2_eigen.hpp Source File

/home/runner/work/beluga/beluga/beluga_ros/include/beluga_ros/tf2_eigen.hpp Source File#

Beluga ROS: /home/runner/work/beluga/beluga/beluga_ros/include/beluga_ros/tf2_eigen.hpp Source File
Beluga ROS
tf2_eigen.hpp
Go to the documentation of this file.
1 // Copyright 2024 Ekumen, 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 #ifndef BELUGA_ROS_TF2_EIGEN_HPP
16 #define BELUGA_ROS_TF2_EIGEN_HPP
17 
18 #if BELUGA_ROS_VERSION == 2
19 #include <tf2_eigen/tf2_eigen.hpp>
20 #include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
21 #elif BELUGA_ROS_VERSION == 1
22 #include <tf2_eigen/tf2_eigen.h>
23 #include <tf2_geometry_msgs/tf2_geometry_msgs.h>
24 #else
25 #error BELUGA_ROS_VERSION is not defined or invalid
26 #endif
27 
28 #include <beluga_ros/messages.hpp>
29 
30 #include <Eigen/Core>
31 
38 namespace tf2 {
39 
41 
45 template <class Scalar>
46 inline beluga_ros::msg::Point toMsg(const Eigen::Matrix<Scalar, 2, 1>& in) {
47  beluga_ros::msg::Point out;
48  out.x = static_cast<double>(in.x());
49  out.y = static_cast<double>(in.y());
50  return out;
51 }
52 
53 } // namespace tf2
54 
55 #endif // BELUGA_ROS_TF2_EIGEN_HPP
tf2 namespace extension for message conversion overload resolution.
Definition: tf2_eigen.hpp:38
beluga_ros::msg::Point toMsg(const Eigen::Matrix< Scalar, 2, 1 > &in)
Converts an Eigen Vector2 type to a Point message.
Definition: tf2_eigen.hpp:46