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: David V. Lu!!
36  *********************************************************************/
37 #ifndef COSTMAP_2D_LAYER_H_
38 #define COSTMAP_2D_LAYER_H_
39 
40 #include <costmap_2d/costmap_2d.h>
42 #include <string>
43 #include <tf2_ros/buffer.h>
44 
45 namespace costmap_2d
46 {
47 class LayeredCostmap;
48 
49 class Layer
50 {
51 public:
52  Layer();
53 
54  void initialize(LayeredCostmap* parent, std::string name, tf2_ros::Buffer *tf);
55 
64  virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, double* min_y,
65  double* max_x, double* max_y) {}
66 
71  virtual void updateCosts(Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j) {}
72 
74  virtual void deactivate() {}
75 
77  virtual void activate() {}
78 
79  virtual void reset() {}
80 
81  virtual ~Layer() {}
82 
93  bool isCurrent() const
94  {
95  return current_;
96  }
97 
99  virtual void matchSize() {}
100 
101  std::string getName() const
102  {
103  return name_;
104  }
105 
107  const std::vector<geometry_msgs::Point>& getFootprint() const;
108 
112  virtual void onFootprintChanged() {}
113 
114 protected:
119  virtual void onInitialize() {}
120 
122  bool current_;
123  bool enabled_;
124  std::string name_;
126 
127 private:
128  std::vector<geometry_msgs::Point> footprint_spec_;
129 };
130 
131 } // namespace costmap_2d
132 
133 #endif // COSTMAP_2D_LAYER_H_
LayeredCostmap * layered_costmap_
Definition: layer.h:121
std::string getName() const
Definition: layer.h:101
void initialize(LayeredCostmap *parent, std::string name, tf2_ros::Buffer *tf)
Definition: layer.cpp:43
virtual void reset()
Definition: layer.h:79
virtual void onInitialize()
This is called at the end of initialize(). Override to implement subclass-specific initialization...
Definition: layer.h:119
std::string name_
Definition: layer.h:124
const std::vector< geometry_msgs::Point > & getFootprint() const
Convenience function for layered_costmap_->getFootprint().
Definition: layer.cpp:51
tf2_ros::Buffer * tf_
Definition: layer.h:125
std::vector< geometry_msgs::Point > footprint_spec_
Definition: layer.h:128
virtual void matchSize()
Implement this to make this layer match the size of the parent costmap.
Definition: layer.h:99
virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double *min_x, double *min_y, double *max_x, double *max_y)
This is called by the LayeredCostmap to poll this plugin as to how much of the costmap it needs to up...
Definition: layer.h:64
virtual void updateCosts(Costmap2D &master_grid, int min_i, int min_j, int max_i, int max_j)
Actually update the underlying costmap, only within the bounds calculated during UpdateBounds().
Definition: layer.h:71
virtual void onFootprintChanged()
LayeredCostmap calls this whenever the footprint there changes (via LayeredCostmap::setFootprint()). Override to be notified of changes to the robot&#39;s footprint.
Definition: layer.h:112
bool enabled_
Currently this var is managed by subclasses. TODO: make this managed by this class and/or container c...
Definition: layer.h:123
bool isCurrent() const
Check to make sure all the data in the layer is up to date. If the layer is not up to date...
Definition: layer.h:93
A 2D costmap provides a mapping between points in the world and their associated "costs".
Definition: costmap_2d.h:60
virtual void deactivate()
Stop publishers.
Definition: layer.h:74
Instantiates different layer plugins and aggregates them into one score.
virtual void activate()
Restart publishers if they&#39;ve been stopped.
Definition: layer.h:77
virtual ~Layer()
Definition: layer.h:81


costmap_2d
Author(s): Eitan Marder-Eppstein, David V. Lu!!, Dave Hershberger, contradict@gmail.com
autogenerated on Wed Jun 22 2022 02:07:03