THIS PAGE IS BEING EDITED TO REFLECT THE AGREEMENT TO REBRAND EMC2 AS LINUXCNC
Using emcrsh:
Include the following line in a .hal file that is loaded by your EMC installation at startup.
loadusr emcrsh {-- --port <port number> --name <server name> --connectpw <password> --enablepw <password> --sessions <max sessions> -ini<inifile>}
With -- --port Waits for socket connections (Telnet) on specified socket, without port uses default port 5007. With -- --name <server name> Sets the server name to specified name for Hello. With -- --connectpw <password> Sets the connection password to 'password'. Default EMC With -- --enablepw <password> Sets the enable password to 'password'. Default EMCTOO With -- --sessions <max sessions> Sets the maximum number of simultaneous connections to max sessions. Default is no limit (-1). With -- -ini <inifile>, uses inifile instead of emc.ini. Double dashes are needed in front of all options, except the last -ini.
When testing emcrsh for the first time, none of the options are essential, so the line loadusr emcrsh appended to the end of your .hal file is sufficient to load the emcrsh service when EMC is started. Note you can start the EMC session interactively, or from a local or remote terminal session using /usr/bin/emc. You interact with the EMC session via the emcrsh service from a remote terminal, using Telnet <server> <port>, where server is the name (or IP address) of the machine running EMC. The default port is 5007, so a typical usage is telnet mycnc.local 5007.
There are six optional commands supported by emcrsh, where the commands set and get contain EMC specific sub-commands based on the commands supported by emcsh, but where the "emc_" is omitted. Commands and most parameters are not case sensitive. The exceptions are passwords, file paths and text strings.
--(0)> telnet 10.0.1.7 5007
Trying 10.0.1.7...
Connected to 10.0.1.7
Escape character is '^]'.
hello EMC x 1.0
HELLO ACK EMCNETSVR 1.1
help
help
Available commands:
Hello <password> <client name> <protocol version>
Get <emc command>
Set <emc command>
Shutdown
Help <command>
quit quit
==> HELLO <==
Hello <password> <client> <version> is a typical usage. Note that although <client> and <version> are not currently used by emcrsh, you MUST supply dummy inputs for these. For example, Hello EMC 1 1. If a valid password was entered the server will respond with
HELLO ACK <Server Name> <Server Version>
Where server name and server version are looked up from the implementation. if an invalid password or any other syntax error occurs then the server responds with:
HELLO NAK
==> Get <==
The get command includes one of the emc sub-commands, described below and zero or more additional parameters.
==> Set <==
The set command inclides one of the emc sub-commands, described below and one or more additional parameters.
==> Quit <==
The quit command disconnects the associated socket connection.
==> Shutdown <==
The shutdown command tells EMC to shutdown before quitting the connection. This command may only be issued if the Hello has been successfully negotiated and the connection has control of the CNC (see enable sub-command below). This command has no parameters.
==> Help <==
The help command will return help information in text format over the telnet connection. If no parameters are specified, it will itemize the available commands. If a command is specified, it will provide usage information for the specified command. Help will respond regardless of whether a "Hello" has been successsfully negotiated.
With get will return the current echo state, with set, sets the echo state. When echo is on, all commands will be echoed upon receipt. This state is local to each connection.
With get will return the current verbose state, with set, sets the verbose state. When in verbose mode is on, all set commands return positive acknowledgement in the form SET <COMMAND> ACK. In addition, text error messages will be issued when in verbose mode. This state is local to each connection.
With get will return On or Off to indicate whether the current connection is enabled to perform control functions. With set and a valid password, the current connection is enabled for control functions. "OFF" may not be used as a password and disables control functions for this connection.
With get, will return the current communications mode. With set, will set the communications mode to the specified mode. The binary protocol is TBD.
With get, returns the current protocol version used by the server, with set, sets the server to use the specified protocol version, provided it is lower than or equal to the highest version number supported by the server implementation.
Returns the path and file name of the current configuration inifile.
Returns the platform for which this was compiled, e.g., linux_2_0_36
Returns the string value of <var> in section <section>, in EMC_INIFILE
With get, returns the integer value of EMC_DEBUG, in the EMC. Note that it may not be true that the local EMC_DEBUG variable here (in emcsh and the GUIs that use it) is the same as the EMC_DEBUG value in the EMC. This can happen if the EMC is started from one .ini file, and the GUI is started with another that has a different value for DEBUG. With set, sends a command to the EMC to set the new debug level, and sets the EMC_DEBUG global here to the same value. This will make the two values the same, since they really ought to be the same.
Set the wait for commands to return to be right away (none), after the command was sent and received (received), or after the command was done (done).
Force a wait for the previous command to be received, or done. This lets you wait in the event that "emc_set_wait none" is in effect.
Set the timeout for commands to return to <timeout>, in seconds. Timeout is a real number. If it's <= 0.0, it means wait forever. Default is 0.0, wait forever.
With no arg, forces an update of the EMC status. With "none", doesn't cause an automatic update of status with other emc_ words. With "auto", makes emc_ words automatically update status before they return values.
Returns the current EMC error string, or "ok" if no error.
Returns the current EMC operator display string, or "ok" if none.
Returns the current EMC operator text string, or "ok" if none.
Returns the time, in seconds, from the start of the epoch. This starting time depends on the platform.
With no arg, returns the estop setting as "on" or "off". Otherwise, sends an estop on or off command.
With no arg, returns the machine setting as "on" or "off". Otherwise, sends a machine on or off command.
With no arg, returns the mode setting as "manual", "auto", or "mdi". Otherwise, sends a mode manual, auto, or mdi command.
With no arg, returns the mist setting as "on" or "off". Otherwise, sends a mist on or off command.
With no arg, returns the flood setting as "on" or "off". Otherwise, sends a flood on or off command.
With no arg, returns the lubricant pump setting as "on" or "off". Otherwise, sends a lube on or off command.
Returns the lubricant level sensor reading as "ok" or "low".
With no arg, returns the value of the spindle state as "forward", "reverse", "increase", "decrease", or "off". With arg, sends the spindle command. Note that "increase" and "decrease" will cause a speed change in the corresponding direction until a "constant" command is sent.
With no arg, returns the brake setting. Otherwise sets the brake.
Returns the id of the currently loaded tool
Returns the currently applied tool length offset
Loads the tool table specified by <file>
Homes the indicated axis.
Stop the axis jog
Jog the indicated axis at <speed>; sign of speed is direction
Jog the indicated axis by increment <incr> at the <speed>; sign of speed is direction
With no args, returns the current feed override, as a percent. With argument, set the feed override to be the percent value
With no args, returns the current spindle override, as a percent. With argument, set the spindle override to be the percent value
Returns double obj containing the XYZ-SXYZ commanded pos in abs coords, at given index, 0 = X, etc.
Returns double objs containing the XYZ-SXYZ actual pos in abs coords
Returns double obj containing the XYZ-SXYZ commanded pos in rel coords, at given index, 0 = X, etc., including tool length offset
Returns double objs containing the XYZ-SXYZ actual pos in rel coords, including tool length offset
Returns double objs containing the actual pos in absolute coords of individual joint/slider positions, excludes tool length offset
Returns the position offset associated with the world coordinate provided
Returns "ok", "minsoft", "minhard", "maxsoft", "maxhard"
Returns "ok" or "fault"
Returns "homed", "not"
Sends the <string> as an MDI command
Initializes the program interpreter
Opens the named file
Without start line, runs the opened program from the beginning. With start line, runs from that line. A start line of -1 runs in verify mode.
Pause program execution
Resume program execution
Abort program or MDI execution
Step the program one line
Returns the name of the currently opened program, or "none"
Returns the currently executing line of the program
Returns "idle", "running", or "paused"
Returns the string for the currently active program codes
Returns "linear", "angular", or "custom" for the type of the specified joint
Returns "inch", "mm", "cm", or "deg", "rad", "grad", or "custom", for the corresponding native units of the specified axis. The type of the axis (linear or angular) is used to resolve which type of units are returned. The units are obtained heuristically, based on the EMC_AXIS_STAT::units numerical value of user units per mm or deg. For linear joints, something close to 0.03937 is deemed "inch", 1.000 is "mm", 0.1 is "cm", otherwise it's "custom". For angular joints, something close to 1.000 is deemed "deg", PI/180 is "rad", 100/90 is "grad", otherwise it's "custom".
program_linear_units Returns "inch", "mm", "cm", or "none", for the corresponding linear units that are active in the program interpreter.
Returns "deg", "rad", "grad", or "none" for the corresponding angular units that are active in the program interpreter.
Returns "inch", "mm", "cm", or "custom", for the corresponding native user linear units of the EMC trajectory level. This is obtained heuristically, based on the EMC_TRAJ_STAT::linearUnits numerical value of user units per mm. Something close to 0.03937 is deemed "inch", 1.000 is "mm", 0.1 is "cm", otherwise it's "custom".
Returns "deg", "rad", "grad", or "custom" for the corresponding native user angular units of the EMC trajectory level. Like with linear units, this is obtained heuristically.
display_angular_units Returns "inch", "mm", "cm", or "deg", "rad", "grad", or "custom", for the linear or angular units that are active in the display. This is effectively the value of linearUnitConversion? or angularUnitConversion?, resp.
With no args, returns the unit conversion active. With arg, sets the units to be displayed. If it's "auto", the units to be displayed match the program units.
With no args, returns the unit conversion active. With arg, sets the units to be displayed. If it's "auto", the units to be displayed match the program units.
Clear the probe tripped flag.
Has the probe been tripped since the last clear.
Value of current probe signal. (read-only)
Move toward a certain location. If the probe is tripped on the way stop motion, record the position and raise the probe tripped flag.
Should motion run in teleop mode? (No args gets it, one arg sets it.)
returns the type of kinematics functions used identity=1, serial=2, parallel=3, custom=4
If parameter is on, disables end of travel hardware limits to allow jogging off of a limit. If parameters is off, then hardware limits are enabled.
returns state of optional setop, sets it or deactivates it (used to stop/continue on M1)