On Wed, Aug 22, 2007 at 02:35:03AM +0200, Michel Gouget wrote:
> Is it difficult, very difficult or extremely difficult to add an NML+HAL
> library to python?
It's already there -- it's the basis for such neat things as AXIS, the
hal_input userspace driver, and so on.
Help on module hal:
NAME
hal - Interface to emc2's hal
FILE
/usr/lib/python2.4/site-packages/hal.so
DESCRIPTION
This module allows the creation of userspace HAL components in Python.
This includes pins and parameters of the various HAL types.
Typical usage:
import hal, time
h = hal.component("component-name")
# create pins and parameters with calls to h.newpin and h.newparam
h.newpin("in", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("out", hal.HAL_FLOAT, hal.HAL_OUT)
h.ready() # mark the component as 'ready'
try:
while 1:
# act on changed input pins; update values on output pins
time.sleep(1)
h['out'] = h['in']
except KeyboardInterrupt: pass
When the component is requested to exit with 'halcmd unload', a
KeyboardInterrupt exception will be raised.
CLASSES
__builtin__.object
component
exceptions.Exception
error
class component(__builtin__.object)
| HAL Component
|
| Methods defined here:
|
| __delattr__(...)
| x.__delattr__('name') <==> del x.name
|
| __delitem__(...)
| x.__delitem__(y) <==> del x[y]
|
| __getattribute__(...)
| x.__getattribute__('name') <==> x.name
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y]
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| __len__(...)
| x.__len__() <==> len(x)
|
| __repr__(...)
| x.__repr__() <==> repr(x)
|
| __setattr__(...)
| x.__setattr__('name', value) <==> x.name = value
|
| __setitem__(...)
| x.__setitem__(i, y) <==> x[i]=y
|
| exit(...)
| Call hal_exit
|
| newparam(...)
| Create a new parameter
|
| newpin(...)
| Create a new pin
|
| ready(...)
| Call hal_ready
|
| setprefix(...)
| Set the prefix for newly created pins and parameters
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
class error(exceptions.Exception)
| Methods inherited from exceptions.Exception:
|
| __getitem__(...)
|
| __init__(...)
|
| __str__(...)
FUNCTIONS
pin_has_writer(...)
Return a FALSE value if a pin has no writers and TRUE if it does
DATA
HAL_BIT = 1
HAL_FLOAT = 2
HAL_IN = 16
HAL_IO = 48
HAL_OUT = 32
HAL_RO = 16
HAL_RW = 48
HAL_S32 = 3
HAL_U32 = 4
Help on module emc:
NAME
emc - Interface to EMC
FILE
/usr/lib/python2.4/site-packages/emc.so
CLASSES
__builtin__.object
command
error_channel
ini
positionlogger
stat
exceptions.RuntimeError(exceptions.StandardError)
error
class command(__builtin__.object)
| Methods defined here:
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| abort(...)
|
| auto(...)
|
| brake(...)
|
| debug(...)
|
| feedrate(...)
|
| flood(...)
|
| home(...)
|
| jog(...)
|
| load_tool_table(...)
|
| mdi(...)
|
| mist(...)
|
| mode(...)
|
| override_limits(...)
|
| program_open(...)
|
| reset_interpreter(...)
|
| set_block_delete(...)
|
| set_optional_stop(...)
|
| spindle(...)
|
| spindleoverride(...)
|
| state(...)
|
| teleop_enable(...)
|
| teleop_vector(...)
|
| tool_offset(...)
|
| traj_mode(...)
|
| wait_complete(...)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
|
| serial = <member 'serial' of 'emc.command' objects>
class error(exceptions.RuntimeError)
| Method resolution order:
| error
| exceptions.RuntimeError
| exceptions.StandardError
| exceptions.Exception
|
| Methods inherited from exceptions.Exception:
|
| __getitem__(...)
|
| __init__(...)
|
| __str__(...)
class error_channel(__builtin__.object)
| Methods defined here:
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| poll(...)
| Poll for errors
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
class ini(__builtin__.object)
| Methods defined here:
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| find(...)
| Find value in inifile as string. This uses the ConfigParser-style
(section,option) order, not the emc order.
|
| findall(...)
| Find value in inifile as a list. This uses the ConfigParser-style
(section,option) order, not the emc order.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
class positionlogger(__builtin__.object)
| Methods defined here:
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| call(...)
| Plot the backplot now
|
| clear(...)
| Clear the position logger
|
| last(...)
| Return the most recent point on the plot or None
|
| start(...)
| Start the position logger and run every ARG seconds
|
| stop(...)
| Stop the position logger
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
|
| average_speed = <member 'average_speed' of 'emc.positionlogger'
object...
|
|
| npts = <member 'npts' of 'emc.positionlogger' objects>
class stat(__builtin__.object)
| Methods defined here:
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| gettaskfile(...)
| Get current task file
|
| poll(...)
| Update current machine state
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
|
| acceleration = <member 'acceleration' of 'emc.stat' objects>
|
|
| actual_position = <attribute 'actual_position' of 'emc.stat' objects>
|
|
| ain = <attribute 'ain' of 'emc.stat' objects>
|
|
| angular_units = <member 'angular_units' of 'emc.stat' objects>
|
|
| aout = <attribute 'aout' of 'emc.stat' objects>
|
|
| axes = <member 'axes' of 'emc.stat' objects>
|
|
| axis = <attribute 'axis' of 'emc.stat' objects>
|
|
| block_delete = <member 'block_delete' of 'emc.stat' objects>
|
|
| command = <member 'command' of 'emc.stat' objects>
|
|
| current_line = <member 'current_line' of 'emc.stat' objects>
|
|
| cycle_time = <member 'cycle_time' of 'emc.stat' objects>
|
|
| debug = <member 'debug' of 'emc.stat' objects>
|
|
| din = <attribute 'din' of 'emc.stat' objects>
|
|
| distance_to_go = <member 'distance_to_go' of 'emc.stat' objects>
|
|
| dout = <attribute 'dout' of 'emc.stat' objects>
|
|
| echo_serial_number = <member 'echo_serial_number' of 'emc.stat'
object...
|
|
| enabled = <member 'enabled' of 'emc.stat' objects>
|
|
| estop = <member 'estop' of 'emc.stat' objects>
|
|
| exec_state = <member 'exec_state' of 'emc.stat' objects>
|
|
| feedrate = <member 'feedrate' of 'emc.stat' objects>
|
|
| file = <member 'file' of 'emc.stat' objects>
|
|
| flood = <member 'flood' of 'emc.stat' objects>
|
|
| gcodes = <attribute 'gcodes' of 'emc.stat' objects>
|
|
| homed = <attribute 'homed' of 'emc.stat' objects>
|
|
| id = <member 'id' of 'emc.stat' objects>
|
|
| inpos = <member 'inpos' of 'emc.stat' objects>
|
|
| interp_state = <member 'interp_state' of 'emc.stat' objects>
|
|
| interpreter_errcode = <member 'interpreter_errcode' of 'emc.stat'
obje...
|
|
| joint_actual_position = <attribute 'joint_actual_position' of
'emc.sta...
|
|
| joint_position = <attribute 'joint_position' of 'emc.stat' objects>
|
|
| kinematics_type = <member 'kinematics_type' of 'emc.stat' objects>
|
|
| limit = <attribute 'limit' of 'emc.stat' objects>
|
|
| line = <member 'line' of 'emc.stat' objects>
|
|
| linear_units = <member 'linear_units' of 'emc.stat' objects>
|
|
| lube = <member 'lube' of 'emc.stat' objects>
|
|
| lube_level = <member 'lube_level' of 'emc.stat' objects>
|
|
| max_acceleration = <member 'max_acceleration' of 'emc.stat' objects>
|
|
| max_velocity = <member 'max_velocity' of 'emc.stat' objects>
|
|
| mcodes = <attribute 'mcodes' of 'emc.stat' objects>
|
|
| mist = <member 'mist' of 'emc.stat' objects>
|
|
| motion_line = <member 'motion_line' of 'emc.stat' objects>
|
|
| motion_mode = <member 'motion_mode' of 'emc.stat' objects>
|
|
| motion_type = <member 'motion_type' of 'emc.stat' objects>
|
|
| optional_stop = <member 'optional_stop' of 'emc.stat' objects>
|
|
| origin = <attribute 'origin' of 'emc.stat' objects>
|
|
| paused = <member 'paused' of 'emc.stat' objects>
|
|
| position = <attribute 'position' of 'emc.stat' objects>
|
|
| probe_index = <member 'probe_index' of 'emc.stat' objects>
|
|
| probe_polarity = <member 'probe_polarity' of 'emc.stat' objects>
|
|
| probe_tripped = <member 'probe_tripped' of 'emc.stat' objects>
|
|
| probe_val = <member 'probe_val' of 'emc.stat' objects>
|
|
| probed_position = <attribute 'probed_position' of 'emc.stat' objects>
|
|
| probing = <member 'probing' of 'emc.stat' objects>
|
|
| program_units = <member 'program_units' of 'emc.stat' objects>
|
|
| queue = <member 'queue' of 'emc.stat' objects>
|
|
| read_line = <member 'read_line' of 'emc.stat' objects>
|
|
| settings = <attribute 'settings' of 'emc.stat' objects>
|
|
| source_file = <member 'source_file' of 'emc.stat' objects>
|
|
| source_line = <member 'source_line' of 'emc.stat' objects>
|
|
| spindle_brake = <member 'spindle_brake' of 'emc.stat' objects>
|
|
| spindle_direction = <member 'spindle_direction' of 'emc.stat' objects>
|
|
| spindle_enabled = <member 'spindle_enabled' of 'emc.stat' objects>
|
|
| spindle_increasing = <member 'spindle_increasing' of 'emc.stat'
object...
|
|
| spindle_speed = <member 'spindle_speed' of 'emc.stat' objects>
|
|
| spindlerate = <member 'spindlerate' of 'emc.stat' objects>
|
|
| state = <member 'state' of 'emc.stat' objects>
|
|
| task_mode = <member 'task_mode' of 'emc.stat' objects>
|
|
| task_state = <member 'task_state' of 'emc.stat' objects>
|
|
| tool_in_spindle = <member 'tool_in_spindle' of 'emc.stat' objects>
|
|
| tool_offset = <attribute 'tool_offset' of 'emc.stat' objects>
|
|
| tool_prepped = <member 'tool_prepped' of 'emc.stat' objects>
|
|
| tool_table = <attribute 'tool_table' of 'emc.stat' objects>
|
|
| velocity = <member 'velocity' of 'emc.stat' objects>
DATA
AUTO_PAUSE = 1
AUTO_RESUME = 2
AUTO_RUN = 0
AUTO_STEP = 3
AXIS_ANGULAR = 2
AXIS_LINEAR = 1
BRAKE_ENGAGE = 1
BRAKE_RELEASE = 0
DEBUG_CONFIG = 2
DEBUG_DEFAULTS = 4
DEBUG_INTERP = 256
DEBUG_INTERP_LIST = 2048
DEBUG_INVALID = 1
DEBUG_IO_POINTS = 32
DEBUG_MOTION_TIME = 128
DEBUG_NML = 64
DEBUG_RCS = 512
DEBUG_TASK_ISSUE = 16
DEBUG_TRAJ = 1024
DEBUG_VERSIONS = 8
FLOOD_OFF = 0
FLOOD_ON = 1
INTERP_IDLE = 1
INTERP_PAUSED = 3
INTERP_READING = 2
INTERP_WAITING = 4
JOG_CONTINUOUS = 1
JOG_INCREMENT = 2
JOG_STOP = 0
KINEMATICS_BOTH = 4
KINEMATICS_FORWARD_ONLY = 2
KINEMATICS_IDENTITY = 1
KINEMATICS_INVERSE_ONLY = 3
MIST_OFF = 0
MIST_ON = 1
MODE_AUTO = 2
MODE_MANUAL = 1
MODE_MDI = 3
NML_DISPLAY = 3
NML_ERROR = 1
NML_TEXT = 2
OPERATOR_DISPLAY = 13
OPERATOR_ERROR = 11
OPERATOR_TEXT = 12
SPINDLE_CONSTANT = 12
SPINDLE_DECREASE = 11
SPINDLE_FORWARD = 1
SPINDLE_INCREASE = 10
SPINDLE_OFF = 0
SPINDLE_REVERSE = -1
STATE_ESTOP = 1
STATE_ESTOP_RESET = 2
STATE_OFF = 3
STATE_ON = 4
TRAJ_MODE_COORD = 2
TRAJ_MODE_FREE = 1
TRAJ_MODE_TELEOP = 3
nmlfile = '/usr/local/etc/emc2/configs/sim/emc.nml'
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users