XScript 매뉴얼 · Chapter 14

title: "MOTION — 보간 제어" chapter: 14

MOTION — 보간 제어

MOTION 글로벌 객체는 2~4축 직선/원호 보간연속 경로(Conti) 실행을 담당합니다. 축을 Coord(좌표 그룹) 단위로 묶어 좌표별로 독립된 경로를 큐잉하고 실행합니다.

기본 예제

// 0번 Coord에 2축(4번·8번 축) 연결
MOTION.SetAxisMap(0, 2, 4, 8);
 
// 절대 모드
MOTION.SetAbsRelMode(0, false);
 
// 속도 100mm/s, 가감속 0.1s
MOTION.SetSpeed(0, 100, 0.1);
 
// 경로 노드 큐잉 시작
MOTION.BeginContiNode(0);
 
MOTION.MoveLine(0, 100.0, 0.0);
MOTION.MoveLine(0, 100.0, 100.0);
MOTION.MoveLine(0, 0.0, 100.0);
MOTION.MoveLine(0, 0.0, 0.0);
 
MOTION.EndContiNode(0);
 
// 이동 시작
MOTION.StartConti(0);
 
// 큐 소비까지 10초 대기
if (MOTION.WaitQueueCount(0, 0, 10000) == false)
{
    return;
}
 
// 최종 정지까지 1초 대기
if (MOTION.Wait(0, 1000) == false)
{
    return;
}

메서드

좌표 구성

시그니처설명
bool SetAxisMap(int coord, int axisCount, int axis1, int axis2, int axis3 = -1, int axis4 = -1)Coord 에 축 할당 (2~4축)
bool SetSpeed(int coord, double vel, double accel = 0.2, double decel = 0)속도·가감속 (mm/s, s)
bool SetAbsRelMode(int coord, bool isRelMode)절대/상대 모드

경로 생성

시그니처설명
bool MoveLine(int coord, double pos1, double pos2, double pos3 = 0, double pos4 = 0)직선 보간
bool MoveCircleCenter(int coord, double centerX, double centerY, double endX, double endY, bool isCWDir)중심+종점 원호
bool MoveCirclePoint(int coord, double midX, double midY, double endX, double endY, bool isCircle)3점 원호
bool MoveCircleRadius(int coord, double radius, double endX, double endY, bool isCWDir, bool isLongDistance)반경+종점 원호
bool MoveCircleAngle(int coord, double centerX, double centerY, double angle, bool isCWDir)각도 원호

연속 경로 큐

시그니처설명
bool BeginContiNode(int coord) / bool EndContiNode(int coord)큐 노드 추가 모드
bool StartConti(int coord)큐 실행 시작
bool ClearContiQueue(int coord)큐 비우기
bool IsQueueEmpty(int coord)큐 비었는지
int GetQueueCount(int coord)남은 큐 수
int GetContiNodeNum(int coord)현재 노드 번호
int GetContiTotalNodeNum(int coord)전체 노드 수

대기 · 상태

시그니처설명
bool IsInMotion(int coord)이동 중
bool Wait(int coord, int timeoutMsec = 10000)완료 대기
bool WaitQueueCount(int coord, int queueCount, int timeoutMsec = 10000)큐가 지정 개수 이하가 될 때까지 대기
double GetDistanceTime(double dist, double speed, double accTime, double decTime)예상 소요시간 계산

갠트리 연동

시그니처설명
bool SetGantryMap(int master, int slave, int homeUse, double slaveOffset, double errorOffset)갠트리 맵 설정
bool GetGantryInfo(int master, ref int homeUse, ref double slaveOffset, ref double errorOffset, ref bool gantryOn)현재 설정 조회
bool SetGantryDisable(int master, int slave)해제

프로퍼티

프로퍼티타입설명
Readybool보간 엔진 준비 완료

  • 연속 경로 실행 전에는 항상 BeginContiNodeMoveLine/Circle…EndContiNodeStartConti 순서.
  • 큐가 비기 전에 다음 배치를 추가하면 부드러운 경로 연결이 가능.
  • 가감속 시간(accel, decel)은 시간 단위(sec) 이며, 경로 길이가 짧으면 목표 속도에 도달하지 못할 수 있음.
  • 갠트리 축은 SetGantryMap 후 Master 축에만 명령. Slave 는 자동 추종.