navigation_main.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // Created by zx on 23-5-8.
  3. //
  4. #ifndef NAVIGATION_NAVIGATION_MAIN_H
  5. #define NAVIGATION_NAVIGATION_MAIN_H
  6. #include "navigation.h"
  7. class NavigationMain:public Navigation {
  8. public:
  9. NavigationMain();
  10. ~NavigationMain();
  11. virtual void ResetPose(const Pose2d& pose);
  12. virtual void Start(const NavMessage::NavCmd& cmd,NavMessage::NavResponse& response);
  13. virtual void publish_statu(NavMessage::NavStatu& statu);
  14. void ResetOtherClamp(ClampStatu statu);
  15. virtual void HandleAgvStatu(const MqttMsg& msg);
  16. virtual void SwitchMode(Monitor_emqx::ActionMode mode,float wheelBase){
  17. if(move_mode_==mode)
  18. return;
  19. if(mode==Monitor_emqx::eMain)
  20. {
  21. if(timedBrotherPose_.timeout()==true || timedPose_.timeout()==true)
  22. {
  23. std::cout<<"Brother/self pose is timeout can not set MainAGV pose"<<std::endl;
  24. return;
  25. }
  26. //Pose2d transform(-wheelBase_/2.0,0,0);
  27. //Navigation::ResetPose(pose * transform);
  28. Pose2d brother=timedBrotherPose_.Get();
  29. Pose2d pose=timedPose_.Get();
  30. Pose2d diff=Pose2d::abs(Pose2d::relativePose(brother,pose));
  31. if(diff.x()>3.4 || diff.x()<2.3 || diff.y()>0.2 || diff.theta()>5*M_PI/180.0)
  32. {
  33. std::cout<<" distance with two agv is too far diff: "<<diff<<std::endl;
  34. return;
  35. }
  36. printf(" Switch MoveMode --> main\n");
  37. }
  38. wheelBase_=wheelBase;
  39. move_mode_=mode;
  40. }
  41. protected:
  42. virtual bool RotateBeforeEnterSpace(NavMessage::PathNode space,double wheelbase,NavMessage::PathNode& target);
  43. virtual void SendMoveCmd(Monitor_emqx::ActionMode mode,Monitor_emqx::ActionType type,
  44. double v,double angular);
  45. virtual bool clamp_close();
  46. virtual bool clamp_open();
  47. virtual bool CreateRobotStatuMsg(NavMessage::RobotStatu& robotStatu);
  48. protected:
  49. float wheelBase_; //两节agv的位姿与单节的位姿变换
  50. TimedLockData<int> timed_other_clamp_;
  51. };
  52. #endif //NAVIGATION_NAVIGATION_MAIN_H