1
0

forklift.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef __FORKLIFT_H__
  2. #define __FORKLIFT_H__
  3. #include <ros/ros.h>
  4. #include "std_msgs/String.h"
  5. #include <mutex>
  6. #include "cons_planner/cons_planner.h"
  7. #include "common/common.h"
  8. namespace forklift
  9. {
  10. struct RudderAnt
  11. {
  12. RudderAnt() : angle(0),
  13. vel(0),
  14. offset(0),
  15. p(3.0),
  16. min_rudder_angle(0.),
  17. max_rudder_angle(0.),
  18. toler_angle(0.17),
  19. t(ros::Time(0))
  20. {}
  21. float angle;
  22. float offset;
  23. float vel;
  24. float p;
  25. float min_rudder_angle;
  26. float max_rudder_angle;
  27. float toler_angle;
  28. ros::Time t;
  29. };
  30. class FL : public cons::consPlanner
  31. {
  32. public:
  33. FL();
  34. ~FL();
  35. virtual common::NavState computeVelocityCommands(common::Point& sta_pose, common::Twist& cmd);
  36. virtual void destroy();
  37. private:
  38. ros::NodeHandle nh_;
  39. ros::Subscriber sub_;
  40. void __rudderAngleCallback(const std_msgs::StringConstPtr &msg);
  41. bool __readConf();
  42. RudderAnt __getRudderAnt();
  43. RudderAnt rudder_ant_;
  44. std::mutex mutex_;
  45. #define RUN_LOCK() std::lock_guard<std::mutex> lockGuard(mutex_);
  46. };
  47. } // namespace diff
  48. #endif