costmap_2d_publisher.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_2D_PUBLISHER_H_
39 #define COSTMAP_2D_COSTMAP_2D_PUBLISHER_H_
40 #include <ros/ros.h>
41 #include <costmap_2d/costmap_2d.h>
42 #include <nav_msgs/OccupancyGrid.h>
43 #include <map_msgs/OccupancyGridUpdate.h>
44 
45 namespace costmap_2d
46 {
52 {
53 public:
57  Costmap2DPublisher(ros::NodeHandle * ros_node, Costmap2D* costmap, std::string global_frame,
58  std::string topic_name, bool always_send_full_costmap = false);
59 
64 
66  void updateBounds(unsigned int x0, unsigned int xn, unsigned int y0, unsigned int yn)
67  {
68  x0_ = std::min(x0, x0_);
69  xn_ = std::max(xn, xn_);
70  y0_ = std::min(y0, y0_);
71  yn_ = std::max(yn, yn_);
72  }
73 
77  void publishCostmap();
78 
83  bool active()
84  {
85  return active_;
86  }
87 
88 private:
90  void prepareGrid();
91 
94 
97  std::string global_frame_;
98  unsigned int x0_, xn_, y0_, yn_;
100  bool active_;
104  nav_msgs::OccupancyGrid grid_;
105  static char* cost_translation_table_;
106 };
107 } // namespace costmap_2d
108 #endif // COSTMAP_2D_COSTMAP_2D_PUBLISHER_H
bool active()
Check if the publisher is active.
void onNewSubscription(const ros::SingleSubscriberPublisher &pub)
Publish the latest full costmap to the new subscriber.
void prepareGrid()
Prepare grid_ message for publication.
static char * cost_translation_table_
Translate from 0-255 values in costmap to -1 to 100 values in message.
A tool to periodically publish visualization data from a Costmap2D.
void updateBounds(unsigned int x0, unsigned int xn, unsigned int y0, unsigned int yn)
Include the given bounds in the changed-rectangle.
A 2D costmap provides a mapping between points in the world and their associated "costs".
Definition: costmap_2d.h:60
Costmap2DPublisher(ros::NodeHandle *ros_node, Costmap2D *costmap, std::string global_frame, std::string topic_name, bool always_send_full_costmap=false)
Constructor for the Costmap2DPublisher.
void publishCostmap()
Publishes the visualization data over ROS.


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