eband_local_planner.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  *
00003  * Software License Agreement (BSD License)
00004  *
00005  *  Copyright (c) 2010, 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 Willow Garage, Inc. 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: Christian Connette
00036  *********************************************************************/
00037 
00038 #ifndef EBAND_LOCAL_PLANNER_H_
00039 #define EBAND_LOCAL_PLANNER_H_
00040 
00041 //#define DEBUG_EBAND_ // uncomment to enable additional publishing, visualization and logouts for debug
00042 
00043 #include <ros/ros.h>
00044 #include <ros/assert.h>
00045 
00046 // classes which are part of this package
00047 #include <eband_local_planner/conversions_and_types.h>
00048 #include <eband_local_planner/eband_visualization.h>
00049 #include <eband_local_planner/EBandPlannerConfig.h>
00050 
00051 // local planner specific classes
00052 #include <base_local_planner/costmap_model.h>
00053 
00054 // msgs
00055 #include <nav_msgs/Path.h>
00056 #include <nav_msgs/Odometry.h>
00057 #include <geometry_msgs/PoseStamped.h>
00058 #include <geometry_msgs/Pose.h>
00059 #include <geometry_msgs/Pose2D.h>
00060 #include <geometry_msgs/Twist.h>
00061 #include <geometry_msgs/WrenchStamped.h>
00062 
00063 // transforms
00064 #include <angles/angles.h>
00065 #include <tf/tf.h>
00066 
00067 // costmap & geometry
00068 #include <costmap_2d/costmap_2d_ros.h>
00069 
00070 // boost classes
00071 #include <boost/shared_ptr.hpp>
00072 
00073 namespace eband_local_planner{
00074 
00079   class EBandPlanner{
00080 
00081     public:
00085       EBandPlanner();
00086 
00092       EBandPlanner(std::string name, costmap_2d::Costmap2DROS* costmap_ros);
00093 
00097       ~EBandPlanner();
00098 
00104       void initialize(std::string name, costmap_2d::Costmap2DROS* costmap_ros);
00105 
00110       void reconfigure(EBandPlannerConfig& config);
00111 
00116       void setVisualization(boost::shared_ptr<EBandVisualization> eband_visual);
00117 
00123       bool setPlan(const std::vector<geometry_msgs::PoseStamped>& global_plan);
00124 
00130       bool getPlan(std::vector<geometry_msgs::PoseStamped>& global_plan);
00131 
00137       bool getBand(std::vector<Bubble>& elastic_band);
00138 
00144       bool addFrames(const std::vector<geometry_msgs::PoseStamped>& robot_pose, const AddAtPosition& add_frames_at);
00145 
00150       bool optimizeBand();
00151 
00157       bool optimizeBand(std::vector<Bubble>& band);
00158 
00159     private:
00160       // pointer to external objects (do NOT delete object)
00161       costmap_2d::Costmap2DROS* costmap_ros_; 
00162 
00163       // parameters
00164       std::vector<double> acc_lim_; 
00165       int num_optim_iterations_; 
00166       double internal_force_gain_; 
00167       double external_force_gain_; 
00168       double tiny_bubble_distance_; 
00169       double tiny_bubble_expansion_; 
00170       double min_bubble_overlap_; 
00171       int max_recursion_depth_approx_equi_; 
00172       double equilibrium_relative_overshoot_; 
00173       double significant_force_; 
00174       double costmap_weight_; // the costmap weight or scaling factor
00175 
00176       // pointer to locally created objects (delete - except for smart-ptrs:)
00177       base_local_planner::CostmapModel* world_model_; // local world model
00178       boost::shared_ptr<EBandVisualization> eband_visual_; // pointer to visualization object
00179 
00180       // flags
00181       bool initialized_, visualization_;
00182 
00183       // data
00184       std::vector<geometry_msgs::Point> footprint_spec_; // specification of robot footprint as vector of corner points
00185       costmap_2d::Costmap2D* costmap_; // pointer to underlying costmap
00186       std::vector<geometry_msgs::PoseStamped> global_plan_; // copy of the plan that shall be optimized
00187       std::vector<Bubble> elastic_band_;
00188 
00189 
00190       // methods
00191 
00192       // band refinement (filling of gaps & removing redundant bubbles)
00193 
00199       bool refineBand(std::vector<Bubble>& band);
00200 
00201 
00209       bool removeAndFill(std::vector<Bubble>& band, std::vector<Bubble>::iterator& start_iter,std::vector<Bubble>::iterator& end_iter);
00210 
00211 
00219       bool fillGap(std::vector<Bubble>& band, std::vector<Bubble>::iterator& start_iter,std::vector<Bubble>::iterator& end_iter);
00220 
00221 
00222       // optimization
00223 
00229       bool modifyBandArtificialForce(std::vector<Bubble>& band);
00230 
00231 
00239       bool applyForces(int bubble_num, std::vector<Bubble>& band, std::vector<geometry_msgs::WrenchStamped> forces);
00240 
00241 
00251       bool moveApproximateEquilibrium(const int& bubble_num, const std::vector<Bubble>& band, Bubble& curr_bubble,
00252           const geometry_msgs::WrenchStamped& curr_bubble_force, geometry_msgs::Twist& curr_step_width,
00253           const int& curr_recursion_depth);
00254 
00255 
00256       // problem (geometry) dependant functions
00257 
00265       bool interpolateBubbles(geometry_msgs::PoseStamped start_center, geometry_msgs::PoseStamped end_center, geometry_msgs::PoseStamped& interpolated_center);
00266 
00267 
00275       bool checkOverlap(Bubble bubble1, Bubble bubble2);
00276 
00277 
00285       bool calcBubbleDistance(geometry_msgs::Pose start_center_pose, geometry_msgs::Pose end_center_pose, double& distance);
00286 
00287 
00295       bool calcBubbleDifference(geometry_msgs::Pose start_center_pose, geometry_msgs::Pose end_center_pose, geometry_msgs::Twist& difference);
00296 
00297 
00304       bool calcObstacleKinematicDistance(geometry_msgs::Pose center_pose, double& distance);
00305 
00306 
00315       bool getForcesAt(int bubble_num, std::vector<Bubble> band, Bubble curr_bubble, geometry_msgs::WrenchStamped& forces);
00316 
00317 
00326       bool calcInternalForces(int bubble_num, std::vector<Bubble> band, Bubble curr_bubble, geometry_msgs::WrenchStamped& forces);
00327 
00328 
00336       bool calcExternalForces(int bubble_num, Bubble curr_bubble, geometry_msgs::WrenchStamped& forces);
00337 
00338 
00345       bool suppressTangentialForces(int bubble_num, std::vector<Bubble> band, geometry_msgs::WrenchStamped& forces);
00346 
00347 
00348       // type conversion
00349 
00356       bool convertPlanToBand(std::vector<geometry_msgs::PoseStamped> plan, std::vector<Bubble>& band);
00357 
00358 
00365       bool convertBandToPlan(std::vector<geometry_msgs::PoseStamped>& plan, std::vector<Bubble> band);
00366 
00367   };
00368 };
00369 #endif


eband_local_planner
Author(s): Christian Connette, Bhaskara Marthi, Piyush Khandelwal
autogenerated on Thu Jun 6 2019 18:50:52