costmap_layer.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2008, 2013, Willow Garage, Inc.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of Willow Garage, Inc. nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *
35  * Author: Eitan Marder-Eppstein
36  * David V. Lu!!
37  *********************************************************************/
38 #ifndef COSTMAP_2D_COSTMAP_LAYER_H_
39 #define COSTMAP_2D_COSTMAP_LAYER_H_
40 #include <ros/ros.h>
41 #include <costmap_2d/layer.h>
43 
44 namespace costmap_2d
45 {
46 
47 class CostmapLayer : public Layer, public Costmap2D
48 {
49 public:
51  extra_min_x_(1e6), extra_max_x_(-1e6),
52  extra_min_y_(1e6), extra_max_y_(-1e6) {}
53 
55  {
56  return true;
57  }
58 
59  virtual void matchSize();
60 
70  void addExtraBounds(double mx0, double my0, double mx1, double my1);
71 
72 protected:
73  /*
74  * Updates the master_grid within the specified
75  * bounding box using this layer's values.
76  *
77  * TrueOverwrite means every value from this layer
78  * is written into the master grid.
79  */
80  void updateWithTrueOverwrite(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j);
81 
82  /*
83  * Updates the master_grid within the specified
84  * bounding box using this layer's values.
85  *
86  * Overwrite means every valid value from this layer
87  * is written into the master grid (does not copy NO_INFORMATION)
88  */
89  void updateWithOverwrite(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j);
90 
91  /*
92  * Updates the master_grid within the specified
93  * bounding box using this layer's values.
94  *
95  * Sets the new value to the maximum of the master_grid's value
96  * and this layer's value. If the master value is NO_INFORMATION,
97  * it is overwritten. If the layer's value is NO_INFORMATION,
98  * the master value does not change.
99  */
100  void updateWithMax(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j);
101 
102  /*
103  * Updates the master_grid within the specified
104  * bounding box using this layer's values.
105  *
106  * Sets the new value to the sum of the master grid's value
107  * and this layer's value. If the master value is NO_INFORMATION,
108  * it is overwritten with the layer's value. If the layer's value
109  * is NO_INFORMATION, then the master value does not change.
110  *
111  * If the sum value is larger than INSCRIBED_INFLATED_OBSTACLE,
112  * the master value is set to (INSCRIBED_INFLATED_OBSTACLE - 1).
113  */
114  void updateWithAddition(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j);
115 
127  void touch(double x, double y, double* min_x, double* min_y, double* max_x, double* max_y);
128 
129  /*
130  * Updates the bounding box specified in the parameters
131  * to include the bounding box from the addExtraBounds
132  * call. If addExtraBounds was not called, the method will do nothing.
133  *
134  * Should be called at the beginning of the updateBounds method
135  *
136  * @param min_x bounding box (input and output)
137  * @param min_y bounding box (input and output)
138  * @param max_x bounding box (input and output)
139  * @param max_y bounding box (input and output)
140  */
141  void useExtraBounds(double* min_x, double* min_y, double* max_x, double* max_y);
143 
144 private:
146 };
147 
148 } // namespace costmap_2d
149 #endif // COSTMAP_2D_COSTMAP_LAYER_H_
void updateWithOverwrite(costmap_2d::Costmap2D &master_grid, int min_i, int min_j, int max_i, int max_j)
TFSIMD_FORCE_INLINE const tfScalar & y() const
void useExtraBounds(double *min_x, double *min_y, double *max_x, double *max_y)
void updateWithTrueOverwrite(costmap_2d::Costmap2D &master_grid, int min_i, int min_j, int max_i, int max_j)
void updateWithAddition(costmap_2d::Costmap2D &master_grid, int min_i, int min_j, int max_i, int max_j)
TFSIMD_FORCE_INLINE const tfScalar & x() const
virtual void matchSize()
Implement this to make this layer match the size of the parent costmap.
void addExtraBounds(double mx0, double my0, double mx1, double my1)
void updateWithMax(costmap_2d::Costmap2D &master_grid, int min_i, int min_j, int max_i, int max_j)
A 2D costmap provides a mapping between points in the world and their associated "costs".
Definition: costmap_2d.h:60
void touch(double x, double y, double *min_x, double *min_y, double *max_x, double *max_y)


costmap_2d
Author(s): Eitan Marder-Eppstein, David V. Lu!!, Dave Hershberger, contradict@gmail.com
autogenerated on Thu Jan 21 2021 04:05:42