Merge pull request #482 from KurtJacobson/pyinterface-docs

docs: add missing `rapidrate` method to linuxcnc.command docs, and convert tabs to spaces
This commit is contained in:
Sebastian Kuzminsky 2018-08-14 20:10:08 -06:00 committed by GitHub
commit 7aa9e9800d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,14 +61,14 @@ linuxcnc is running for typical values):
import sys import sys
import linuxcnc import linuxcnc
try: try:
s = linuxcnc.stat() # create a connection to the status channel s = linuxcnc.stat() # create a connection to the status channel
s.poll() # get current values s.poll() # get current values
except linuxcnc.error, detail: except linuxcnc.error, detail:
print "error", detail print "error", detail
sys.exit(1) sys.exit(1)
for x in dir(s): for x in dir(s):
if not x.startswith("_"): if not x.startswith("_"):
print x, getattr(s,x) print x, getattr(s,x)
--------------------------------------------------------------------- ---------------------------------------------------------------------
Linuxcnc uses the default compiled-in path to the NML configuration Linuxcnc uses the default compiled-in path to the NML configuration
@ -388,9 +388,9 @@ s = linuxcnc.stat()
s.poll() s.poll()
# to find the loaded tool information it is in tool table index 0 # to find the loaded tool information it is in tool table index 0
if s.tool_table[0].id != 0: # a tool is loaded if s.tool_table[0].id != 0: # a tool is loaded
print s.tool_table[0].zoffset print s.tool_table[0].zoffset
else: else:
print "no tool loaded" print "no tool loaded"
---- ----
*velocity*:: '(returns float)' - *velocity*:: '(returns float)' -
@ -531,13 +531,13 @@ s = linuxcnc.stat()
c = linuxcnc.command() c = linuxcnc.command()
def ok_for_mdi(): def ok_for_mdi():
s.poll() s.poll()
return not s.estop and s.enabled and s.homed and (s.interp_state == linuxcnc.INTERP_IDLE) return not s.estop and s.enabled and s.homed and (s.interp_state == linuxcnc.INTERP_IDLE)
if ok_for_mdi(): if ok_for_mdi():
c.mode(linuxcnc.MODE_MDI) c.mode(linuxcnc.MODE_MDI)
c.wait_complete() # wait until mode switch executed c.wait_complete() # wait until mode switch executed
c.mdi("G0 X10 Y20 Z30") c.mdi("G0 X10 Y20 Z30")
--------------------------------------------------------------------- ---------------------------------------------------------------------
== Sending commands through `linuxcnc.command` == Sending commands through `linuxcnc.command`
@ -594,100 +594,103 @@ c.tool_offset(toolno, z_offset, x_offset, diameter, frontangle, backangle, orie
=== `linuxcnc.command` attributes === `linuxcnc.command` attributes
`serial`:: `serial`::
the current command serial number the current command serial number
=== `linuxcnc.command` methods: === `linuxcnc.command` methods:
`abort()`:: `abort()`::
send EMC_TASK_ABORT message. send EMC_TASK_ABORT message.
`auto(int[, int])`:: `auto(int[, int])`::
run, step, pause or resume a program. run, step, pause or resume a program.
`brake(int)`:: `brake(int)`::
engage or release spindle brake. engage or release spindle brake.
`debug(int)`:: `debug(int)`::
set debug level via EMC_SET_DEBUG message. set debug level via EMC_SET_DEBUG message.
`feedrate(float)`:: `feedrate(float)`::
set the feedrate. set the feedrate.
`flood(int)`:: `flood(int)`::
turn on/off flooding. + turn on/off flooding. +
Syntax: + Syntax: +
flood(command) + flood(command) +
flood(linuxcnc.FLOOD_ON) + flood(linuxcnc.FLOOD_ON) +
flood(linuxcnc.FLOOD_OFF) + flood(linuxcnc.FLOOD_OFF) +
Constants: + Constants: +
FLOOD_ON + FLOOD_ON +
FLOOD_OFF FLOOD_OFF
`home(int)`:: `home(int)`::
home a given joint. home a given joint.
`jog(command-constant, bool, int[, float[, float]])`:: `jog(command-constant, bool, int[, float[, float]])`::
Syntax: + Syntax: +
jog(command, joint-flag, axis-or-joint-number, velocity[, distance]]) + jog(command, joint-flag, axis-or-joint-number, velocity[, distance]]) +
jog(linuxcnc.JOG_STOP, joint-flag, axis-or-joint-number) + jog(linuxcnc.JOG_STOP, joint-flag, axis-or-joint-number) +
jog(linuxcnc.JOG_CONTINUOUS, joint-flag, axis-or-joint-number, velocity) + jog(linuxcnc.JOG_CONTINUOUS, joint-flag, axis-or-joint-number, velocity) +
jog(linuxcnc.JOG_INCREMENT, joint-flag, axis-or-joint-number, velocity, distance) jog(linuxcnc.JOG_INCREMENT, joint-flag, axis-or-joint-number, velocity, distance)
Command Constants;; Command Constants;;
JOG_STOP + JOG_STOP +
JOG_CONTINUOUS + JOG_CONTINUOUS +
JOG_INCREMENT JOG_INCREMENT
Joint flag;; Joint flag;;
True::: joint mode jog True::: joint mode jog
False::: axis (cartesian) mode jog False::: axis (cartesian) mode jog
`load_tool_table()`:: `load_tool_table()`::
reload the tool table. reload the tool table.
`maxvel(float)`:: `maxvel(float)`::
set maximum velocity set maximum velocity
`mdi(string)`:: `mdi(string)`::
send an MDI command. Maximum 255 chars. send an MDI command. Maximum 255 chars.
`mist(int)`:: turn on/off mist. + `mist(int)`:: turn on/off mist. +
Syntax: + Syntax: +
mist(command) + mist(command) +
mist(linuxcnc.MIST_ON) + mist(linuxcnc.MIST_ON) +
mist(linuxcnc.MIST_OFF) + mist(linuxcnc.MIST_OFF) +
Constants: + Constants: +
MIST_ON + MIST_ON +
MIST_OFF MIST_OFF
`mode(int)`:: `mode(int)`::
set mode (MODE_MDI, MODE_MANUAL, MODE_AUTO). set mode (MODE_MDI, MODE_MANUAL, MODE_AUTO).
`override_limits()`:: `override_limits()`::
set the override axis limits flag. set the override axis limits flag.
`program_open(string)`:: `program_open(string)`::
open an NGC file. open an NGC file.
`rapidrate()`::
set rapid override factor
`reset_interpreter()`:: `reset_interpreter()`::
reset the RS274NGC interpreter reset the RS274NGC interpreter
`set_adaptive_feed(int)`:: `set_adaptive_feed(int)`::
set adaptive feed flag set adaptive feed flag
`set_analog_output(int, float)`:: `set_analog_output(int, float)`::
set analog output pin to value set analog output pin to value
`set_block_delete(int)`:: `set_block_delete(int)`::
set block delete flag set block delete flag
`set_digital_output(int, int)`:: `set_digital_output(int, int)`::
set digital output pin to value set digital output pin to value
`set_feed_hold(int)`:: `set_feed_hold(int)`::
set feed hold on/off set feed hold on/off
`set_feed_override(int)`:: `set_feed_override(int)`::
set feed override on/off set feed override on/off
`set_max_limit(int, float)`:: `set_max_limit(int, float)`::
set max position limit for a given axis set max position limit for a given axis
@ -696,44 +699,44 @@ c.tool_offset(toolno, z_offset, x_offset, diameter, frontangle, backangle, orie
set min position limit for a given axis set min position limit for a given axis
`set_optional_stop(int)`:: `set_optional_stop(int)`::
set optional stop on/off set optional stop on/off
`set_spindle_override(int)`:: `set_spindle_override(int)`::
set spindle override flag set spindle override flag
`spindle(int)`:: `spindle(int)`::
set spindle direction. Argument one of SPINDLE_FORWARD, set spindle direction. Argument one of SPINDLE_FORWARD,
SPINDLE_REVERSE, SPINDLE_OFF, SPINDLE_INCREASE, SPINDLE_REVERSE, SPINDLE_OFF, SPINDLE_INCREASE,
SPINDLE_DECREASE, or SPINDLE_CONSTANT. SPINDLE_DECREASE, or SPINDLE_CONSTANT.
`spindleoverride(float)`:: `spindleoverride(float)`::
set spindle override factor set spindle override factor
`state(int)`:: `state(int)`::
set the machine state. Machine state should be STATE_ESTOP, STATE_ESTOP_RESET, STATE_ON, or STATE_OFF set the machine state. Machine state should be STATE_ESTOP, STATE_ESTOP_RESET, STATE_ON, or STATE_OFF
`task_plan_sync()`:: `task_plan_sync()`::
on completion of this call, the var file on disk is updated with on completion of this call, the var file on disk is updated with
live values from the interpreter. live values from the interpreter.
`teleop_enable(int)`:: `teleop_enable(int)`::
enable/disable teleop mode. enable/disable teleop mode.
`tool_offset(int, float, float, float, float, float, int)`:: `tool_offset(int, float, float, float, float, float, int)`::
set the tool offset. See usage example above. set the tool offset. See usage example above.
`traj_mode(int)`:: `traj_mode(int)`::
set trajectory mode. Mode is one of MODE_FREE, MODE_COORD, or set trajectory mode. Mode is one of MODE_FREE, MODE_COORD, or
MODE_TELEOP. MODE_TELEOP.
`unhome(int)`:: `unhome(int)`::
unhome a given joint. unhome a given joint.
`wait_complete([float])`:: `wait_complete([float])`::
wait for completion of the last command sent. If timeout in wait for completion of the last command sent. If timeout in
seconds not specified, default is 5 seconds. Return -1 if seconds not specified, default is 5 seconds. Return -1 if
timed out, return RCS_DONE or RCS_ERROR according to command timed out, return RCS_DONE or RCS_ERROR according to command
execution status. execution status.
== Reading the error channel == Reading the error channel
@ -759,12 +762,12 @@ e = linuxcnc.error_channel()
error = e.poll() error = e.poll()
if error: if error:
kind, text = error kind, text = error
if kind in (linuxcnc.NML_ERROR, linuxcnc.OPERATOR_ERROR): if kind in (linuxcnc.NML_ERROR, linuxcnc.OPERATOR_ERROR):
typus = "error" typus = "error"
else: else:
typus = "info" typus = "info"
print typus, text print typus, text
--------------------------------------------------------------------- ---------------------------------------------------------------------
@ -812,21 +815,21 @@ Some usage hints can be gleaned from
=== members === members
`npts`:: `npts`::
number of points. number of points.
=== methods === methods
`start(float)`:: `start(float)`::
start the position logger and run every ARG seconds start the position logger and run every ARG seconds
`clear()`:: `clear()`::
clear the position logger clear the position logger
`stop()`:: `stop()`::
stop the position logger stop the position logger
`call()`:: `call()`::
Plot the backplot now. Plot the backplot now.
`last([int])`:: `last([int])`::
Return the most recent point on the plot or None Return the most recent point on the plot or None
, ,