[Home]Emcrsh

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

  Using linuxcncrsh:

  Include the following line in a .hal file that is loaded by your LinuxCNC installation at startup.

  loadusr linuxcncrsh {-- --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 linuxcncrsh for the first time, none of the options are essential, so the line
  loadusr linuxcncrsh appended to the end of your .hal file is sufficient to load the linuxcncrsh service when LinuxCNC is started.
  Note you can start the LinuxCNC session interactively, or from a local or remote terminal session using /usr/bin/linuxcnc. 
  You interact with the LinuxCNC session via the linuxcncrsh service from a remote terminal, using Telnet <server> <port>, where server is the 
  name (or IP address) of  the machine running LinuxCNC. The default port is 5007, so a typical usage is telnet mycnc.local 5007.

  There are six optional commands supported by linuxcncrsh, where the commands set and get are followed by LinuxCNC
  specific sub-commands. Commands and most parameters are not case sensitive. The exceptions are 
  passwords, file paths and text strings.


Example Session
This example shows a session from a local or remote computer. Bold items are typed by you. The default password is EMC, unless you changed it when setting up the loadusr command in your .hal file.

  --(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


The supported commands are as follows:
  ==> 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 LinuxCNC sub-commands, described below and
  zero or more additional parameters. 

  ==> Set <==

  The set command inclides one of the LinuxCNC sub-commands, described below and
  one or more additional parameters.

  ==> Quit <==

  The quit command disconnects the associated socket connection.

  ==> Shutdown <==

  The shutdown command tells LinuxCNC 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.


Supported Get and Set sub-commands are:
echo on | off
  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.

verbose on | off
  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.

enable <pwd> | off
  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.

config [TBD]

comm_mode ascii | binary
  With get, will return the current communications mode. With set, will
  set the communications mode to the specified mode. The binary protocol 
  is TBD.

comm_prot <version no>
  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.

INIFILE
  Returns the path and file name of the current configuration inifile.

plat
  Returns the platform for which this was compiled, e.g., linux_2_0_36

ini <var> <section>
  Returns the string value of <var> in section <section>, in EMC_INIFILE

debug {<new value>}
  With get, returns the integer value of EMC_DEBUG, from LinuxCNC. Note that
  it may not be true that the local EMC_DEBUG variable here (in linuxcncrsh and
  the GUIs that use it) is the same as the EMC_DEBUG value in LinuxCNC. This
  can happen if LinuxCNC 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 LinuxCNC 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_wait none | received | done
  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).

wait received | 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_timeout <timeout>
  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.

update (none) | none | auto
  With no arg, forces an update of the LinuxCNC 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.

error
  Returns the current LinuxCNC error string, or "ok" if no error.

operator_display
  Returns the current LinuxCNC operator display string, or "ok" if none.

operator_text
  Returns the current LinuxCNC operator text string, or "ok" if none.

time
  Returns the time, in seconds, from the start of the epoch. This starting
  time depends on the platform.

estop (none) | on | off
  With no arg, returns the estop setting as "on" or "off". Otherwise,
  sends an estop on or off command.

machine (none) | on | off
  With no arg, returns the machine setting as "on" or "off". Otherwise,
  sends a machine on or off command.

mode (none) | manual | auto | mdi
  With no arg, returns the mode setting as "manual", "auto", or "mdi".
  Otherwise, sends a mode manual, auto, or mdi command.

mist (none) | on | off
  With no arg, returns the mist setting as "on" or "off". Otherwise,
  sends a mist on or off command.

flood (none) | on | off
  With no arg, returns the flood setting as "on" or "off". Otherwise,
  sends a flood on or off command.

lube (none) | on | off
  With no arg, returns the lubricant pump setting as "on" or "off".
  Otherwise, sends a lube on or off command.

lube_level
  Returns the lubricant level sensor reading as "ok" or "low".

spindle (none) | forward | reverse | increase | decrease | constant | off
  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.

brake (none) | on | off
  With no arg, returns the brake setting. Otherwise sets the brake.

tool
  Returns the id of the currently loaded tool

tool_offset
  Returns the currently applied tool length offset

load_tool_table <file>
  Loads the tool table specified by <file>

home 0 | 1 | 2 | ...
  Homes the indicated axis.

jog_stop 0 | 1 | 2 | ...
  Stop the axis jog

jog 0 | 1 | 2 | ... <speed>
  Jog the indicated axis at <speed>; sign of speed is direction

jog_incr 0 | 1 | 2 | ... <speed> <incr>
  Jog the indicated axis by increment <incr> at the <speed>; sign of
  speed is direction

feed_override {<percent>}
  With no args, returns the current feed override, as a percent. With
  argument, set the feed override to be the percent value

spindle_override {<percent>}
  With no args, returns the current spindle override, as a percent. With
  argument, set the spindle override to be the percent value

abs_cmd_pos 0 | 1 | ...
  Returns double obj containing the XYZ-SXYZ commanded pos in abs coords,
  at given index, 0 = X, etc.

abs_act_pos
  Returns double objs containing the XYZ-SXYZ actual pos in abs coords

rel_cmd_pos 0 | 1 | ...
  Returns double obj containing the XYZ-SXYZ commanded pos in rel coords,
  at given index, 0 = X, etc., including tool length offset

rel_act_pos
  Returns double objs containing the XYZ-SXYZ actual pos in rel coords,
  including tool length offset

joint_pos
  Returns double objs containing the actual pos in absolute coords of individual
  joint/slider positions, excludes tool length offset

pos_offset X | Y | Z | R | P | W
  Returns the position offset associated with the world coordinate provided

joint_limit 0 | 1 | ...
  Returns "ok", "minsoft", "minhard", "maxsoft", "maxhard"

joint_fault 0 | 1 | ...
  Returns "ok" or "fault"

joint_homed 0 | 1 | ...
  Returns "homed", "not"

mdi <string>
  Sends the <string> as an MDI command

task_plan_init
  Initializes the program interpreter

open <filename>
  Opens the named file

run {<start line>}
  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
  Pause program execution

resume
  Resume program execution

abort
  Abort program or MDI execution

step
  Step the program one line

program
  Returns the name of the currently opened program, or "none"

program_line
  Returns the currently executing line of the program

program_status
  Returns "idle", "running", or "paused"

program_codes
  Returns the string for the currently active program codes

joint_type <joint>
  Returns "linear", "angular", or "custom" for the type of the specified joint

joint_units <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_units
  program_linear_units
  Returns "inch", "mm", "cm", or "none", for the corresponding linear 
  units that are active in the program interpreter.

program_angular_units
  Returns "deg", "rad", "grad", or "none" for the corresponding angular
  units that are active in the program interpreter.

user_linear_units
  Returns "inch", "mm", "cm", or "custom", for the
  corresponding native user linear units of the LinuxCNC 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".

user_angular_units
  Returns "deg", "rad", "grad", or "custom" for the corresponding native
  user angular units of the LinuxCNC trajectory level. Like with linear units,
  this is obtained heuristically.

display_linear_units
  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.

linear_unit_conversion {inch | mm | cm | auto}
  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.

angular_unit_conversion {deg | rad | grad | auto}
  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.

probe_clear
  Clear the probe tripped flag.

probe_tripped
  Has the probe been tripped since the last clear.

probe_value
  Value of current probe signal. (read-only)

probe
  Move toward a certain location. If the probe is tripped on the way stop
  motion, record the position and raise the probe tripped flag.

teleop_enable
  Should motion run in teleop mode? (No args
  gets it, one arg sets it.)

kinematics_type
  returns the type of kinematics functions used identity=1, serial=2,
  parallel=3, custom=4

override_limits on | off
  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.

optional_stop none | 0 | 1
  returns state of optional setop, sets it or deactivates it (used to stop/continue on M1)


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited January 14, 2014 4:15 pm by Galfenol (diff)
Search:
Published under a Creative Commons License