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.

71 lines
2.2 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
#ifndef _INCLUDE_MOTOR_GUGAO_AXIS_H
#define _INCLUDE_MOTOR_GUGAO_AXIS_H
#include "CardService.h"
enum EHomeType
{//回原方式
EHOME_CAPTURE = 0, //硬件捕获回原
EHOME_ECAPTURE, //伺服捕获回原
EHOME_NORMAL, //普通回原
EHOME_EINDEX, //INDEX捕获回原
};
class CAxis
{
public:
CAxis(ushort cardIndex, ushort axisIndex);
~CAxis();
void SetArrive(bool bcheck) { m_bCheckArrive = bcheck; }
int Init();
int On();
int Off();
int Reset();
int Home(ushort homeType, long pos, long offset, double vel); //回原
int SetZeroPos(); //清除位置信息;(清零规划位置和实际位置,设置机械原点)
int SetSpeed(double vel, int bchange = 0); //设置单轴速度
int SetPos(long pos); //设置目标位置并运动
int MovePos(long pos, double vel, double acc, double dec); //移动到指定位置,运动中可更换指令
int MoveOffset(long offset, double vel, double acc, double dec); //移动相对位置
int MoveJog(int dir, double vel, double acc, double dec); //连续移动
double GetCurPos(EMPosType postype); //获取当前位置
int IsMoving();
int Stop(int type = 0); //停止运动, 包括回原
ushort GetCardIndex() { return m_cardIndex; }
ushort GetAxisIndex() { return m_axisIndex; }
int GearMove(CAxis* pAxis, int iGearType, double ratio, long masterSlope = 0);
protected:
void StopAndWait(int type = 0); //停止并等待停稳
int StopMove(int type = 0); //停止运动
int homeSts(ushort *pStatus); //获取回原点状态
int ClearStatus(); // 清除轴状态
int isRealMoving(); //判断实际是否在运动中
int HomeAsCapture(long homePos, long offset, double vel, int type = 0); //捕获回原
int HomeAsIndex(long homePos, long offset, long doffset);
int HomeAsNormal(long homePos, long offset, double vel); //正常回原
bool WaitExitMoveSign(int iWait); //等待运动退出信号若返回true则说明有退出信号
private:
Handle m_hQuitEvt; //退出回原句柄
Handle m_hHomeFinishedEvt; //回原函数退出事件
bool m_bInit; //是否使能
bool m_bCheckArrive; //是否检测到位信号
ushort m_cardIndex;
ushort m_axisIndex;
};
#endif //防止重复包含