Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef COLLVOID_LOCAL_PLANNER_H_
00032 #define COLLVOID_LOCAL_PLANNER_H_
00033
00034
00035 #include <tf/transform_listener.h>
00036 #include <nav_core/base_local_planner.h>
00037 #include <angles/angles.h>
00038 #include <nav_msgs/Odometry.h>
00039 #include <nav_msgs/GridCells.h>
00040 #include <ros/ros.h>
00041 #include <dynamic_reconfigure/server.h>
00042
00043 #include "collvoid_local_planner/ROSAgent.h"
00044 #include "collvoid_local_planner/CollvoidConfig.h"
00045
00046
00047 using namespace collvoid;
00048
00049 namespace collvoid_local_planner {
00050
00051
00052 class CollvoidLocalPlanner: public nav_core::BaseLocalPlanner {
00053 public:
00054 CollvoidLocalPlanner();
00055 CollvoidLocalPlanner(std::string name, tf::TransformListener* tf, costmap_2d::Costmap2DROS* costmap_ros);
00056 ~CollvoidLocalPlanner();
00057 void initialize(std::string name, tf::TransformListener* tf, costmap_2d::Costmap2DROS* costmap_ros);
00058 bool isGoalReached();
00059 bool setPlan(const std::vector<geometry_msgs::PoseStamped>& global_plan);
00060 void odomCallback(const nav_msgs::Odometry::ConstPtr& msg);
00061 bool computeVelocityCommands(geometry_msgs::Twist& cmd_vel);
00062
00063 private:
00064 bool rotateToGoal(const tf::Stamped<tf::Pose>& global_pose, const tf::Stamped<tf::Pose>& robot_vel, double goal_th, geometry_msgs::Twist& cmd_vel);
00065 bool stopWithAccLimits(const tf::Stamped<tf::Pose>& global_pose, const tf::Stamped<tf::Pose>& robot_vel, geometry_msgs::Twist& cmd_vel);
00066
00067
00068 bool transformGlobalPlan(const tf::TransformListener& tf, const std::vector<geometry_msgs::PoseStamped>& global_plan, const costmap_2d::Costmap2DROS& costmap, const std::string& global_frame, std::vector<geometry_msgs::PoseStamped>& transformed_plan);
00069 void findBestWaypoint(geometry_msgs::PoseStamped& target_pose, const tf::Stamped<tf::Pose>& global_pose);
00070
00071 void obstaclesCallback(const nav_msgs::GridCells::ConstPtr& msg);
00072
00073
00074 boost::recursive_mutex configuration_mutex_;
00075 dynamic_reconfigure::Server<collvoid_local_planner::CollvoidConfig> *dsrv_;
00076 void reconfigureCB(collvoid_local_planner::CollvoidConfig &config, uint32_t level);
00077 collvoid_local_planner::CollvoidConfig last_config_;
00078 collvoid_local_planner::CollvoidConfig default_config_;
00079
00080
00081
00082
00083 costmap_2d::Costmap2DROS* costmap_ros_;
00084 tf::TransformListener* tf_;
00085
00086 bool initialized_, skip_next_, setup_;
00087
00088
00089 double sim_period_;
00090 double max_vel_x_, min_vel_x_;
00091 double max_vel_y_, min_vel_y_;
00092 double max_vel_th_, min_vel_th_, min_vel_th_inplace_;
00093 double acc_lim_x_, acc_lim_y_, acc_lim_th_;
00094 double wheel_base_, radius_;
00095 double max_vel_with_obstacles_;
00096
00097 bool holo_robot_;
00098
00099 double trunc_time_, left_pref_;
00100
00101 double xy_goal_tolerance_, yaw_goal_tolerance_;
00102 double rot_stopped_velocity_, trans_stopped_velocity_;
00103
00104 double publish_me_period_, publish_positions_period_;
00105 double threshold_last_seen_;
00106
00107
00108 bool latch_xy_goal_tolerance_, xy_tolerance_latch_, rotating_to_goal_, ignore_goal_yaw_, delete_observations_;
00109
00110 unsigned int current_waypoint_;
00111
00112 double time_horizon_obst_;
00113 double eps_;
00114
00115 ROSAgentPtr me_;
00116
00117
00118
00119
00120 double time_to_holo_, min_error_holo_, max_error_holo_;
00121
00122 std::string global_frame_;
00123 std::string robot_base_frame_;
00124 std::vector<geometry_msgs::PoseStamped> global_plan_, transformed_plan_;
00125 ros::Publisher g_plan_pub_, l_plan_pub_;
00126 ros::Subscriber obstacles_sub_;
00127
00128 };
00129
00130
00131
00132
00133 };
00134
00135 #endif //end guard catch