UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
semantic_propagation.hpp
1
42#ifndef UFO_MAP_SEMANTIC_PROPAGATION_HPP
43#define UFO_MAP_SEMANTIC_PROPAGATION_HPP
44
45// UFO
46#include <ufo/container/range.hpp>
47#include <ufo/map/semantic/semantic.hpp>
48#include <ufo/map/types.hpp>
49
50// STL
51#include <algorithm>
52#include <queue>
53#include <set>
54#include <string>
55#include <unordered_map>
56#include <unordered_set>
57
58namespace ufo
59{
61{
62 public:
63 constexpr void setDefault(PropagationCriteria prop_criteria)
64 {
65 default_prop_criteria_ = prop_criteria;
66 }
67
68 void set(SemanticRange range, PropagationCriteria prop_criteria)
69 {
70 prop_criteria_.insert_or_assign(range, prop_criteria);
71 }
72
73 template <class InputIt>
74 void set(InputIt first, InputIt last, PropagationCriteria prop_criteria)
75 {
76 std::for_each(first, last, [this, prop_criteria](auto r) { set(r, prop_criteria); });
77 }
78
79 void erase(SemanticRange range) { prop_criteria_.erase(range); }
80
81 template <class InputIt>
82 void erase(InputIt first, InputIt last)
83 {
84 std::for_each(first, last, [this](auto e) { erase(e); });
85 }
86
87 void clear() { prop_criteria_.clear(); }
88
89 [[nodiscard]] bool empty() const { return prop_criteria_.empty(); }
90
91 [[nodiscard]] constexpr PropagationCriteria defaultPropCriteria() const noexcept
92 {
93 return default_prop_criteria_;
94 }
95
96 [[nodiscard]] PropagationCriteria propCriteria(label_t label) const
97 {
98 auto it = prop_criteria_.find(label);
99 return prop_criteria_.end() == it ? defaultPropCriteria() : it->second;
100 }
101
102 private:
103 PropagationCriteria default_prop_criteria_;
105};
106} // namespace ufo
107
108#endif // UFO_MAP_SEMANTIC_PROPAGATION_HPP
All vision-related classes and functions.
Definition cloud.hpp:49