Go to the documentation of this file.00001 #ifndef BIPEDROBIN_LOCAL_PLANNER_BIPEDROBIN_PLANNER_ROS_H_
00002 #define BIPEDROBIN_LOCAL_PLANNER_BIPEDROBIN_PLANNER_ROS_H_
00003 #include <boost/shared_ptr.hpp>
00004 #include <nav_core/base_local_planner.h>
00005 #include <std_msgs/UInt8.h>
00006 #include <bipedRobin_msgs/StepTarget3DService.h>
00007 #include <nav_msgs/Odometry.h>
00008 #include <nav_msgs/Path.h>
00009 #include <footstep_planner/FootstepPlanner.h>
00010 #include <footstep_planner/State.h>
00011
00012 namespace bipedRobin_local_planner {
00017 class BipedRobinPlannerROS : public nav_core::BaseLocalPlanner {
00018 public:
00022 BipedRobinPlannerROS() : costmap_ros_(NULL), tf_(NULL), initialized_(false) {}
00023
00030 void initialize(std::string name, tf::TransformListener* tf, costmap_2d::Costmap2DROS* costmap_ros);
00031
00036 bool isGoalReached();
00037
00043 bool setPlan(const std::vector<geometry_msgs::PoseStamped>& orig_global_plan);
00044
00050 bool computeVelocityCommands(geometry_msgs::Twist& cmd_vel);
00051
00052 void stepsLeftCallback(const std_msgs::UInt8 stepsLeftInBuffer);
00053
00054 private:
00055 inline double sign(double x){
00056 return x < 0.0 ? -1.0 : 1.0;
00057 }
00058
00059
00060 void planningThread(void);
00061 void updateMapToPlanner();
00062 bool initializeNavigator();
00063 void getFootstepFromState(const footstep_planner::State& from, const footstep_planner::State& to, bipedRobin_msgs::StepTarget3D* footstep);
00064
00069
00070
00076 void goalPoseCallback(const geometry_msgs::PoseStampedConstPtr& goal_pose);
00077
00083 void mapCallback(const nav_msgs::OccupancyGridConstPtr& occupancy_map);
00084
00085 costmap_2d::Costmap2DROS* costmap_ros_;
00086 tf::TransformListener* tf_;
00087 double max_vel_th_, min_vel_th_, min_rot_vel_;
00088 double rot_stopped_vel_, trans_stopped_vel_;
00089 double yaw_goal_tolerance_, xy_goal_tolerance_;
00090 bool prune_plan_;
00091 bool initialized_;
00092 int ivSendStep;
00093 bool ivPlanSteps;
00094
00095 ros::Publisher g_plan_pub_, l_plan_pub_;
00096 ros::Publisher ivMapPub;
00097 ros::ServiceClient ivFootstepIncSrv;
00098 ros::Subscriber stepsLeftInBufferSub;
00099
00100 footstep_planner::FootstepPlanner ivPlanner;
00101
00102 ros::ServiceServer ivFootstepPlanService;
00103 boost::thread* ivFootstepPlanningThread;
00104 boost::mutex ivFootstepPlanningMutex;
00105 boost::mutex planner_mutex_;
00106 boost::mutex localPlan_mutex_;
00107
00108 std::string ivIdFootRight;
00109 std::string ivIdFootLeft;
00110 std::string ivIdMapFrame;
00111 double ivPlanningDistance;
00112
00113 std::list <footstep_planner::State> ivStepsToStart;
00114 footstep_planner::State ivLeftLegStart;
00115 footstep_planner::State ivRightLegStart;
00116 footstep_planner::State ivLeftLegCurrent;
00117 footstep_planner::State ivRightLegCurrent;
00118 double ivLocalGoalX;
00119 double ivLocalGoalY;
00120 double ivLocalGoalTheta;
00121
00122 std::vector<geometry_msgs::PoseStamped> global_plan_;
00123 };
00124 };
00125 #endif