static_layer.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  *
00003  * Software License Agreement (BSD License)
00004  *
00005  *  Copyright (c) 2008, 2013, Willow Garage, Inc.
00006  *  All rights reserved.
00007  *
00008  *  Redistribution and use in source and binary forms, with or without
00009  *  modification, are permitted provided that the following conditions
00010  *  are met:
00011  *
00012  *   * Redistributions of source code must retain the above copyright
00013  *     notice, this list of conditions and the following disclaimer.
00014  *   * Redistributions in binary form must reproduce the above
00015  *     copyright notice, this list of conditions and the following
00016  *     disclaimer in the documentation and/or other materials provided
00017  *     with the distribution.
00018  *   * Neither the name of Willow Garage, Inc. nor the names of its
00019  *     contributors may be used to endorse or promote products derived
00020  *     from this software without specific prior written permission.
00021  *
00022  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033  *  POSSIBILITY OF SUCH DAMAGE.
00034  *
00035  * Author: Eitan Marder-Eppstein
00036  *         David V. Lu!!
00037  *********************************************************************/
00038 #ifndef RTABMAP_ROS_STATIC_LAYER_H_
00039 #define RTABMAP_ROS_STATIC_LAYER_H_
00040 
00041 #include <ros/ros.h>
00042 #include <costmap_2d/costmap_layer.h>
00043 #include <costmap_2d/layered_costmap.h>
00044 #include <costmap_2d/GenericPluginConfig.h>
00045 #include <dynamic_reconfigure/server.h>
00046 #include <nav_msgs/OccupancyGrid.h>
00047 #include <map_msgs/OccupancyGridUpdate.h>
00048 #include <message_filters/subscriber.h>
00049 
00050 namespace rtabmap_ros
00051 {
00052 
00053 class StaticLayer : public costmap_2d::CostmapLayer
00054 {
00055 public:
00056   StaticLayer();
00057   virtual ~StaticLayer();
00058   virtual void onInitialize();
00059   virtual void activate();
00060   virtual void deactivate();
00061   virtual void reset();
00062 
00063   virtual void updateBounds(double robot_x, double robot_y, double robot_yaw, double* min_x, double* min_y, double* max_x,
00064                              double* max_y);
00065   virtual void updateCosts(costmap_2d::Costmap2D& master_grid, int min_i, int min_j, int max_i, int max_j);
00066 
00067   virtual void matchSize();
00068 
00069 private:
00076   void incomingMap(const nav_msgs::OccupancyGridConstPtr& new_map);
00077   void incomingUpdate(const map_msgs::OccupancyGridUpdateConstPtr& update);
00078   void reconfigureCB(costmap_2d::GenericPluginConfig &config, uint32_t level);
00079 
00080   unsigned char interpretValue(unsigned char value);
00081 
00082   std::string global_frame_; 
00083   bool subscribe_to_updates_;
00084   bool map_received_;
00085   bool has_updated_data_;
00086   unsigned int x_,y_,width_,height_;
00087   bool track_unknown_space_;
00088   bool use_maximum_;
00089   bool trinary_costmap_;
00090   ros::Subscriber map_sub_, map_update_sub_;
00091 
00092   unsigned char lethal_threshold_, unknown_cost_value_;
00093 
00094   mutable boost::recursive_mutex lock_;
00095   dynamic_reconfigure::Server<costmap_2d::GenericPluginConfig> *dsrv_;
00096 };
00097 
00098 }  // namespace rtabmap_ros
00099 
00100 #endif  // RTABMAP_ROS_DYNAMIC_LAYER_H_


rtabmap_ros
Author(s): Mathieu Labbe
autogenerated on Thu Aug 27 2015 15:00:25