#pragma once #include "IMotionModel.h" namespace DIOS::Dev::Detail::MachineryECOM { class ResetMotionStageArgs; class ITubeAngleController; class ITubeHeightController; class ISensorADController; class ISensorEncoderController; class ILandmarkController; class IOutputController; class ResetMotionModel : public IMotionModel { public: ResetMotionModel(); ~ResetMotionModel(); public: virtual void ChangeStage(const std::string &stageName) override; virtual std::string GetStageName() override; virtual IMotionStageArgs *GetStageArgs() override; public: virtual void Initialize(IMachineryManager *machineryManager, IPositionManager *coordinates) override; virtual void LoadMachineryParams(ResDataObject ¶ms) override; virtual void LoadModelParams(ResDataObject ¶ms) override; virtual void SetTechnicalParams(ResDataObject ¶ms) override; virtual void OnFeedbackMotionParams(ResDataObject ¶ms) override; virtual BOOL GetMotionParams(ResDataObject ¶ms) override; virtual void SwitchScanningComponents(int nSwitch) override; virtual void SwitchWorkstation(string ws) override; private: void OnMotionStage(const std::string &name); void OnStageClearParams(); void OnStageTubeAngleMoveToLandmark(); void OnStageTubeHeightMoveToLandmark(); void OnStageTubeAngleFindLandmark(); void OnStageTubeHeightFindLandmark(); void OnStageTubeAngleStopAtLandmark(); void OnStageTubeHeightStopAtLandmark(); void OnStageTubeAngleGoOutOfLowLandmark(); void OnStageTubeAngleGoOutOfHighLandmark(); void OnStageTubeHeightGoOutOfLowLandmark(); void OnStageTubeHeightGoOutOfHighLandmark(); void OnStageTubeAngleAttachZAxis(); void OnStageTubeHeightAttachZAxis(); void OnStageTubeAngleDetachZAxis(); void OnStageTubeHeightDetachZAxis(); void OnStageTubeAngleFindZAxis(); void OnStageTubeHeightFindZAxis(); void OnStageTubeAngleStopAtZAxis(); void OnStageTubeHeightStopAtZxis(); void OnStageTubeAngleFinishReset(); void OnStageTubeHeightFinishReset(); void OnStageStopMove(); int JudgeTubeRotateLandmarkDirection(); int JudgeTubeHeightLandmarkDirection(); float GetTubeRotateResetPosition(); int JudgeRotateDirection(float currentAngle, float targetAngle); int JudgeHeightDirection(float currentHeight,float targetHeight); int ComputeTubeAngleZToLandmarkRotateDirection(); int ComputeTubeHeightZToLandmarkMoveDirection(); BOOL IsTubeAngleAtResetLandmark(); BOOL IsTubeHeightAtResetLandmark(); void OnStageTubeHorizontalMoveToLandmark(); void OnStageTubeHorizontalFindLandmark(); void OnStageTubeHorizontalStopAtLandmark(); void OnStageTubeHorizontalGoOutOfLeftLandmark(); void OnStageTubeHorizontalGoOutOfRightLandmark(); void OnStageTubeHorizontalAttachZAxis(); void OnStageTubeHorizontalDetachZAxis(); void OnStageTubeHorizontalFindZAxis(); void OnStageTubeHorizontalStopAtZxis(); void OnStageTubeHorizontalFinishReset(); int JudgeTubeHorizontalLandmarkDirection(); int JudgeHorizontalDirection(float currentHorizontalPos, float targetHorizontalPos); int ComputeTubeHorizontalZToLandmarkMoveDirection(); BOOL IsTubeHorizontalAtResetLandmark(); void MoveTubeHorizontal(int direction, int steps, int pwmperiod); void MoveTubeHeight(int direction, int steps, int pwmperiod); void MoveTubeAngle(float despos); void OnMotionStageMove2SID(); private: std::string m_StageName; ResetMotionStageArgs *m_stageArgs; IPositionManager *m_coordinates; ITubeAngleController *m_motorTubeAngle; ITubeHeightController *m_motorTubeHeight; ISensorADController *m_adDetectorHeight; ISensorEncoderController *m_encoderTubeAngle; ISensorEncoderController *m_encoderTubeHeight; ILandmarkController *m_landmark; DWORD m_resetRotatePeriod; DWORD m_resetHeightPeriod; int m_tubeRotateLandmarkDirection; int m_tubeHeightLandmarkDirection; float m_tubeRotateResetAngle; int m_tubeHeightAxisPositiveDirection; int m_tubeRotateAxisPositiveDirection; float m_tubeHeightLowPositionofRest; int m_tubeHorizontalLandmarkDirection; int m_tubeHorizontalAxisPositiveDirection; DWORD m_resetHorizontalPeriod; ITubeHeightController* m_motorTubeHorizontal; ISensorADController* m_adTubeHorizontal; ISensorEncoderController* m_encoderTubeHorizontal; IOutputController* m_tubeLineMotionSwitch; }; }