height_diff_layer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020, Sebastian Pütz
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer in the documentation and/or other materials provided
14  * with the distribution.
15  *
16  * 3. Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * authors:
34  * Sebastian Pütz <spuetz@uni-osnabrueck.de>
35  *
36  */
37 
38 #ifndef MESH_MAP__HEIGHTDIFF_LAYER_H
39 #define MESH_MAP__HEIGHTDIFF_LAYER_H
40 
41 #include <dynamic_reconfigure/server.h>
42 #include <mesh_layers/HeightDiffLayerConfig.h>
44 
45 namespace mesh_layers
46 {
51 {
57  virtual bool readLayer();
58 
64  virtual bool writeLayer();
65 
71  virtual float defaultValue()
72  {
73  return std::numeric_limits<float>::infinity();
74  }
75 
81  virtual float threshold();
82 
88  virtual bool computeLayer();
89 
95  bool computeLethals();
96 
102  virtual lvr2::VertexMap<float>& costs();
103 
109  virtual std::set<lvr2::VertexHandle>& lethals()
110  {
111  return lethal_vertices;
112  }
113 
120  virtual void updateLethal(std::set<lvr2::VertexHandle>& added_lethal, std::set<lvr2::VertexHandle>& removed_lethal)
121  {
122  }
123 
131  virtual bool initialize(const std::string& name);
132 
133 private:
134  // Server for Reconfiguration
136  dynamic_reconfigure::Server<mesh_layers::HeightDiffLayerConfig>::CallbackType config_callback;
137  // true if the first reconfigure config has been received; else false
139  // current reconfigure config
140  HeightDiffLayerConfig config;
141 
142  // latest costmap
144  // set of all current lethal vertices
145  std::set<lvr2::VertexHandle> lethal_vertices;
146 
153  void reconfigureCallback(mesh_layers::HeightDiffLayerConfig& cfg, uint32_t level);
154 };
155 
156 } /* namespace mesh_layers */
157 
158 #endif // MESH_MAP__HEIGHTDIFF_LAYER_H
boost::shared_ptr
mesh_layers::HeightDiffLayer::writeLayer
virtual bool writeLayer()
try to write layer to map file
Definition: height_diff_layer.cpp:78
lvr2::AttributeMap
mesh_layers::HeightDiffLayer::threshold
virtual float threshold()
delivers the threshold above which vertices are marked lethal
Definition: height_diff_layer.cpp:93
mesh_layers::HeightDiffLayer::height_diff
lvr2::DenseVertexMap< float > height_diff
Definition: height_diff_layer.h:143
mesh_layers
Definition: height_diff_layer.h:45
mesh_layers::HeightDiffLayer::config
HeightDiffLayerConfig config
Definition: height_diff_layer.h:140
lvr2::VectorMap
mesh_layers::HeightDiffLayer::updateLethal
virtual void updateLethal(std::set< lvr2::VertexHandle > &added_lethal, std::set< lvr2::VertexHandle > &removed_lethal)
update set of lethal vertices by adding and removing vertices
Definition: height_diff_layer.h:120
mesh_layers::HeightDiffLayer::computeLethals
bool computeLethals()
mark vertices with values above the threshold as lethal
Definition: height_diff_layer.cpp:64
mesh_map::AbstractLayer
abstract_layer.h
mesh_layers::HeightDiffLayer::initialize
virtual bool initialize(const std::string &name)
initializes this layer plugin
Definition: height_diff_layer.cpp:132
mesh_layers::HeightDiffLayer::reconfigure_server_ptr
boost::shared_ptr< dynamic_reconfigure::Server< mesh_layers::HeightDiffLayerConfig > > reconfigure_server_ptr
Definition: height_diff_layer.h:135
mesh_layers::HeightDiffLayer::first_config
bool first_config
Definition: height_diff_layer.h:138
mesh_layers::HeightDiffLayer::computeLayer
virtual bool computeLayer()
calculate the values of this layer
Definition: height_diff_layer.cpp:98
mesh_layers::HeightDiffLayer::reconfigureCallback
void reconfigureCallback(mesh_layers::HeightDiffLayerConfig &cfg, uint32_t level)
callback for incoming reconfigure configs
Definition: height_diff_layer.cpp:109
mesh_layers::HeightDiffLayer::lethals
virtual std::set< lvr2::VertexHandle > & lethals()
deliver set containing all vertices marked as lethal
Definition: height_diff_layer.h:109
mesh_layers::HeightDiffLayer::readLayer
virtual bool readLayer()
try read layer from map file
Definition: height_diff_layer.cpp:48
mesh_layers::HeightDiffLayer
Costmap layer which calculates the height difference to avoid steep regions.
Definition: height_diff_layer.h:50
mesh_layers::HeightDiffLayer::defaultValue
virtual float defaultValue()
delivers the default layer value
Definition: height_diff_layer.h:71
mesh_layers::HeightDiffLayer::lethal_vertices
std::set< lvr2::VertexHandle > lethal_vertices
Definition: height_diff_layer.h:145
mesh_layers::HeightDiffLayer::costs
virtual lvr2::VertexMap< float > & costs()
deliver the current costmap
Definition: height_diff_layer.cpp:104
mesh_layers::HeightDiffLayer::config_callback
dynamic_reconfigure::Server< mesh_layers::HeightDiffLayerConfig >::CallbackType config_callback
Definition: height_diff_layer.h:136


mesh_layers
Author(s): Sebastian Pütz
autogenerated on Thu Jan 25 2024 03:43:03