XScript Manual · Chapter 14
title: "MOTION — interpolated motion" chapter: 14
MOTION — interpolated motion
MOTION is the global object for 2–4-axis linear / circular interpolation
and continuous-path (conti) execution. Axes are grouped into coords;
each coord has its own queue and runs independently.
Basic example
// Coord 0: 2 axes (#4 and #8)
MOTION.SetAxisMap(0, 2, 4, 8);
// Absolute mode
MOTION.SetAbsRelMode(0, false);
// 100 mm/s, 0.1 s accel/decel
MOTION.SetSpeed(0, 100, 0.1);
// Queue path nodes
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);
// Start
MOTION.StartConti(0);
// Wait for queue to drain (10 s)
if (MOTION.WaitQueueCount(0, 0, 10000) == false)
{
return;
}
// Wait for motion stop (1 s)
if (MOTION.Wait(0, 1000) == false)
{
return;
}Methods
Coord setup
| Signature | Description |
|---|---|
bool SetAxisMap(int coord, int axisCount, int axis1, int axis2, int axis3 = -1, int axis4 = -1) | Assign axes (2–4) |
bool SetSpeed(int coord, double vel, double accel = 0.2, double decel = 0) | Velocity & accel/decel |
bool SetAbsRelMode(int coord, bool isRelMode) | Absolute / relative |
Path building
| Signature | Description |
|---|---|
bool MoveLine(int coord, double pos1, double pos2, double pos3 = 0, double pos4 = 0) | Linear |
bool MoveCircleCenter(int coord, double centerX, double centerY, double endX, double endY, bool isCWDir) | Center + end point |
bool MoveCirclePoint(int coord, double midX, double midY, double endX, double endY, bool isCircle) | 3-point arc |
bool MoveCircleRadius(int coord, double radius, double endX, double endY, bool isCWDir, bool isLongDistance) | Radius + end |
bool MoveCircleAngle(int coord, double centerX, double centerY, double angle, bool isCWDir) | Angle arc |
Continuous-path queue
| Signature | Description |
|---|---|
bool BeginContiNode(int coord) / bool EndContiNode(int coord) | Queue enter/leave |
bool StartConti(int coord) | Start queued path |
bool ClearContiQueue(int coord) | Clear queue |
bool IsQueueEmpty(int coord) | Queue empty |
int GetQueueCount(int coord) | Remaining nodes |
int GetContiNodeNum(int coord) | Current node index |
int GetContiTotalNodeNum(int coord) | Total nodes |
Wait / status
| Signature | Description |
|---|---|
bool IsInMotion(int coord) | In motion |
bool Wait(int coord, int timeoutMsec = 10000) | Wait for complete |
bool WaitQueueCount(int coord, int queueCount, int timeoutMsec = 10000) | Wait for queue ≤ queueCount |
double GetDistanceTime(double dist, double speed, double accTime, double decTime) | Estimated time |
Gantry
| Signature | Description |
|---|---|
bool SetGantryMap(int master, int slave, int homeUse, double slaveOffset, double errorOffset) | Configure gantry |
bool GetGantryInfo(int master, ref int homeUse, ref double slaveOffset, ref double errorOffset, ref bool gantryOn) | Inspect |
bool SetGantryDisable(int master, int slave) | Disable |
Property
| Property | Type | Description |
|---|---|---|
Ready | bool | Interpolation engine ready |
Tips
- Always use
BeginContiNode→MoveLine/Circle…→EndContiNode→StartConti. - Keep adding to the queue before it drains to get smooth transitions.
accel/decelare times (sec) — very short segments may never reach target speed.- Gantry: command only the master; the slave follows automatically.