sbpl_cart_planner.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 *
00003 * Software License Agreement (BSD License)
00004 *
00005 *  Copyright (c) 2008, Willow Garage, Inc.
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 Willow Garage 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 * Author: Mike Phillips, Sachin Chitta
00036 *********************************************************************/
00037 
00038 #ifndef SBPL_CART_PLANNER_H
00039 #define SBPL_CART_PLANNER_H
00040 
00041 #include <iostream>
00042 #include <vector>
00043 
00044 using namespace std;
00045 
00047 #include <ros/ros.h>
00048 
00049 // Costmap used for the map representation
00050 #include <costmap_2d/costmap_2d_ros.h>
00051 
00052 // sbpl headers
00053 #include <sbpl/headers.h>
00054 
00055 //global representation
00056 #include <nav_core/base_global_planner.h>
00057 
00058 #include <sbpl_cart_planner/environment_cart_planner.h>
00059 #include <visualization_msgs/MarkerArray.h>
00060 
00061 class SBPLCartPlanner : public nav_core::BaseGlobalPlanner{
00062 public:
00063   
00067   SBPLCartPlanner();
00068 
00069   
00075   SBPLCartPlanner(std::string name, costmap_2d::Costmap2DROS* costmap_ros);
00076 
00077 
00083   virtual void initialize(std::string name, 
00084                           costmap_2d::Costmap2DROS* costmap_ros);
00085   
00093   virtual bool makePlan(const geometry_msgs::PoseStamped& start, 
00094                         const geometry_msgs::PoseStamped& goal, 
00095                         std::vector<geometry_msgs::PoseStamped>& plan);
00096 
00097   virtual ~SBPLCartPlanner(){};
00098 
00099 private:
00100   bool initialized_;
00101 
00102   SBPLPlanner* planner_;
00103   EnvironmentNAVXYTHETACARTLAT* env_;
00104   
00105   std::string planner_type_; 
00107   double allocated_time_; 
00108   double initial_epsilon_; 
00110   std::string environment_type_; 
00111   std::string cost_map_topic_; 
00113   bool forward_search_; 
00114   std::string primitive_filename_; 
00115   int force_scratch_limit_; 
00118   costmap_2d::Costmap2DROS* costmap_ros_; 
00119   costmap_2d::Costmap2D cost_map_;        
00121   ros::Publisher plan_pub_,sbpl_plan_pub_,sbpl_plan_footprint_pub_,sbpl_robot_cart_plan_pub_, stats_publisher_;
00122   
00123   std::vector<geometry_msgs::Point> footprint_;
00124   std::vector<geometry_msgs::Point> loadRobotFootprint(ros::NodeHandle node);
00125 
00126   double sign(double x);
00127   sbpl_2Dpt_t cart_offset_, cart_cp_offset_;
00128 
00129   void convertPathToMarkerArray(const std::vector<EnvNAVXYTHETACARTLAT3Dpt_t> &sbpl_path,
00130                                 const std::string &path_frame_id,
00131                                 visualization_msgs::MarkerArray &ma);
00132 
00133   std::vector<geometry_msgs::Point> cart_footprint_,robot_footprint_;
00134 
00135   void transformFootprintToEdges(const geometry_msgs::Pose &robot_pose,
00136                                  const std::vector<geometry_msgs::Point> &footprint,
00137                                  std::vector<geometry_msgs::Point> &out_footprint);
00138 
00139   void getFootprintList(const std::vector<EnvNAVXYTHETACARTLAT3Dpt_t> &sbpl_path,
00140                         const std::string &path_frame_id,
00141                         visualization_msgs::MarkerArray &ma);
00142   geometry_msgs::Pose getGlobalCartPose(const EnvNAVXYTHETACARTLAT3Dpt_t& sbpl_pose);
00143   geometry_msgs::Pose getLocalCartPose(const EnvNAVXYTHETACARTLAT3Dpt_t& sbpl_pose);
00144   geometry_msgs::Pose getLocalCartControlFramePose(const EnvNAVXYTHETACARTLAT3Dpt_t& sbpl_pose);
00145 
00146   bool clearFootprint(const geometry_msgs::Pose &robot_pose, 
00147                       const std::vector<geometry_msgs::Point> &footprint);
00148   
00149   void getOrientedFootprint(const geometry_msgs::Pose &robot_pose,
00150                             const std::vector<geometry_msgs::Point> &footprint,
00151                             std::vector<geometry_msgs::Point> &oriented_footprint);
00152 
00153   geometry_msgs::Pose getGlobalCartPose(const geometry_msgs::Pose &robot_pose, const double &cart_angle);
00154 
00155   unsigned char costMapCostToSBPLCost(unsigned char newcost);
00156 
00157   unsigned char sbpl_cost_multiplier_;
00158   unsigned char lethal_obstacle_;
00159   unsigned char inscribed_inflated_obstacle_;
00160   unsigned int num_sbpl_markers_;
00161   int visualizer_skip_poses_;
00162 };
00163 
00164 #endif
00165 


sbpl_cart_planner
Author(s): Sachin Chitta
autogenerated on Tue Jan 7 2014 11:12:32