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 {
51 class Costmap2DPublisher
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
costmap_2d::Costmap2DPublisher::saved_origin_x_
double saved_origin_x_
Definition: costmap_2d_publisher.h:135
costmap_2d::Costmap2DPublisher::node
ros::NodeHandle * node
Definition: costmap_2d_publisher.h:131
ros::Publisher
costmap_2d::Costmap2DPublisher::active_
bool active_
Definition: costmap_2d_publisher.h:136
ros.h
costmap_2d::Costmap2DPublisher::global_frame_
std::string global_frame_
Definition: costmap_2d_publisher.h:133
costmap_2d::Costmap2DPublisher::costmap_update_pub_
ros::Publisher costmap_update_pub_
Definition: costmap_2d_publisher.h:139
costmap_2d::Costmap2D
A 2D costmap provides a mapping between points in the world and their associated "costs".
Definition: costmap_2d.h:96
costmap_2d::Costmap2DPublisher::publishCostmap
void publishCostmap()
Publishes the visualization data over ROS.
Definition: costmap_2d_publisher.cpp:156
costmap_2d::Costmap2DPublisher::y0_
unsigned int y0_
Definition: costmap_2d_publisher.h:134
costmap_2d::Costmap2DPublisher::Costmap2DPublisher
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.
Definition: costmap_2d_publisher.cpp:83
costmap_2d.h
costmap_2d::Costmap2DPublisher::always_send_full_costmap_
bool always_send_full_costmap_
Definition: costmap_2d_publisher.h:137
ros::SingleSubscriberPublisher
costmap_2d::Costmap2DPublisher::costmap_
Costmap2D * costmap_
Definition: costmap_2d_publisher.h:132
costmap_2d::Costmap2DPublisher::cost_translation_table_
static char * cost_translation_table_
Translate from 0-255 values in costmap to -1 to 100 values in message.
Definition: costmap_2d_publisher.h:141
costmap_2d::Costmap2DPublisher::prepareGrid
void prepareGrid()
Prepare grid_ message for publication.
Definition: costmap_2d_publisher.cpp:126
costmap_2d::Costmap2DPublisher::onNewSubscription
void onNewSubscription(const ros::SingleSubscriberPublisher &pub)
Publish the latest full costmap to the new subscriber.
Definition: costmap_2d_publisher.cpp:119
costmap_2d::Costmap2DPublisher::costmap_pub_
ros::Publisher costmap_pub_
Definition: costmap_2d_publisher.h:138
costmap_2d::Costmap2DPublisher::xn_
unsigned int xn_
Definition: costmap_2d_publisher.h:134
costmap_2d::Costmap2DPublisher::saved_origin_y_
double saved_origin_y_
Definition: costmap_2d_publisher.h:135
costmap_2d::Costmap2DPublisher::updateBounds
void updateBounds(unsigned int x0, unsigned int xn, unsigned int y0, unsigned int yn)
Include the given bounds in the changed-rectangle.
Definition: costmap_2d_publisher.h:102
costmap_2d::Costmap2DPublisher::active
bool active()
Check if the publisher is active.
Definition: costmap_2d_publisher.h:119
costmap_2d::Costmap2DPublisher::grid_
nav_msgs::OccupancyGrid grid_
Definition: costmap_2d_publisher.h:140
costmap_2d
Definition: array_parser.h:37
costmap_2d::Costmap2DPublisher::x0_
unsigned int x0_
Definition: costmap_2d_publisher.h:134
costmap_2d::Costmap2DPublisher::yn_
unsigned int yn_
Definition: costmap_2d_publisher.h:134
costmap_2d::Costmap2DPublisher::~Costmap2DPublisher
~Costmap2DPublisher()
Destructor.
Definition: costmap_2d_publisher.cpp:115
ros::NodeHandle


costmap_2d
Author(s): Eitan Marder-Eppstein, David V. Lu!!, Dave Hershberger, contradict@gmail.com
autogenerated on Mon Mar 6 2023 03:50:17