navfn_ros.h
Go to the documentation of this file.
1 /*********************************************************************
2 *
3 * Software License Agreement (BSD License)
4 *
5 * Copyright (c) 2008, 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 the Willow Garage 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 *********************************************************************/
37 #ifndef NAVFN_NAVFN_ROS_H_
38 #define NAVFN_NAVFN_ROS_H_
39 
40 #include <ros/ros.h>
41 #include <navfn/navfn.h>
42 #include <costmap_2d/costmap_2d.h>
43 #include <geometry_msgs/PoseStamped.h>
44 #include <geometry_msgs/Point.h>
45 #include <nav_msgs/Path.h>
46 #include <tf/transform_datatypes.h>
47 #include <vector>
49 #include <nav_msgs/GetPlan.h>
50 #include <navfn/potarr_point.h>
51 #include <pcl_ros/publisher.h>
52 
53 namespace navfn {
59  public:
63  NavfnROS();
64 
70  NavfnROS(std::string name, costmap_2d::Costmap2DROS* costmap_ros);
71 
77  void initialize(std::string name, costmap_2d::Costmap2DROS* costmap_ros);
78 
86  bool makePlan(const geometry_msgs::PoseStamped& start,
87  const geometry_msgs::PoseStamped& goal, std::vector<geometry_msgs::PoseStamped>& plan);
88 
97  bool makePlan(const geometry_msgs::PoseStamped& start,
98  const geometry_msgs::PoseStamped& goal, double tolerance, std::vector<geometry_msgs::PoseStamped>& plan);
99 
105  bool computePotential(const geometry_msgs::Point& world_point);
106 
113  bool getPlanFromPotential(const geometry_msgs::PoseStamped& goal, std::vector<geometry_msgs::PoseStamped>& plan);
114 
120  double getPointPotential(const geometry_msgs::Point& world_point);
121 
127  bool validPointPotential(const geometry_msgs::Point& world_point);
128 
135  bool validPointPotential(const geometry_msgs::Point& world_point, double tolerance);
136 
140  void publishPlan(const std::vector<geometry_msgs::PoseStamped>& path, double r, double g, double b, double a);
141 
143 
144  bool makePlanService(nav_msgs::GetPlan::Request& req, nav_msgs::GetPlan::Response& resp);
145 
146  protected:
147 
156 
157 
158  private:
159  inline double sq_distance(const geometry_msgs::PoseStamped& p1, const geometry_msgs::PoseStamped& p2){
160  double dx = p1.pose.position.x - p2.pose.position.x;
161  double dy = p1.pose.position.y - p2.pose.position.y;
162  return dx*dx +dy*dy;
163  }
164 
165  void mapToWorld(double mx, double my, double& wx, double& wy);
166  void clearRobotCell(const tf::Stamped<tf::Pose>& global_pose, unsigned int mx, unsigned int my);
168  std::string tf_prefix_;
169  boost::mutex mutex_;
171  };
172 };
173 
174 #endif
Definition: navfn.h:81
bool visualize_potential_
Definition: navfn_ros.h:155
void publishPlan(const std::vector< geometry_msgs::PoseStamped > &path, double r, double g, double b, double a)
Publish a path for visualization purposes.
Definition: navfn_ros.cpp:407
boost::shared_ptr< NavFn > planner_
Definition: navfn_ros.h:152
ros::Publisher plan_pub_
Definition: navfn_ros.h:153
bool computePotential(const geometry_msgs::Point &world_point)
Computes the full navigation function for the map given a point in the world to start from...
Definition: navfn_ros.cpp:149
costmap_2d::Costmap2DROS * costmap_ros_
Store a copy of the current costmap in costmap. Called by makePlan.
Definition: navfn_ros.h:151
Provides a ROS wrapper for the navfn planner which runs a fast, interpolated navigation function on a...
Definition: navfn_ros.h:58
bool allow_unknown_
Definition: navfn_ros.h:155
std::string tf_prefix_
Definition: navfn_ros.h:168
void clearRobotCell(const tf::Stamped< tf::Pose > &global_pose, unsigned int mx, unsigned int my)
Definition: navfn_ros.cpp:181
bool validPointPotential(const geometry_msgs::Point &world_point)
Check for a valid potential value at a given point in the world (Note: You should call computePotenti...
Definition: navfn_ros.cpp:96
bool makePlan(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal, std::vector< geometry_msgs::PoseStamped > &plan)
Given a goal pose in the world, compute a plan.
Definition: navfn_ros.cpp:210
ros::ServiceServer make_plan_srv_
Definition: navfn_ros.h:170
double sq_distance(const geometry_msgs::PoseStamped &p1, const geometry_msgs::PoseStamped &p2)
Definition: navfn_ros.h:159
boost::mutex mutex_
Definition: navfn_ros.h:169
double getPointPotential(const geometry_msgs::Point &world_point)
Get the potential, or naviagation cost, at a given point in the world (Note: You should call computeP...
Definition: navfn_ros.cpp:133
bool getPlanFromPotential(const geometry_msgs::PoseStamped &goal, std::vector< geometry_msgs::PoseStamped > &plan)
Compute a plan to a goal after the potential for a start point has already been computed (Note: You s...
Definition: navfn_ros.cpp:434
bool makePlanService(nav_msgs::GetPlan::Request &req, nav_msgs::GetPlan::Response &resp)
Definition: navfn_ros.cpp:193
double default_tolerance_
Definition: navfn_ros.h:167
double planner_window_y_
Definition: navfn_ros.h:167
double planner_window_x_
Definition: navfn_ros.h:167
NavfnROS()
Default constructor for the NavFnROS object.
Definition: navfn_ros.cpp:51
void mapToWorld(double mx, double my, double &wx, double &wy)
Definition: navfn_ros.cpp:203
pcl_ros::Publisher< PotarrPoint > potarr_pub_
Definition: navfn_ros.h:154
void initialize(std::string name, costmap_2d::Costmap2DROS *costmap_ros)
Initialization function for the NavFnROS object.
Definition: navfn_ros.cpp:61


asr_navfn
Author(s): Kurt Konolige, Eitan Marder-Eppstein, contradict@gmail.com, Felix Marek
autogenerated on Mon Jun 10 2019 12:43:25