occupancy_map_updater.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2011, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Ioan Sucan, Jon Binney */
36 
37 #pragma once
38 
42 #include <Eigen/Core>
43 #include <Eigen/Geometry>
44 
45 namespace occupancy_map_monitor
46 {
47 using ShapeHandle = unsigned int;
48 using ShapeTransformCache = std::map<ShapeHandle, Eigen::Isometry3d, std::less<ShapeHandle>,
49  Eigen::aligned_allocator<std::pair<const ShapeHandle, Eigen::Isometry3d> > >;
50 using TransformCacheProvider = boost::function<bool(const std::string&, const ros::Time&, ShapeTransformCache&)>;
51 
52 class OccupancyMapMonitor;
53 
54 MOVEIT_CLASS_FORWARD(OccupancyMapUpdater); // Defines OccupancyMapUpdaterPtr, ConstPtr, WeakPtr... etc
55 
58 class OccupancyMapUpdater
59 {
60 public:
61  OccupancyMapUpdater(const std::string& type);
62  virtual ~OccupancyMapUpdater();
63 
65  void setMonitor(OccupancyMapMonitor* monitor);
66 
69  virtual bool setParams(XmlRpc::XmlRpcValue& params) = 0;
70 
73  virtual bool initialize() = 0;
74 
75  virtual void start() = 0;
76 
77  virtual void stop() = 0;
78 
79  virtual ShapeHandle excludeShape(const shapes::ShapeConstPtr& shape) = 0;
80 
81  virtual void forgetShape(ShapeHandle handle) = 0;
82 
83  const std::string& getType() const
84  {
85  return type_;
86  }
87 
88  void setTransformCacheCallback(const TransformCacheProvider& transform_callback)
89  {
90  transform_provider_callback_ = transform_callback;
91  }
92 
93  void publishDebugInformation(bool flag)
94  {
95  debug_info_ = flag;
96  }
97 
98 protected:
99  OccupancyMapMonitor* monitor_;
100  std::string type_;
104  bool debug_info_;
105 
106  bool updateTransformCache(const std::string& target_frame, const ros::Time& target_time);
107 
108  static void readXmlParam(XmlRpc::XmlRpcValue& params, const std::string& param_name, double* value);
109  static void readXmlParam(XmlRpc::XmlRpcValue& params, const std::string& param_name, unsigned int* value);
110 };
111 } // namespace occupancy_map_monitor
occupancy_map_monitor::OccupancyMapUpdater::publishDebugInformation
void publishDebugInformation(bool flag)
Definition: occupancy_map_updater.h:125
occupancy_map_monitor::OccupancyMapUpdater::OccupancyMapUpdater
OccupancyMapUpdater(const std::string &type)
Definition: occupancy_map_updater.cpp:76
occupancy_map_monitor::ShapeTransformCache
std::map< ShapeHandle, Eigen::Isometry3d, std::less< ShapeHandle >, Eigen::aligned_allocator< std::pair< const ShapeHandle, Eigen::Isometry3d > > > ShapeTransformCache
Definition: occupancy_map_updater.h:81
occupancy_map_monitor::OccupancyMapUpdater::setMonitor
void setMonitor(OccupancyMapMonitor *monitor)
This is the first function to be called after construction.
Definition: occupancy_map_updater.cpp:82
occupancy_map_monitor::MOVEIT_CLASS_FORWARD
MOVEIT_CLASS_FORWARD(OccupancyMapUpdater)
occupancy_map_monitor::OccupancyMapUpdater::readXmlParam
static void readXmlParam(XmlRpc::XmlRpcValue &params, const std::string &param_name, double *value)
Definition: occupancy_map_updater.cpp:88
occupancy_map_monitor::OccupancyMapUpdater::stop
virtual void stop()=0
occupancy_map_monitor::OccupancyMapUpdater::setParams
virtual bool setParams(XmlRpc::XmlRpcValue &params)=0
Set updater params using struct that comes from parsing a yaml string. This must be called after setM...
occupancy_map_monitor::OccupancyMapUpdater::transform_cache_
ShapeTransformCache transform_cache_
Definition: occupancy_map_updater.h:135
occupancy_map_monitor::OccupancyMapUpdater::updateTransformCache
bool updateTransformCache(const std::string &target_frame, const ros::Time &target_time)
Definition: occupancy_map_updater.cpp:105
occupancy_map_monitor::OccupancyMapUpdater::debug_info_
bool debug_info_
Definition: occupancy_map_updater.h:136
occupancy_map_monitor::OccupancyMapUpdater::type_
std::string type_
Definition: occupancy_map_updater.h:132
occupancy_map_monitor::TransformCacheProvider
boost::function< bool(const std::string &, const ros::Time &, ShapeTransformCache &)> TransformCacheProvider
Definition: occupancy_map_updater.h:82
shapes.h
occupancy_map_monitor::OccupancyMapUpdater::forgetShape
virtual void forgetShape(ShapeHandle handle)=0
occupancy_map_monitor::OccupancyMapUpdater::excludeShape
virtual ShapeHandle excludeShape(const shapes::ShapeConstPtr &shape)=0
occupancy_map_monitor::ShapeHandle
unsigned int ShapeHandle
Definition: occupancy_map_updater.h:79
occupancy_map_monitor::OccupancyMapUpdater::tree_
collision_detection::OccMapTreePtr tree_
Definition: occupancy_map_updater.h:133
ros::Time
class_forward.h
occupancy_map_monitor::OccupancyMapUpdater::initialize
virtual bool initialize()=0
Do any necessary setup (subscribe to ros topics, etc.). This call assumes setMonitor() and setParams(...
occupancy_map_monitor::OccupancyMapUpdater::start
virtual void start()=0
occupancy_map_monitor::OccupancyMapUpdater::~OccupancyMapUpdater
virtual ~OccupancyMapUpdater()
occupancy_map_monitor::OccupancyMapUpdater::getType
const std::string & getType() const
Definition: occupancy_map_updater.h:115
occupancy_map_monitor
Definition: occupancy_map_monitor.h:54
shapes::ShapeConstPtr
std::shared_ptr< const Shape > ShapeConstPtr
occupancy_map_monitor::OccupancyMapUpdater::monitor_
OccupancyMapMonitor * monitor_
Definition: occupancy_map_updater.h:131
occupancy_map_monitor::OccupancyMapUpdater::setTransformCacheCallback
void setTransformCacheCallback(const TransformCacheProvider &transform_callback)
Definition: occupancy_map_updater.h:120
collision_detection::OccMapTreePtr
std::shared_ptr< OccMapTree > OccMapTreePtr
occupancy_map_monitor::OccupancyMapUpdater::transform_provider_callback_
TransformCacheProvider transform_provider_callback_
Definition: occupancy_map_updater.h:134
occupancy_map.h
XmlRpc::XmlRpcValue


occupancy_map_monitor
Author(s): Ioan Sucan , Jon Binney , Suat Gedikli
autogenerated on Wed Feb 21 2024 03:25:41