Autoware.Auto
output_type_trait.hpp
Go to the documentation of this file.
1 // Copyright 2020 Apex.AI, Inc., Arm Limited
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 
17 
18 #ifndef COVARIANCE_INSERTION__OUTPUT_TYPE_TRAIT_HPP_
19 #define COVARIANCE_INSERTION__OUTPUT_TYPE_TRAIT_HPP_
20 
21 
22 #include <nav_msgs/msg/odometry.hpp>
23 #include <geometry_msgs/msg/pose_stamped.hpp>
24 #include <geometry_msgs/msg/pose_with_covariance_stamped.hpp>
25 #include <geometry_msgs/msg/twist_stamped.hpp>
26 #include <geometry_msgs/msg/twist_with_covariance_stamped.hpp>
27 
28 
29 template<typename InputT>
30 struct output
31 {
32  using type = InputT;
33 };
34 
35 template<typename InputT, typename Enable = void>
36 struct needs_conversion : public std::true_type {};
37 
38 template<typename InputT>
39 struct needs_conversion<InputT, std::enable_if_t<
40  std::is_same<typename output<InputT>::type, InputT>::value>>: public std::false_type {};
41 
42 // Specializations.
43 template<>
44 struct output<geometry_msgs::msg::Pose>
45 {
46  using type = geometry_msgs::msg::PoseWithCovariance;
47 };
48 
49 template<>
50 struct output<geometry_msgs::msg::PoseStamped>
51 {
52  using type = geometry_msgs::msg::PoseWithCovarianceStamped;
53 };
54 
55 template<>
56 struct output<geometry_msgs::msg::Twist>
57 {
58  using type = geometry_msgs::msg::TwistWithCovariance;
59 };
60 
61 template<>
62 struct output<geometry_msgs::msg::TwistStamped>
63 {
64  using type = geometry_msgs::msg::TwistWithCovarianceStamped;
65 };
66 
67 #endif // COVARIANCE_INSERTION__OUTPUT_TYPE_TRAIT_HPP_
output
Definition: output_type_trait.hpp:30
output< geometry_msgs::msg::Pose >::type
geometry_msgs::msg::PoseWithCovariance type
Definition: output_type_trait.hpp:46
needs_conversion
Definition: output_type_trait.hpp:36
output< geometry_msgs::msg::TwistStamped >::type
geometry_msgs::msg::TwistWithCovarianceStamped type
Definition: output_type_trait.hpp:64
output::type
InputT type
Definition: output_type_trait.hpp:32
output< geometry_msgs::msg::Twist >::type
geometry_msgs::msg::TwistWithCovariance type
Definition: output_type_trait.hpp:58
output< geometry_msgs::msg::PoseStamped >::type
geometry_msgs::msg::PoseWithCovarianceStamped type
Definition: output_type_trait.hpp:52