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.
mitlib.pub/MITLIB/IODll/Motor_GALIL.h

209 lines
6.8 KiB
C++

// Motor_GALIL.h: interface for the CMotor_GALIL class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MOTOR_GALIL_H__B32C658E_7AF3_44AE_A7F0_CA13719016EA__INCLUDED_)
#define AFX_MOTOR_GALIL_H__B32C658E_7AF3_44AE_A7F0_CA13719016EA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "MotorBase.h"
#define OTF_MAX_TRIGGERS 300
//#define OTF_CMD_PARAM_LEN (strlen(",-65536"))
// #define OTF_CMD_PARAM_LEN 6
//#define OTF_CMD_PARAM_LEN (strlen("-65536") + strlen "A0[0]=") --> 6+5 roundoff to 12
#define OTF_CMD_PARAM_LEN 12
#define OTF_CMD_STRING_LEN 40
//#define OTF_MAX_CMD_LEN ((OTF_MAX_TRIGGERS * OTF_CMD_PARAM_LEN) + OTF_CMD_STRING_LEN)
#define OTF_MAX_CMD_LEN 1000 //actually it is 1024 proivided in GALIL document - limhs
#define OTF_MAX_PARAM_PER_LINE ( ((1000/OTF_CMD_PARAM_LEN)*10) /10)
class CMotor_GALIL : public CMotorBase
{
public:
CMotor_GALIL(CMtrProfile mtrProfile, double *dpPos);
virtual ~CMotor_GALIL();
// **************************************************************
// Methods declaration
// **************************************************************
// method to close the axis
void CloseAxis();
// method to initialize and configure the axis
void ConstructAxis() override;
// method to On/Off motor
int OnMtr(bool bOn);
// method to stop motor with decceleration
int DecStop();
// method to trigger Emergency stop the motor int EStop();
int EStop();
// method to get commanded position
double GetCommandPosition();
// method to get the motor axis IO status
int GetMotionIOStatus();
// method to get the Motor Ready Status
BOOL IsMotorReady();
// method to get the Motor Alarm Status
BOOL IsMotorAlarm();
// method to get the Motor Negative/CCW Limit Status
BOOL IsNegLmtHit();
// method to get the Motor Positive/CW Limit Status
BOOL IsPosLmtHit();
// method to get the Motor Home Sensor Status
BOOL IsHomed();
// method to check if the Motor is TURN ON
bool IsMtrOn();
// method Check other axis home sensor
BOOL IsHomed(CMtrProfile mtrProfile);
// method to get other motor axis IO status
int GetMotionIOStatus(CMtrProfile mtrProfile);
// method to get Other axis motor ready status
BOOL IsMotorReady(CMtrProfile mtrProfile);
// method to get Other axis Alarm status
BOOL IsMotorAlarm(CMtrProfile mtrProfile);
// method to get Other axis negative/ccw limit status
BOOL IsNegLmtHit(CMtrProfile mtrProfile);
// method to get Other axis positive/cw limit status
BOOL IsPosLmtHit(CMtrProfile mtrProfile);
// method to get Other axis home sensor status
bool IsMtrOn(CMtrProfile mtrProfile);
// method to get other motor axis current position
double GetOtherAxisPosition(CMtrProfile mtrProfile);
// method to get motor axis current position error
double GetPosErr();
// method to get the current motor position
double GetPosition();
// method to do homing by sensor as well as index
BOOL HomeBySensorAndIndex();
// method to do homing by index signal
BOOL HomeByIndex();
// method to do homing by Home Sensor
BOOL HomeBySensor();
// method to move absolute
int MoveAbs(double dPosition, int nPos = -1, int nMode = 0);
// method to move continuously
int MoveContinuously(bool bCW = true);
// method to move relative distance
int MoveRel(double dDistance, int nPos = -1);
// method to process interrupt to decode what happen to the motor
void ProcessInt(int nIntCode = 0);
// method to reset single trigger
int ResetSingleTrigger();
// method to set the commanded position register
int SetCommandPosition(double dPosition);
// method to set the mechanical coversion factor
int SetConversionFactor(double dUPR, double dPPR, double dEPPR);
// method to set homing modes
int SetHomeMode(int iHomeMode);
// method to set multiple trigger with PULSE Stretch
int SetMultipleTrigger(double dStartPosition, double dStopPosition, double dIntervalDistance, int nNoOfTrigger, int nCmpSource, int nPulseStretch);
// method to set multiple trigger
int SetMultipleTrigger(double dStartPosition, double dStopPosition, double dIntervalDistance, int nNoOfTrigger, int nCmpSource);// method to set multiple triggers
// method to set multiple trigger based on point table
int SetMultipleTrigger(double* pPosition, int nNoOfTrigger, int nCmpSource = 1);
// method to force set the current position
int SetPosition(double dPosition);
// method to arm controller axis for single trigger
int SetSingleTrigger(double dPosition, int nCmpSource = 1, int nPulseStretch = STRETCH_NON);
// method to arm multiaxis for simultaneous motion
int SimultaneousMove(int nNoOfAxis, CMtrProfile *mtrProfile, double *dPosition, double *dStartVel, double *dMaxVel, double *dAcc, int nMode = 0);
// method to move absolute with s-curve profile
int SMoveAbs(double dPosition, int nPos = -1, int nMode = 0);
// method to move motor in s-curve continuously
int SMoveContinuously(bool bCW = true);
// method to move relative distance with s-curve profile
int SMoveRel(double dDistance, int nPos = -1);
// method to set normal, slow acceleration
int SetAcce(double dAcce, bool bHomeSlow = false);
// method to set normal, slow deceleration
int SetDec(double dDec, bool bHomeSlow = false);
// return: success = MOTION_END; error = MOTION_ERROR; Force Stop = MOTION_FORCE_STOP
DWORD WaitHomeDone();
// method to get the encoder index signal
BOOL IsIndex();
// **************************************************************
// Methods declaration applicable to GALIL ONLY - STARTS
// **************************************************************
// method to get motion stop code
int GetStopCode();
// method to get motion stop code
CString GetVariable(CString csVariableName);
// method to send direct command string to controller
int SendCommand(CString csCommand);
// method to stop any running script program and stop all motion
int StopProgramAndMotion();
// method to update motion profile
int UpdateProfile();
// **************************************************************
// Methods declaration applicable to GALIL ONLY - ENDS
// **************************************************************
private:
int GalilFindHomeIndex(int nDir);
int GalilUpdateHomeSlowProfile();
int GalilFindHomeSensor();
int GalilAbsMove(double dPosition);
int GalilRelMove(double dDistance);
// Gary 20Sep11, V1.29.03, cater configurable trigger pulse width
int m_nPulseWidth;
};
#endif // !defined(AFX_MOTOR_GALIL_H__B32C658E_7AF3_44AE_A7F0_CA13719016EA__INCLUDED_)