Planning.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef __PLANNING__H___
  2. #define __PLANNING__H___
  3. #include <ros/ros.h>
  4. #include <nav_msgs/GetPlan.h>
  5. #include <geometry_msgs/PoseStamped.h>
  6. #include <tf/transform_broadcaster.h>
  7. #include <tf/tf.h>
  8. #include "tf2_msgs/TFMessage.h"
  9. #include <Eigen/Core>
  10. #include <Eigen/Dense>
  11. #include <string>
  12. #include <boost/foreach.hpp>
  13. #include <boost/thread.hpp>
  14. #define forEach BOOST_FOREACH
  15. class Planning
  16. {
  17. public:
  18. Planning();
  19. ~Planning();
  20. bool Init();
  21. bool Make_plan(double x0,double y0,double x1,double y1);
  22. bool Make_plan(tf::Transform start,tf::Transform target);
  23. protected:
  24. private:
  25. static void tf_callback(const tf2_msgs::TFMessage::ConstPtr& msg,Planning* p);
  26. static void thread_publish_path(Planning* plan);
  27. public:
  28. ros::NodeHandle nh_;
  29. ros::Publisher path_publisher_;
  30. ros::Publisher path_publisher_left_;
  31. ros::Publisher path_publisher_right_;
  32. nav_msgs::Path path_;
  33. nav_msgs::Path path_left_;
  34. nav_msgs::Path path_right_;
  35. ros::ServiceClient make_plan_client_;
  36. ros::Subscriber tf_sub_;
  37. boost::thread* plan_publisher_thread_;
  38. boost::mutex mutex_path_;
  39. tf::Transform target_;
  40. tf::Transform start_pos_;
  41. };
  42. #endif