explore.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  *
00003  * Software License Agreement (BSD License)
00004  *
00005  *  Copyright (c) 2008, Robert Bosch LLC.
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 the Robert Bosch 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  *********************************************************************/
00036 #ifndef NAV_EXPLORE_H_
00037 #define NAV_EXPLORE_H_
00038 
00039 #include <ros/ros.h>
00040 #include <explore_hrl/isDone_srv.h>  // service type
00041 #include <move_base_msgs/MoveBaseAction.h>
00042 #include <actionlib/client/simple_action_client.h>
00043 #include <geometry_msgs/PoseStamped.h>
00044 #include <nav_msgs/GetMap.h>
00045 #include <costmap_2d/costmap_2d_ros.h>
00046 #include <costmap_2d/costmap_2d.h>
00047 #include <navfn/navfn_ros.h>
00048 #include <explore_hrl/explore_frontier.h>
00049 #include <explore_hrl/loop_closure.h>
00050 #include <visualization_msgs/MarkerArray.h>
00051 #include <vector>
00052 #include <string>
00053 #include <boost/thread/mutex.hpp>
00054 
00055 
00056 namespace explore {
00057 
00062 class Explore {
00063 public:
00068   Explore();
00069 
00073   virtual ~Explore();
00074 
00081   void execute();
00082 
00083   void spin();
00084 
00085   void setPreemptFlag( bool state );
00086 
00087   bool doneExploring( );
00088 
00089 private:
00093   void makePlan();
00094 
00095 
00100   void publishGoal(const geometry_msgs::Pose& goal);
00101 
00105   void publishMap();
00106 
00112   void getRobotPose(std::string frame, tf::Stamped<tf::Pose>& pose);
00113 
00114   void reachedGoal(const actionlib::SimpleClientGoalState& status, const move_base_msgs::MoveBaseResultConstPtr& result, geometry_msgs::PoseStamped frontier_goal);
00115 
00119 //  void resetCostmaps(double size_x, double size_y);
00120 
00121   bool mapCallback(nav_msgs::GetMap::Request  &req, nav_msgs::GetMap::Response &res);
00122 
00126   bool isDone( explore_hrl::isDone_srv::Request &req,
00127                explore_hrl::isDone_srv::Response &res );
00128 
00129 
00130   bool goalOnBlacklist(const geometry_msgs::PoseStamped& goal);
00131 
00132   bool isRepeatGoal(const geometry_msgs::PoseStamped& goal);  // Prevent duplicate goals
00133 
00134   ros::NodeHandle node_;
00135   ros::ServiceServer isDone_srv_;
00136   tf::TransformListener tf_;
00137   costmap_2d::Costmap2DROS* explore_costmap_ros_;
00138 
00139   geometry_msgs::PoseStamped goal_pose_last_;
00140   bool goal_pose_last_defined_;
00141 
00142   actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> move_base_client_;
00143 
00144   navfn::NavfnROS* planner_;
00145   std::string robot_base_frame_;
00146   bool done_exploring_;
00147   bool preempt_;
00148 
00149   ros::Publisher marker_publisher_;
00150   ros::Publisher marker_array_publisher_;
00151   ros::Publisher map_publisher_;
00152   ros::ServiceServer map_server_;
00153 
00154   ExploreFrontier* explorer_;
00155 
00156   tf::Stamped<tf::Pose> global_pose_;
00157   double graph_update_frequency_;
00158   int    visualize_;
00159   LoopClosure* loop_closure_;
00160   std::vector<geometry_msgs::PoseStamped> frontier_blacklist_;
00161   double potential_scale_, orientation_scale_, gain_scale_;
00162   boost::mutex client_mutex_;
00163 };
00164 
00165 }
00166 
00167 #endif
00168 


explore_hrl
Author(s): Travis Deyle
autogenerated on Wed Nov 27 2013 11:48:01