47 calc_loader_(
"dlux_global_planner",
"dlux_global_planner::PotentialCalculator"),
48 traceback_loader_(
"dlux_global_planner",
"dlux_global_planner::Traceback"),
49 potential_grid_(
HIGH_POTENTIAL), cached_goal_x_(-1), cached_goal_y_(-1), potential_pub_(potential_grid_)
64 std::string plugin_name;
65 planner_nh.
param(
"potential_calculator", plugin_name, std::string(
"dlux_plugins::AStar"));
66 ROS_INFO_NAMED(
"DluxGlobalPlanner",
"Using PotentialCalculator \"%s\"", plugin_name.c_str());
70 planner_nh.
param(
"traceback", plugin_name, std::string(
"dlux_plugins::GradientPath"));
71 ROS_INFO_NAMED(
"DluxGlobalPlanner",
"Using Traceback \"%s\"", plugin_name.c_str());
79 bool publish_potential;
80 planner_nh.
param(
"publish_potential", publish_potential,
false);
81 if (publish_potential)
93 for (geometry_msgs::Pose2D pose : path.poses)
104 const nav_2d_msgs::Pose2DStamped& goal)
122 if (costmap(x, y) >= costmap.INSCRIBED_INFLATED_OBSTACLE)
132 if (costmap(x, y) >= costmap.INSCRIBED_INFLATED_OBSTACLE)
138 bool cached_plan_available =
false;
145 cached_plan_available =
true;
151 double path_cost = 0.0;
156 "Got plan! Cost: %.2f, %d updated potentials, path of length %.2f with %zu poses.",
172 unsigned int goal_x,
unsigned int goal_y)
177 cached_goal_y_ = goal_y;
boost::shared_ptr< Traceback > traceback_
#define ROS_INFO_NAMED(name,...)
virtual bool shouldReturnCachedPathImmediately() const
Whether the planner should always return a valid cached path without running the planning algorithm...
static const unsigned char INSCRIBED_INFLATED_OBSTACLE
nav_core2::Costmap::Ptr costmap_
CostInterpreter::Ptr cost_interpreter_
PotentialGrid potential_grid_
TFSIMD_FORCE_INLINE const tfScalar & y() const
boost::shared_ptr< PotentialCalculator > calculator_
pluginlib::ClassLoader< PotentialCalculator > calc_loader_
void init(ros::NodeHandle &nh, const std::string &nav_grid_topic="grid", const std::string &occupancy_grid_topic="costmap", const std::string &update_area_topic="update_area", bool publish_updates=true, ros::Duration full_publish_cycle=ros::Duration(0), ros::Duration update_publish_cycle=ros::Duration(0))
std::string getFrameId() const
double improvement_threshold_
const float HIGH_POTENTIAL
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
nav_2d_msgs::Path2D cached_path_
void setInfo(const NavGridInfo &new_info) override
unsigned int cached_goal_y_
TFSIMD_FORCE_INLINE const tfScalar & x() const
virtual bool hasValidCachedPath(const geometry_msgs::Pose2D &local_goal, unsigned int goal_x, unsigned int goal_y)
Check whether there is a valid cached path where the goal hasn't changed.
unsigned int cached_goal_x_
Plugin-based global wavefront planner that conforms to the nav_core2 GlobalPlanner interface...
nav_grid_pub_sub::ScaleGridPublisher< float > potential_pub_
pluginlib::ClassLoader< Traceback > traceback_loader_
double getPlanLength(const nav_2d_msgs::Path2D &plan, const unsigned int start_index=0)
virtual bool shouldReturnNewPath(const nav_2d_msgs::Path2D &new_path, const double new_path_cost) const
Given a cached path is available and a new path, should the new path be the one returned?
nav_2d_msgs::Path2D makePlan(const nav_2d_msgs::Pose2DStamped &start, const nav_2d_msgs::Pose2DStamped &goal) override
NavGridInfo getInfo() const
virtual bool isPlanValid(const nav_2d_msgs::Path2D &path) const
Check the costmap for any obstacles on this path.
geometry_msgs::Pose2D transformStampedPose(const TFListenerPtr tf, const nav_2d_msgs::Pose2DStamped &pose, const std::string &frame_id)
void initialize(const ros::NodeHandle &parent, const std::string &name, TFListenerPtr tf, nav_core2::Costmap::Ptr costmap) override
std::shared_ptr< Costmap > Ptr
std::shared_ptr< tf::TransformListener > TFListenerPtr
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
bool worldToGridBounded(const NavGridInfo &info, double wx, double wy, unsigned int &mx, unsigned int &my)