Autoware.Auto
policies.hpp
Go to the documentation of this file.
1 // Copyright 2020 the Autoware Foundation
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 // Co-developed by Tier IV, Inc. and Apex.AI, Inc.
16 
17 #ifndef POINT_CLOUD_MAPPING__POLICIES_HPP_
18 #define POINT_CLOUD_MAPPING__POLICIES_HPP_
19 
22 #include <sensor_msgs/msg/point_cloud2.hpp>
24 #include <tf2_sensor_msgs/tf2_sensor_msgs.h>
26 #include <memory>
27 #include <string>
28 #include <utility>
29 
30 namespace autoware
31 {
32 namespace mapping
33 {
34 namespace point_cloud_mapping
35 {
38 template<typename Derived>
40 {
41 public:
46  template<typename MapRepresentationT>
47  bool ready(const MapRepresentationT & map) const noexcept
48  {
49  return this->impl().ready_(map);
50  }
51 };
52 
54 class POINT_CLOUD_MAPPING_PUBLIC CapacityTrigger : public TriggerPolicyBase<CapacityTrigger>
55 {
56 public:
57  template<typename MapRepresentationT>
58  bool ready_(const MapRepresentationT & map) const noexcept
59  {
60  return map.size() >= map.capacity();
61  }
62 };
63 
66 template<typename Derived>
68 {
69 public:
70  // TODO(yunus.caliskan): return const ref instead?
71 
75  std::string get(const std::string & base_prefix) const noexcept
76  {
77  return this->impl().get_(base_prefix);
78  }
79 };
80 
82 class POINT_CLOUD_MAPPING_PUBLIC TimeStampPrefixGenerator
83  : public PrefixGeneratorBase<TimeStampPrefixGenerator>
84 {
85 public:
86  std::string get_(const std::string & base_prefix) const noexcept;
87 };
88 } // namespace point_cloud_mapping
89 } // namespace mapping
90 } // namespace autoware
91 
92 #endif // POINT_CLOUD_MAPPING__POLICIES_HPP_
autoware::mapping::point_cloud_mapping::PrefixGeneratorBase::get
std::string get(const std::string &base_prefix) const noexcept
Definition: policies.hpp:75
autoware::mapping::point_cloud_mapping::CapacityTrigger
Trigger map writing when map reaches its capacity.
Definition: policies.hpp:54
localizer_base.hpp
map.hpp
point_cloud_utils.hpp
This class defines common functions and classes to work with pointclouds.
visibility_control.hpp
autoware::mapping::point_cloud_mapping::TriggerPolicyBase
Definition: policies.hpp:39
autoware::mapping::point_cloud_mapping::TriggerPolicyBase::ready
bool ready(const MapRepresentationT &map) const noexcept
Definition: policies.hpp:47
autoware::mapping::point_cloud_mapping::CapacityTrigger::ready_
bool ready_(const MapRepresentationT &map) const noexcept
Definition: policies.hpp:58
autoware::mapping::point_cloud_mapping::PrefixGeneratorBase
Definition: policies.hpp:67
autoware
This file defines the lanelet2_map_provider_node class.
Definition: quick_sort.hpp:24
autoware::common::helper_functions::crtp::impl
const Derived & impl() const
Definition: crtp.hpp:32
autoware::common::helper_functions::crtp
Definition: crtp.hpp:29
autoware::mapping::point_cloud_mapping::TimeStampPrefixGenerator
Prefix generator that adds the current time stamp to the end of the base prefix.
Definition: policies.hpp:82