Import LinuxCNC source tree
This commit is contained in:
1676
configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/python/remap.py
Executable file
1676
configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/python/remap.py
Executable file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
# This is a component of LinuxCNC
|
||||
# Copyright 2011, 2012, 2013 Dewey Garrett <dgarrett@panix.com>,
|
||||
# Michael Haberler <git@mah.priv.at>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
import remap
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import hal
|
||||
import linuxcnc
|
||||
|
||||
h = hal.component("twp-helper-comp")
|
||||
|
||||
# this pin reflects the machine.analog pin used for the
|
||||
# twp-status
|
||||
h.newpin("twp-status", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
# these pins are created here from 'twp-status''
|
||||
h.newpin("twp-is-redefined", hal.HAL_BIT, hal.HAL_OUT)
|
||||
h.newpin("twp-is-defined", hal.HAL_BIT, hal.HAL_OUT)
|
||||
h.newpin("twp-is-active", hal.HAL_BIT, hal.HAL_OUT)
|
||||
|
||||
# twp origin vector
|
||||
h.newpin("twp-ox-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-oy-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-oz-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-ox", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
h.newpin("twp-oy", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
h.newpin("twp-oz", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
# twp x-orientation vector
|
||||
h.newpin("twp-xx-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-xy-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-xz-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-xx", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
h.newpin("twp-xy", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
h.newpin("twp-xz", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
# twp z-orientation vector
|
||||
h.newpin("twp-zx-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-zy-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-zz-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-zx", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
h.newpin("twp-zy", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
h.newpin("twp-zz", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
# twp origin vector in machine coordinate system
|
||||
h.newpin("twp-ox-world-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-oy-world-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-oz-world-in", hal.HAL_FLOAT, hal.HAL_IN)
|
||||
h.newpin("twp-ox-world", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
h.newpin("twp-oy-world", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
h.newpin("twp-oz-world", hal.HAL_FLOAT, hal.HAL_OUT)
|
||||
|
||||
h.ready()
|
||||
|
||||
# create a connection to the status channel
|
||||
s = linuxcnc.stat()
|
||||
|
||||
try:
|
||||
while 1:
|
||||
# publish twp-status
|
||||
if h['twp-status'] == 1:
|
||||
h['twp-is-defined'] = 1
|
||||
h['twp-is-active'] = 0
|
||||
elif h['twp-status'] == 2:
|
||||
h['twp-is-defined'] = 1
|
||||
h['twp-is-active'] = 1
|
||||
else:
|
||||
h['twp-is-defined'] = 0
|
||||
h['twp-is-active'] = 0
|
||||
|
||||
# passthrough the twp arguments
|
||||
h['twp-ox'] = h['twp-ox-in']
|
||||
h['twp-oy'] = h['twp-oy-in']
|
||||
h['twp-oz'] = h['twp-oz-in']
|
||||
h['twp-xx'] = h['twp-xx-in']
|
||||
h['twp-xy'] = h['twp-xy-in']
|
||||
h['twp-xz'] = h['twp-xz-in']
|
||||
h['twp-zx'] = h['twp-zx-in']
|
||||
h['twp-zy'] = h['twp-zy-in']
|
||||
h['twp-zz'] = h['twp-zz-in']
|
||||
|
||||
# we only want to expose offsets when twp is not defined
|
||||
if not h['twp-is-defined']:
|
||||
s.poll() # get current values
|
||||
g5x_offset = s.g5x_offset
|
||||
h['twp-ox-world'] = g5x_offset[0]
|
||||
h['twp-oy-world'] = g5x_offset[1]
|
||||
h['twp-oz-world'] = g5x_offset[2]
|
||||
else : # use the values from the remap
|
||||
h['twp-ox-world'] = h['twp-ox-world-in']
|
||||
h['twp-oy-world'] = h['twp-oy-world-in']
|
||||
h['twp-oz-world'] = h['twp-oz-world-in']
|
||||
|
||||
except KeyboardInterrupt:
|
||||
raise SystemExit
|
||||
@@ -0,0 +1,67 @@
|
||||
# This is a component of LinuxCNC
|
||||
# Copyright 2011, 2013 Dewey Garrett <dgarrett@panix.com>, Michael
|
||||
# Haberler <git@mah.priv.at>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
import inspect
|
||||
import emccanon
|
||||
|
||||
# O-word procedure to trap into the Pydevd debugger
|
||||
# start debug server in Eclipse, then
|
||||
# call as 'O<pydevd> call' from MDI
|
||||
|
||||
# example setup for debugging embedded Python code
|
||||
# see http://pydev.org/manual_adv_remote_debugger.html
|
||||
# if this points to a valid directory,
|
||||
|
||||
def call_pydevd():
|
||||
""" trap into the pydevd debugger"""
|
||||
|
||||
import os,sys
|
||||
|
||||
pydevdir= '/home/mah/.eclipse/org.eclipse.platform_3.5.0_155965261/plugins/org.python.pydev.debug_2.0.0.2011040403/pysrc/'
|
||||
|
||||
# the 'emctask' module is present only in the milltask instance, otherwise both the UI and
|
||||
# milltask would try to connect to the debug server.
|
||||
|
||||
if os.path.isdir(pydevdir) and 'emctask' in sys.builtin_module_names:
|
||||
sys.path.append(pydevdir)
|
||||
sys.path.insert(0,pydevdir)
|
||||
try:
|
||||
import pydevd
|
||||
emccanon.MESSAGE("pydevd imported, connecting to Eclipse debug server...")
|
||||
pydevd.settrace()
|
||||
except:
|
||||
emccanon.MESSAGE("no pydevd module found")
|
||||
pass
|
||||
|
||||
|
||||
|
||||
def lineno():
|
||||
""" return line number in the current Python script """
|
||||
return inspect.currentframe().f_back.f_lineno
|
||||
|
||||
def error_stack(self):
|
||||
""" print the Interpreters error stack (function names) """
|
||||
print("error stack level=%d" % (self.stack_index))
|
||||
for s in self.stack():
|
||||
print("--'%s'" % (s))
|
||||
|
||||
def callstack(self):
|
||||
""" print the O-Word call stack """
|
||||
for i in range(self.call_level):
|
||||
c = self.sub_context[i]
|
||||
print("%d: pos=%d seq=%d filename=%s sub=%s" % (i,c.position, c.sequence_number,c.filename,c.subname))
|
||||
Reference in New Issue
Block a user