00001 00018 #ifndef FTC_LOCAL_PLANNER_FTC_PLANNER_H_ 00019 #define FTC_LOCAL_PLANNER_FTC_PLANNER_H_ 00020 00021 #include <nav_msgs/Odometry.h> 00022 00023 #include <costmap_2d/costmap_2d_ros.h> 00024 00025 #include <tf/transform_listener.h> 00026 00027 #include <Eigen/Core> 00028 00029 #include <dynamic_reconfigure/server.h> 00030 00031 #include <asr_ftc_local_planner/FTCPlannerConfig.h> 00032 00033 #include <nav_core/base_local_planner.h> 00034 00035 #include <ftc_local_planner/transform_global_plan.h> 00036 00037 #include <ftc_local_planner/join_costmap.h> 00038 00039 namespace ftc_local_planner 00040 { 00041 00042 class FTCPlanner : public nav_core::BaseLocalPlanner 00043 { 00044 00045 public: 00046 FTCPlanner(); 00052 bool computeVelocityCommands(geometry_msgs::Twist& cmd_vel); 00053 00058 bool isGoalReached(); 00059 00065 bool setPlan(const std::vector<geometry_msgs::PoseStamped>& plan); 00066 00073 void initialize(std::string name, tf::TransformListener* tf, costmap_2d::Costmap2DROS* costmap_ros); 00074 00075 ~FTCPlanner(); 00076 00077 private: 00078 00082 void reconfigureCB(FTCPlannerConfig &config, uint32_t level); 00083 00089 int checkMaxDistance(tf::Stamped<tf::Pose> current_pose); 00090 00097 int checkMaxAngle(int points, tf::Stamped<tf::Pose> current_pose); 00098 00106 bool rotateToOrientation(double angle, geometry_msgs::Twist& cmd_vel, double accuracy); 00107 00112 void publishPlan(int max_point); 00113 00120 int driveToward(tf::Stamped<tf::Pose> current_pose, geometry_msgs::Twist& cmd_vel); 00121 00128 double calculateGlobalPlanAngle(tf::Stamped<tf::Pose> current_pose, const std::vector<geometry_msgs::PoseStamped>& plan, int points); 00129 00135 bool checkCollision(int max_points); 00136 00137 //used for transformation 00138 tf::TransformListener* tf_; 00139 //costmap to get the current position 00140 costmap_2d::Costmap2DROS* costmap_ros_; 00141 //global plan which we run along 00142 std::vector<geometry_msgs::PoseStamped> global_plan_; 00143 //transformed global plan in global frame with only the points with are needed for calculation (max_points) 00144 std::vector<geometry_msgs::PoseStamped> transformed_global_plan_; 00145 //check if plan first at first time 00146 bool first_setPlan_; 00147 //last point of the global plan in global frame 00148 tf::Stamped<tf::Pose> goal_pose_; 00149 // true if the robot should rotate to gobal plan if new global goal set 00150 tf::Stamped<tf::Pose> old_goal_pose_; 00151 // true if the robot should rotate to gobal plan if new global goal set 00152 bool rotate_to_global_plan_; 00153 //for dynamic reconfigure 00154 dynamic_reconfigure::Server<FTCPlannerConfig> *dsrv_; 00155 //start config 00156 ftc_local_planner::FTCPlannerConfig default_config_; 00157 //reconfigure config 00158 ftc_local_planner::FTCPlannerConfig config_; 00159 //true if the goal point is reache and orientation of goal is reached 00160 bool goal_reached_; 00161 //true if the goal point is reache and orientation of goal isn't reached 00162 bool stand_at_goal_; 00163 //opublisher where the local plan for visulatation is published 00164 ros::Publisher local_plan_publisher_; 00165 00166 //rotation velocity of previous round for the rotateToOrientation methode 00167 double cmd_vel_angular_z_rotate_; 00168 //x velocity of the previous round 00169 double cmd_vel_linear_x_; 00170 //rotation velocity of previous round for the dirveToward methode 00171 double cmd_vel_angular_z_; 00172 00173 JoinCostmap *joinCostmap_; 00174 00175 }; 00176 }; 00177 #endif