ResetMotionModel.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #pragma once
  2. #include "IMotionModel.h"
  3. namespace DIOS::Dev::Detail::MachineryECOM
  4. {
  5. class ResetMotionStageArgs;
  6. class ITubeAngleController;
  7. class ITubeHeightController;
  8. class ISensorADController;
  9. class ISensorEncoderController;
  10. class ILandmarkController;
  11. class IOutputController;
  12. class ResetMotionModel : public IMotionModel
  13. {
  14. public:
  15. ResetMotionModel();
  16. ~ResetMotionModel();
  17. public:
  18. virtual void ChangeStage(const std::string &stageName) override;
  19. virtual std::string GetStageName() override;
  20. virtual IMotionStageArgs *GetStageArgs() override;
  21. public:
  22. virtual void Initialize(IMachineryManager *machineryManager, IPositionManager *coordinates) override;
  23. virtual void LoadMachineryParams(ResDataObject &params) override;
  24. virtual void LoadModelParams(ResDataObject &params) override;
  25. virtual void SetTechnicalParams(ResDataObject &params) override;
  26. virtual void OnFeedbackMotionParams(ResDataObject &params) override;
  27. virtual BOOL GetMotionParams(ResDataObject &params) override;
  28. virtual void SwitchScanningComponents(int nSwitch) override;
  29. virtual void SwitchWorkstation(string ws) override;
  30. private:
  31. void OnMotionStage(const std::string &name);
  32. void OnStageClearParams();
  33. void OnStageTubeAngleMoveToLandmark();
  34. void OnStageTubeHeightMoveToLandmark();
  35. void OnStageTubeAngleFindLandmark();
  36. void OnStageTubeHeightFindLandmark();
  37. void OnStageTubeAngleStopAtLandmark();
  38. void OnStageTubeHeightStopAtLandmark();
  39. void OnStageTubeAngleGoOutOfLowLandmark();
  40. void OnStageTubeAngleGoOutOfHighLandmark();
  41. void OnStageTubeHeightGoOutOfLowLandmark();
  42. void OnStageTubeHeightGoOutOfHighLandmark();
  43. void OnStageTubeAngleAttachZAxis();
  44. void OnStageTubeHeightAttachZAxis();
  45. void OnStageTubeAngleDetachZAxis();
  46. void OnStageTubeHeightDetachZAxis();
  47. void OnStageTubeAngleFindZAxis();
  48. void OnStageTubeHeightFindZAxis();
  49. void OnStageTubeAngleStopAtZAxis();
  50. void OnStageTubeHeightStopAtZxis();
  51. void OnStageTubeAngleFinishReset();
  52. void OnStageTubeHeightFinishReset();
  53. void OnStageStopMove();
  54. int JudgeTubeRotateLandmarkDirection();
  55. int JudgeTubeHeightLandmarkDirection();
  56. float GetTubeRotateResetPosition();
  57. int JudgeRotateDirection(float currentAngle, float targetAngle);
  58. int JudgeHeightDirection(float currentHeight,float targetHeight);
  59. int ComputeTubeAngleZToLandmarkRotateDirection();
  60. int ComputeTubeHeightZToLandmarkMoveDirection();
  61. BOOL IsTubeAngleAtResetLandmark();
  62. BOOL IsTubeHeightAtResetLandmark();
  63. void OnStageTubeHorizontalMoveToLandmark();
  64. void OnStageTubeHorizontalFindLandmark();
  65. void OnStageTubeHorizontalStopAtLandmark();
  66. void OnStageTubeHorizontalGoOutOfLeftLandmark();
  67. void OnStageTubeHorizontalGoOutOfRightLandmark();
  68. void OnStageTubeHorizontalAttachZAxis();
  69. void OnStageTubeHorizontalDetachZAxis();
  70. void OnStageTubeHorizontalFindZAxis();
  71. void OnStageTubeHorizontalStopAtZxis();
  72. void OnStageTubeHorizontalFinishReset();
  73. int JudgeTubeHorizontalLandmarkDirection();
  74. int JudgeHorizontalDirection(float currentHorizontalPos, float targetHorizontalPos);
  75. int ComputeTubeHorizontalZToLandmarkMoveDirection();
  76. BOOL IsTubeHorizontalAtResetLandmark();
  77. void MoveTubeHorizontal(int direction, int steps, int pwmperiod);
  78. void MoveTubeHeight(int direction, int steps, int pwmperiod);
  79. void MoveTubeAngle(float despos);
  80. void OnMotionStageMove2SID();
  81. private:
  82. std::string m_StageName;
  83. ResetMotionStageArgs *m_stageArgs;
  84. IPositionManager *m_coordinates;
  85. ITubeAngleController *m_motorTubeAngle;
  86. ITubeHeightController *m_motorTubeHeight;
  87. ISensorADController *m_adDetectorHeight;
  88. ISensorEncoderController *m_encoderTubeAngle;
  89. ISensorEncoderController *m_encoderTubeHeight;
  90. ILandmarkController *m_landmark;
  91. DWORD m_resetRotatePeriod;
  92. DWORD m_resetHeightPeriod;
  93. int m_tubeRotateLandmarkDirection;
  94. int m_tubeHeightLandmarkDirection;
  95. float m_tubeRotateResetAngle;
  96. int m_tubeHeightAxisPositiveDirection;
  97. int m_tubeRotateAxisPositiveDirection;
  98. float m_tubeHeightLowPositionofRest;
  99. int m_tubeHorizontalLandmarkDirection;
  100. int m_tubeHorizontalAxisPositiveDirection;
  101. DWORD m_resetHorizontalPeriod;
  102. ITubeHeightController* m_motorTubeHorizontal;
  103. ISensorADController* m_adTubeHorizontal;
  104. ISensorEncoderController* m_encoderTubeHorizontal;
  105. IOutputController* m_tubeLineMotionSwitch;
  106. };
  107. }