ResetMotionModel.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #pragma once
  2. #include "IMotionModel.h"
  3. namespace DiosCtrlBox
  4. {
  5. class ResetMotionStageArgs;
  6. class ITubeAngleController;
  7. class ITubeHeightController;
  8. class ISensorADController;
  9. class ISensorEncoderController;
  10. class ILandmarkController;
  11. class ResetMotionModel : public IMotionModel
  12. {
  13. public:
  14. ResetMotionModel();
  15. ~ResetMotionModel();
  16. public:
  17. virtual void ChangeStage(const std::string &stageName) override;
  18. virtual std::string GetStageName() override;
  19. virtual IMotionStageArgs *GetStageArgs() override;
  20. public:
  21. virtual void Initialize(IMachineryManager *machineryManager, IPositionManager *coordinates) override;
  22. virtual void LoadMachineryParams(ResDataObject &params) override;
  23. virtual void LoadModelParams(ResDataObject &params) override;
  24. virtual void SetTechnicalParams(ResDataObject &params) override;
  25. virtual void OnFeedbackMotionParams(ResDataObject &params) override;
  26. virtual BOOL GetMotionParams(ResDataObject &params) override;
  27. private:
  28. void OnMotionStage(const std::string &name);
  29. void OnStageClearParams();
  30. void OnStageTubeAngleMoveToLandmark();
  31. void OnStageTubeHeightMoveToLandmark();
  32. void OnStageTubeAngleFindLandmark();
  33. void OnStageTubeHeightFindLandmark();
  34. void OnStageTubeAngleStopAtLandmark();
  35. void OnStageTubeHeightStopAtLandmark();
  36. void OnStageTubeAngleGoOutOfLowLandmark();
  37. void OnStageTubeAngleGoOutOfHighLandmark();
  38. void OnStageTubeHeightGoOutOfLowLandmark();
  39. void OnStageTubeHeightGoOutOfHighLandmark();
  40. void OnStageTubeAngleAttachZAxis();
  41. void OnStageTubeHeightAttachZAxis();
  42. void OnStageTubeAngleDetachZAxis();
  43. void OnStageTubeHeightDetachZAxis();
  44. void OnStageTubeAngleFindZAxis();
  45. void OnStageTubeHeightFindZAxis();
  46. void OnStageTubeAngleStopAtZAxis();
  47. void OnStageTubeHeightStopAtZxis();
  48. void OnStageTubeAngleFinishReset();
  49. void OnStageTubeHeightFinishReset();
  50. void OnStageStopMove();
  51. int JudgeTubeRotateLandmarkDirection();
  52. int JudgeTubeHeightLandmarkDirection();
  53. float GetTubeRotateResetPosition();
  54. int JudgeRotateDirection(float currentAngle, float targetAngle);
  55. int JudgeHeightDirection(float currentHeight,float targetHeight);
  56. int ComputeTubeAngleZToLandmarkRotateDirection();
  57. int ComputeTubeHeightZToLandmarkMoveDirection();
  58. BOOL IsTubeAngleAtResetLandmark();
  59. BOOL IsTubeHeightAtResetLandmark();
  60. private:
  61. std::string m_StageName;
  62. ResetMotionStageArgs *m_stageArgs;
  63. IPositionManager *m_coordinates;
  64. ITubeAngleController *m_motorTubeAngle;
  65. ITubeHeightController *m_motorTubeHeight;
  66. ISensorADController *m_adDetectorHeight;
  67. ISensorEncoderController *m_encoderTubeAngle;
  68. ISensorEncoderController *m_encoderTubeHeight;
  69. ILandmarkController *m_landmark;
  70. DWORD m_resetRotatePeriod;
  71. DWORD m_resetHeightPeriod;
  72. int m_tubeRotateLandmarkDirection;
  73. int m_tubeHeightLandmarkDirection;
  74. float m_tubeRotateResetAngle;
  75. int m_tubeHeightAxisPositiveDirection;
  76. int m_tubeRotateAxisPositiveDirection;
  77. };
  78. }