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 #include <tf/transform_datatypes.h>
45 
46 namespace costmap_2d
47 {
53 {
54 public:
58  Costmap2DPublisher(ros::NodeHandle * ros_node, Costmap2D* costmap, std::string global_frame,
59  std::string topic_name, bool always_send_full_costmap = false);
60 
65 
67  void updateBounds(unsigned int x0, unsigned int xn, unsigned int y0, unsigned int yn)
68  {
69  x0_ = std::min(x0, x0_);
70  xn_ = std::max(xn, xn_);
71  y0_ = std::min(y0, y0_);
72  yn_ = std::max(yn, yn_);
73  }
74 
78  void publishCostmap();
79 
84  bool active()
85  {
86  return active_;
87  }
88 
89 private:
91  void prepareGrid();
92 
95 
98  std::string global_frame_;
99  unsigned int x0_, xn_, y0_, yn_;
101  bool active_;
105  nav_msgs::OccupancyGrid grid_;
106  static char* cost_translation_table_;
107 };
108 } // namespace costmap_2d
109 #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 Sun Mar 3 2019 03:44:17