Go to the documentation of this file.
27 #include <mbf_msgs/GetPathResult.h>
41 #define GPP_DEBUG(_msg) ROS_DEBUG_STREAM(gpp_name__ << _msg)
42 #define GPP_INFO(_msg) ROS_INFO_STREAM(gpp_name__ << _msg)
43 #define GPP_WARN(_msg) ROS_WARN_STREAM(gpp_name__ << _msg)
44 #define GPP_ERROR(_msg) ROS_ERROR_STREAM(gpp_name__ << _msg)
45 #define GPP_FATAL(_msg) ROS_FATAL_STREAM(gpp_name__ << _msg)
48 constexpr uint32_t
MBF_SUCCESS = mbf_msgs::GetPathResult::SUCCESS;
49 constexpr uint32_t
MBF_FAILURE = mbf_msgs::GetPathResult::FAILURE;
60 return static_cast<std::string
>(_v[_tag]);
65 template <
typename _T>
68 const _T& _default) noexcept {
70 if (!_v.hasMember(_tag))
75 return static_cast<_T
>(_v[_tag]);
82 template <
typename _Plugin>
89 _nh.
param(_resource +
"_default_value",
true);
101 if (raw.
getType() != XmlRpcValue::TypeArray) {
102 GPP_WARN(
"invalid type for " << _resource);
107 const auto size = raw.
size();
114 for (
int ii = 0; ii != size; ++ii) {
115 const auto& element = raw[ii];
124 auto plugin = this->createCustomInstance(type);
129 param.on_failure_break =
131 param.on_success_break =
137 GPP_INFO(
"Successfully loaded " << type <<
" under the name " << name);
143 GPP_WARN(
"failed to load the library: " << ex.what());
146 GPP_WARN(
"failed to create the class: " << ex.what());
152 impl_(
std::move(_impl)) {
155 throw std::invalid_argument(
"nullptr is not supported");
167 Path& plan,
double& cost) {
174 impl_->initialize(_name, _map);
184 pluginlib::UniquePtr<BaseGlobalPlanner>
188 return createUniqueInstance(_type);
191 auto impl_planner =
manager_.createCustomInstance(_type);
195 return pluginlib::UniquePtr<BaseGlobalPlanner>{
199 template <
typename _Plugin>
204 _group.
load(_name, _nh);
208 for (
const auto& plugin : plugins)
209 plugin.second->initialize(plugin.first.name, _costmap);
229 return _plugin.preProcess(_start, _goal);
238 return _plugin.postProcess(_start, _goal, _path, _cost);
247 return _plugin.makePlan(_start, _goal, _plan, _cost);
255 return makePlan(_start, _goal, _plan, cost);
267 const double _tolerance,
Path& _plan,
double& _cost,
268 std::string& _message) {
void _default_deleter(BaseGlobalPlanner *impl)
virtual bool isClassAvailable(const std::string &lookup_name)
constexpr uint32_t MBF_FAILURE
constexpr char gpp_name__[]
const std::string & getMessage() const
BaseGlobalPlannerWrapper(ImplPlanner &&_impl)
our c'tor
bool getParam(const std::string &key, bool &b) const
pluginlib::UniquePtr< BaseGlobalPlanner > createCustomInstance(const std::string &_type) override
PostPlanningManager post_planning_
CostmapPlannerManager global_planning_
Wrappes the CostmapPlaner API into the traditional BaseGlobalPlanner API.
const PluginMap & getPlugins() const noexcept
PLUGINLIB_EXPORT_CLASS(gpp_plugin::GppPlugin, nav_core::BaseGlobalPlanner)
void initialize(std::string name, Map *costmap_ros) override
_T _getElement(const XmlRpc::XmlRpcValue &_v, const std::string &_tag, const _T &_default) noexcept
helper to get any value from _v under _tag. If anything goes wrong, the function will fall-back to th...
bool runPlugins(const PluginGroup< _Plugin > &_grp, const _Functor &_func, const std::atomic_bool &_cancel)
as _runPlugins but with a warning on failure
std::string _getStringElement(const XmlRpc::XmlRpcValue &_v, const std::string &_tag)
helper to get a string element with the tag _tag from _v
geometry_msgs::PoseStamped Pose
constexpr uint32_t MBF_SUCCESS
Loads an array of plugins.
bool makePlan(const Pose &start, const Pose &goal, Path &plan) override
bool prePlanning(Pose &_start, Pose &_goal)
const Type & getType() const
bool globalPlanning(const Pose &_start, const Pose &_goal, Path &_plan, double &_cost)
void initialize(std::string name, Map *costmap_ros) override
bool hasMember(const std::string &name) const
PluginManager< CostmapPlanner > manager_
bool makePlan(const Pose &_start, const Pose &_goal, Path &_plan) override
bool postPlanning(const Pose &_start, const Pose &_goal, Path &_path, double &_cost)
T param(const std::string ¶m_name, const T &default_val) const
T param(const std::string ¶m_name, const T &default_val)
Common interface to a plugin group.
geometry_msgs::PoseStamped Pose
const std::string & getNamespace() const
void load(const std::string &_resource, ros::NodeHandle &_nh)
pluginlib::UniquePtr< CostmapPlanner > ImplPlanner
Combine pre-planning, planning and post-planning to customize the your path.
Parameters defining how to execute a plugin.
PrePlanningManager pre_planning_
void _initGroup(const std::string &_name, costmap_2d::Costmap2DROS *_costmap, ros::NodeHandle &_nh, ArrayPluginManager< _Plugin > &_group)
gpp_plugin
Author(s):
autogenerated on Wed Mar 2 2022 00:21:23