Destroys the command channel and cleans up resources Call this when done using the command channel
Sets program execution direction to forward Used after reversing to resume normal forward execution
Promise resolving to RcsStatus indicating command completion
Homes a specific joint by moving it to its home position
Zero-based index of the joint to home, -1 to home all joints
Promise resolving to RcsStatus indicating command completion
Starts continuous jogging motion for a specific axis or joint
Index of the axis (0=X,1=Y,2=Z...) or joint to jog
true for joint jogging, false for axis jogging
Jogging speed in machine units per second
Promise resolving to RcsStatus indicating command completion
Jogs a specific distance at a given speed for an axis or joint
Index of the axis (0=X,1=Y,2=Z...) or joint to jog
true for joint jogging, false for axis jogging
Jogging speed in machine units per second
Distance to jog in machine units
Promise resolving to RcsStatus indicating command completion
Stops jogging motion for a specific axis or joint
Index of the axis (0=X,1=Y,2=Z...) or joint to stop
true for joint jogging, false for axis jogging
Promise resolving to RcsStatus indicating command completion
Executes a Manual Data Input (MDI) command Allows direct execution of G-code commands without a program file
G-code command string to execute
Promise resolving to RcsStatus indicating command completion
Resets the G-code interpreter
Promise resolving to RcsStatus indicating command completion
Reverses program execution direction Used for backing up through a program
Promise resolving to RcsStatus indicating command completion
Runs the currently loaded G-code program
Line number to start execution from (default: 0 for beginning)
Promise resolving to RcsStatus indicating command completion
Enables or disables adaptive feed functionality Allows external signals to modulate feedrate in real-time
true to enable adaptive feed, false to disable
Promise resolving to RcsStatus indicating command completion
Enables or disables block delete functionality When enabled, lines beginning with "/" are skipped during execution
true to enable block delete, false to disable
Promise resolving to RcsStatus indicating command completion
Sets debug flags for LinuxCNC components using OR-ed EmcDebug flags Multiple debug categories can be enabled simultaneously by combining flags
Debug flags from EmcDebug enum, can be OR-ed together
Promise resolving to RcsStatus indicating command completion
// Disable all debugging
await commandChannel.setDebugLevel(0);
// Enable interpreter debugging only
await commandChannel.setDebugLevel(EmcDebug.INTERP);
// Enable multiple debug categories
await commandChannel.setDebugLevel(EmcDebug.INTERP | EmcDebug.MOTION_TIME);
// Enable task and NML debugging
await commandChannel.setDebugLevel(EmcDebug.TASK_ISSUE | EmcDebug.NML);
// Enable Python and remap debugging for custom components
await commandChannel.setDebugLevel(EmcDebug.PYTHON | EmcDebug.REMAP);
Sets the state of a digital output pin
Index of the digital output pin
true to set high, false to set low
Promise resolving to RcsStatus indicating command completion
Enables or disables feed hold functionality When enabled, allows pausing motion without stopping the program
true to enable feed hold, false to disable
Promise resolving to RcsStatus indicating command completion
Enables or disables feedrate override functionality
true to enable feedrate override, false to disable
Promise resolving to RcsStatus indicating command completion
Sets the feedrate override scale factor
Feedrate scale factor (1.0 = 100%, 0.5 = 50%, 2.0 = 200%)
Promise resolving to RcsStatus indicating command completion
Turns flood coolant on or off
true to turn flood on, false to turn off
Promise resolving to RcsStatus indicating command completion
Sets the maximum position limit for a joint
Zero-based index of the joint
Maximum position limit in machine units
Promise resolving to RcsStatus indicating command completion
Sets the minimum position limit for a joint
Zero-based index of the joint
Minimum position limit in machine units
Promise resolving to RcsStatus indicating command completion
Turns mist coolant on or off
true to turn mist on, false to turn off
Promise resolving to RcsStatus indicating command completion
Enables or disables optional stop (M1) functionality When enabled, M1 codes in programs will pause execution
true to enable optional stops, false to disable
Promise resolving to RcsStatus indicating command completion
Sets the spindle speed override scale factor
Spindle override scale factor (1.0 = 100%)
Index of the spindle to control (default: 0)
Promise resolving to RcsStatus indicating command completion
Enables or disables spindle speed override functionality
true to enable spindle override, false to disable
Index of the spindle to control (default: 0)
Promise resolving to RcsStatus indicating command completion
Sets the task state for LinuxCNC
The task state to set (ESTOP, ESTOP_RESET, OFF, or ON)
Promise resolving to RcsStatus indicating command completion
Sets the task execution mode for LinuxCNC
The task mode to set (MDI, MANUAL, or AUTO)
Promise resolving to RcsStatus indicating command completion
Sets tool data for a specific tool number Updates tool geometry and parameters in the tool table
Tool entry containing tool number and optional geometry data
Promise resolving to RcsStatus indicating command completion
Sets the trajectory mode for coordinated motion
The trajectory mode (FREE, COORD, or TELEOP)
Promise resolving to RcsStatus indicating command completion
Engages or releases the spindle brake
true to engage brake, false to release brake
Index of the spindle to control (default: 0)
Promise resolving to RcsStatus indicating command completion
Decreases spindle speed by a predefined increment Spindle must already be running
Index of the spindle to control (default: 0)
Promise resolving to RcsStatus indicating command completion
Increases spindle speed by a predefined increment Spindle must already be running
Index of the spindle to control (default: 0)
Promise resolving to RcsStatus indicating command completion
Turns off the spindle
Index of the spindle to control (default: 0)
Promise resolving to RcsStatus indicating command completion
Turns on the spindle at a specified speed
Spindle speed in RPM (positive = clockwise, negative = counterclockwise)
Index of the spindle to control (default: 0)
Whether to wait for spindle to reach speed before continuing (default: true)
Promise resolving to RcsStatus indicating command completion
On completion of this call, the VAR file on disk is updated with live values from the interpreter.
Promise resolving to RcsStatus indicating command completion
Enables or disables teleop mode
true to enable teleop mode, false for joint mode
Promise resolving to RcsStatus indicating command completion
Unhomes a specific joint, clearing its homed status
Zero-based index of the joint to unhome, -1 to unhome all joints
Promise resolving to RcsStatus indicating command completion
Synchronously waits for the last command to complete This does the same as await but provides a synchronous way to wait for command completion
Optionaltimeout: numberMaximum time to wait in seconds (default: 5 seconds)
RcsStatus indicating completion status (RCS_DONE, RCS_ERROR, or -1 for timeout)
// These two approaches are equivalent:
// Approach 1: Using await (asynchronous)
await commandChannel.runProgram();
console.log('Program completed');
// Approach 2: Using waitComplete (synchronous)
commandChannel.runProgram(); // Fire and forget - don't await
const status = commandChannel.waitComplete(); // Synchronously wait for completion
if (status === RcsStatus.DONE) {
console.log('Program completed');
}
Aborts the currently running task/program Immediately stops all motion and task execution