Example #1
0
# initialize the RTAPI command client
rt.init_RTAPI()
# loads the ini file passed by linuxcnc
c.load_ini(os.environ['INI_FILE_NAME'])

motion.setup_motion()
hardware.init_hardware()
storage.init_storage('storage.ini')

# Gantry components for Y and Z Axis
base.init_gantry(axisIndex=1)
base.init_gantry4(axisIndex=2, joints=4)

# reading functions
hardware.hardware_read()
base.gantry_read(gantryAxis=1, thread='servo-thread')
base.gantry_read(gantryAxis=2, thread='servo-thread')
hal.addf('motion-command-handler', 'servo-thread')

numFans = c.find('FDM', 'NUM_FANS')
numExtruders = c.find('FDM', 'NUM_EXTRUDERS')
#numLights = c.find('FDM', 'NUM_LIGHTS')

# Axis-of-motion Specific Configs (not the GUI)
ve.velocity_extrusion(extruders=numExtruders, thread='servo-thread')
# X [0] Axis
base.setup_stepper(section='AXIS_0', axisIndex=0, stepgenIndex=6)
# Y [1] Axis
base.setup_stepper(section='AXIS_1',
                   axisIndex=1,
                   stepgenIndex=4,
Example #2
0
import hardware
from fdm.config import base
from fdm.config import storage
from fdm.config import motion


rt.init_RTAPI()
c.load_ini(os.environ['INI_FILE_NAME'])

motion.setup_motion()
storage.init_storage('storage.ini')

# Gantry component for Z Axis
base.init_gantry(axisIndex=2)

base.gantry_read(gantryAxis=2, thread='servo-thread')
hal.addf('motion-command-handler', 'servo-thread')

# setup axis feedback
limits = [
    [c.find('AXIS_0', 'MAX_LIMIT') - 0.2, c.find('AXIS_0', 'MAX_LIMIT')],
    [c.find('AXIS_1', 'MAX_LIMIT') - 0.2, c.find('AXIS_1', 'MAX_LIMIT')],
    [c.find('AXIS_2', 'MIN_LIMIT'), 0.0]
]

for n in range(c.find('TRAJ', 'AXES')):
    axisPos = hal.newsig('axis-%i-pos' % n, hal.HAL_FLOAT)
    hal.Pin('axis.%i.motor-pos-cmd' % n).link(axisPos)
    hal.Pin('axis.%i.motor-pos-fb' % n).link(axisPos)

    # fake limits