You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
183 lines
6.3 KiB
C++
183 lines
6.3 KiB
C++
// Motor_ADLINK_ECAT.h: interface for the CMotor_ADLINK_ECAT class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
#pragma once
|
|
|
|
#include "MotorAdlinkBase.h"
|
|
|
|
#define MAX_AXIS_SIMULTANEOUS_MOV_ECAT 8
|
|
|
|
class CMotor_ADLINK_ECAT : public CMotorAdlinkBase
|
|
{
|
|
public:
|
|
CMotor_ADLINK_ECAT(const CMtrProfile& mtrProfile, double* dpPos, CMotionControllerBase* pBaseController);
|
|
virtual ~CMotor_ADLINK_ECAT();
|
|
|
|
// **************************************************************
|
|
// Methods declaration
|
|
// **************************************************************
|
|
|
|
// method to close the axis
|
|
void CloseAxis() override;
|
|
|
|
// method to initialize and configure the axis
|
|
void ConstructMotor() override;
|
|
|
|
void MotorMoveIntThread() override;
|
|
|
|
// method to On/Off motor
|
|
bool OnMotor() override;
|
|
bool OffMotor() override;
|
|
|
|
// method to stop motor with decceleration
|
|
bool DecelStop() override;
|
|
|
|
// method to trigger Emergency stop the motor int EStop();
|
|
bool EmergStop() override;
|
|
|
|
// method to get commanded position
|
|
bool GetMotorCommandedPosition(int nMtrNo, double& dRaw) override;
|
|
|
|
// method to get other motor axis IO status
|
|
int GetMotionIOStatus(const CMtrProfile& mtrProfile) override;
|
|
|
|
// method to get other motor axis current position
|
|
bool GetMotorPosition(const CMtrProfile& mtrProfile, double& dRawPosition) override;
|
|
|
|
// method to get motor axis current position error
|
|
bool GetMotorPositionError(double& dRawPositionError) override;
|
|
|
|
bool FindHome(HOME_DIR homeDir, MOTION_SPEED speed, bool bToggleHomeSensor);
|
|
|
|
bool FindHomeByMode(HOME_DIR homeDir, MOTION_SPEED speed);
|
|
|
|
// Home by sensor or by limit
|
|
BOOL HomeByHomeMode(int homeMode);
|
|
|
|
// method to do homing by limit sensor
|
|
BOOL HomingByLimit() override;
|
|
|
|
// method to do homing by index signal
|
|
BOOL HomeByIndex(bool bHomeSensorThenIndex = false) override;
|
|
|
|
// method to do homing by Home Sensor
|
|
BOOL HomeBySensor() override;
|
|
|
|
// method to home by home mode 27: (EL On Then reverse to count EZ number and reset counter)
|
|
BOOL HomeByLimitThenIndex() override;
|
|
|
|
// method to move absolute
|
|
bool AbsoluteMove(double dPosition, int nMode, PROFILE_CURVE curve) override;
|
|
|
|
// method to move continuously
|
|
int MoveContinuously(bool bCW = true) override;
|
|
|
|
// method to move relative distance
|
|
bool RelativeMove(double dDistance, PROFILE_CURVE curve) override;
|
|
|
|
// method to process interrupt to decode what happen to the motor
|
|
void ProcessInt(int nIntCode = 0) override;
|
|
|
|
// method to reset single trigger
|
|
int ResetSingleTrigger(double dPosition = 0.0) override;
|
|
|
|
// method to set the commanded position register
|
|
bool SetMotorCommandedPosition(double dPosition) override;
|
|
|
|
// method to set the mechanical coversion factor
|
|
bool RefreshMotorConversionFactor() override;
|
|
|
|
// method to set homing modes
|
|
bool SetMotorHomeMode(int iHomeMode) override;
|
|
|
|
int SetMultipleTrigger(double* pPosition, int nNoOfTrigger, int nCmpSource = 1) override;
|
|
|
|
// method to set multiple trigger
|
|
bool SetMotorMultipleTrigger(const multiple_trigger& trigger) override;
|
|
|
|
// method to force set the current position
|
|
bool SetMotorPosition(double dPosition) override;
|
|
|
|
// method to arm controller axis for single trigger
|
|
int SetSingleTrigger(double dPosition, int nCmpSource = 1, int nPulseStretch = STRETCH_NON) override;
|
|
|
|
// method to arm multiaxis for simultaneous motion
|
|
bool SetupAbsoluteSimultaneousMove(int nNoOfAxis, short* sAxis, double* dPosition, double* dStartVel, double* dMaxVel, double* dAcc, double* dDec) override;
|
|
bool SetupRelativeSimultaneousMove(int nNoOfAxis, short* sAxis, double* dPosition, double* dStartVel, double* dMaxVel, double* dAcc, double* dDec) override;
|
|
bool StartSimultaneousMove(const std::vector<short>& vecAxis) override;
|
|
// - use MotorAdLinkBase Simultaneous move Move - Lim HS
|
|
|
|
// method to move motor in s-curve continuously
|
|
int SMoveContinuously(bool bCW = true) override;
|
|
|
|
void SetMotorProfile(double dValue, motion_profile::PROFILE_TYPE type) override;
|
|
|
|
// method to set the motor type and encoder input type
|
|
bool SetMotorType(int iMtrType) override;
|
|
|
|
// method to set the motor alarm signal logic
|
|
bool SetMotorAlarmLogic(int iALM) override;
|
|
|
|
// method to set the home sensor signal logic
|
|
bool SetMotorHomeSensorLogic(int iORGI) override;
|
|
|
|
// method to set the encoder Index signal logic
|
|
bool SetMotorIndexLogic(int iIndexLogic) override;
|
|
|
|
// method to set the in position signal logic
|
|
bool SetMotorINPLogic(int iINP) override;
|
|
|
|
// method to set clk type, out/dir or cw/ccw
|
|
bool SetMotorClk(int iClk) override;
|
|
|
|
// Method to reset driver alarm via MotionNet
|
|
int ResetAlarm(bool bReset) override;
|
|
bool IsSimultaneousMoveSupported(void) override;
|
|
|
|
virtual double ConvertAccToMtrUnits(double dAcc, double dNumPulsePerMM) override;
|
|
|
|
// Motion Path Point Table
|
|
bool StopPathMove(const stMotionPath& motionPath) override;
|
|
bool SetupPathMoveMode(const stMotionPath& motionPath) override;
|
|
bool SetupPathMovePointTable(const stMotionPath& motionPath) override;
|
|
bool StartPathMove(const stMotionPath& motionPath) override;
|
|
|
|
//
|
|
bool ResetAlarm() override;
|
|
|
|
private:
|
|
int Home(bool bHomeReverse, bool bSlowSpeed);
|
|
|
|
bool PrepareMotionCurve(PROFILE_CURVE curve);
|
|
|
|
void Set4XMOEncoderSource();
|
|
|
|
enum PROFILE_TYPE
|
|
{
|
|
ACC,
|
|
DEC,
|
|
START_VEL,
|
|
MAX_VEL,
|
|
};
|
|
|
|
bool SetMotionProfile(PROFILE_TYPE profileType);
|
|
|
|
bool BeginContinuousMove(bool bDirection);
|
|
|
|
bool ContinuousMove(PROFILE_CURVE profileCurve, bool bDir);
|
|
|
|
bool PrepareForMove(PROFILE_CURVE profileCurve);
|
|
bool SetupSimultaneousMove(int nNoOfAxis, short* sAxis, double* dPosition, double* dStartVel, double* dMaxVel, double* dAcc, double* dDec, int movType);
|
|
|
|
bool SetupSimultaneousMoveAcclPerAxis(short sAxis, double dStartVel, double dAcc, double dDec);
|
|
|
|
int ResetAllInterrupts();
|
|
|
|
std::array<long, MAX_AXIS_SIMULTANEOUS_MOV_ECAT> m_AxisId{};
|
|
std::array<double, MAX_AXIS_SIMULTANEOUS_MOV_ECAT> m_Posn{};
|
|
std::array<double, MAX_AXIS_SIMULTANEOUS_MOV_ECAT> m_MaxVel{};
|
|
|
|
//
|
|
std::vector<int> m_vecInterruptNumber;
|
|
};
|