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 <tf/tf.h>
44 #include <tf/transform_listener.h>
45 
46 namespace costmap_2d
47 {
48 class LayeredCostmap;
49 
50 class Layer
51 {
52 public:
53  Layer();
54 
55  void initialize(LayeredCostmap* parent, std::string name, tf::TransformListener *tf);
56 
65  virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, double* min_y,
66  double* max_x, double* max_y) {}
67 
72  virtual void updateCosts(Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j) {}
73 
75  virtual void deactivate() {}
76 
78  virtual void activate() {}
79 
80  virtual void reset() {}
81 
82  virtual ~Layer() {}
83 
94  bool isCurrent() const
95  {
96  return current_;
97  }
98 
100  virtual void matchSize() {}
101 
102  std::string getName() const
103  {
104  return name_;
105  }
106 
108  const std::vector<geometry_msgs::Point>& getFootprint() const;
109 
113  virtual void onFootprintChanged() {}
114 
115 protected:
120  virtual void onInitialize() {}
121 
123  bool current_;
124  bool enabled_;
125  std::string name_;
127 
128 private:
129  std::vector<geometry_msgs::Point> footprint_spec_;
130 };
131 
132 } // namespace costmap_2d
133 
134 #endif // COSTMAP_2D_LAYER_H_
LayeredCostmap * layered_costmap_
Definition: layer.h:122
void initialize(LayeredCostmap *parent, std::string name, tf::TransformListener *tf)
Definition: layer.cpp:43
virtual void reset()
Definition: layer.h:80
virtual void onInitialize()
This is called at the end of initialize(). Override to implement subclass-specific initialization...
Definition: layer.h:120
std::string name_
Definition: layer.h:125
std::string getName() const
Definition: layer.h:102
tf::TransformListener * tf_
Definition: layer.h:126
std::vector< geometry_msgs::Point > footprint_spec_
Definition: layer.h:129
virtual void matchSize()
Implement this to make this layer match the size of the parent costmap.
Definition: layer.h:100
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:65
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:72
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:113
bool enabled_
Currently this var is managed by subclasses. TODO: make this managed by this class and/or container c...
Definition: layer.h:124
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:94
const std::vector< geometry_msgs::Point > & getFootprint() const
Convenience function for layered_costmap_->getFootprint().
Definition: layer.cpp:51
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:75
Instantiates different layer plugins and aggregates them into one score.
virtual void activate()
Restart publishers if they&#39;ve been stopped.
Definition: layer.h:78
virtual ~Layer()
Definition: layer.h:82


costmap_2d
Author(s): Eitan Marder-Eppstein, David V. Lu!!, Dave Hershberger, contradict@gmail.com
autogenerated on Sun Mar 3 2019 03:44:17