Autoware.Auto
ndt/include/ndt/constraints.hpp
Go to the documentation of this file.
1 // Copyright 2021 Apex.AI, 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 NDT__CONSTRAINTS_HPP_
16 #define NDT__CONSTRAINTS_HPP_
17 
19 #include <string>
20 #include <type_traits>
21 #include <vector>
22 
23 namespace autoware
24 {
25 namespace localization
26 {
27 namespace ndt
28 {
29 enum class Requires {};
30 
31 namespace traits
32 {
35 template<typename MapT>
37 {
41  template<typename Map>
42  using call_frame_id = decltype(std::declval<Map>().frame_id());
43 
46  template<typename Map>
47  using call_stamp = decltype(std::declval<Map>().stamp());
48 
49  static_assert(
51  const std::string &>::value,
52  "The map should provide a `frame_id()` method");
53 
54  static_assert(
56  std::chrono::system_clock::time_point>::value,
57  "The map should provide a `stamp()` method");
58 
59  static constexpr Requires value{};
60 };
61 
64 template<typename MapT>
66 {
68  using Voxel = typename MapT::Voxel;
69  using VoxelViewVector = std::vector<VoxelView<Voxel>>;
70  using Point = Eigen::Vector3d;
71 
72 
75  template<typename Map>
76  using call_cell = decltype(std::declval<Map>().cell(std::declval<const Point &>()));
77 
80  template<typename Map>
81  using call_cell_size = decltype(std::declval<Map>().cell_size());
82 
83  static_assert(
85  const VoxelViewVector &>::value,
86  "The map should provide a `cell(...)` method");
87 
88  static_assert(
91  "The map should provide a `cell_size()` method");
92 
93  static constexpr Requires value{};
94 };
95 
96 // Define static members
97 template<typename T>
99 template<typename T>
101 } // namespace traits
102 } // namespace ndt
103 } // namespace localization
104 } // namespace autoware
105 
106 #endif // NDT__CONSTRAINTS_HPP_
This constraint expresses the map interface requirements for the localizer.
Definition: ndt/include/ndt/constraints.hpp:65
This constraint expresses the map interface requirements for the localizer.
Definition: ndt/include/ndt/constraints.hpp:36
decltype(std::declval< Map >().stamp()) call_stamp
This expression requires a method that returns the (std::chrono) timestamp of the.
Definition: ndt/include/ndt/constraints.hpp:47
decltype(std::declval< Map >().frame_id()) call_frame_id
This expression requires a method that returns a const reference to the frame ID of the map...
Definition: ndt/include/ndt/constraints.hpp:42
std::vector< VoxelView< Voxel > > VoxelViewVector
Definition: ndt/include/ndt/constraints.hpp:69
Requires
Definition: ndt/include/ndt/constraints.hpp:29
geometry_msgs::msg::Point32 PointXYZ
Definition: perception/filters/voxel_grid/include/voxel_grid/config.hpp:47
typename MapT::Voxel Voxel
The map type should expose the voxel type.
Definition: ndt/include/ndt/constraints.hpp:68
decltype(std::declval< Map >().cell_size()) call_cell_size
This expression requires a method that returns the (std::chrono) timestamp of the.
Definition: ndt/include/ndt/constraints.hpp:81
decltype(std::declval< Map >().cell(std::declval< const Point & >())) call_cell
This expression requires a method that looks up the cells at the given location.
Definition: ndt/include/ndt/constraints.hpp:76
Eigen::Vector3d Point
Definition: ndt/include/ndt/constraints.hpp:70
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24