I would like to attempt to get my machine with stepper motors running in 
velocity mode with feedback from the encoders.  Below are the relevant parts of 
my Hal and Ini files for just the X-Axis.  I figured I would do one axis at a 
time.  Currently nothing happens when I try to jog the X axis except if I hold 
it long enough it gives a following error.  If I try to home it, it faults with 
a following error.  I was trying to look various parameters on Halscope, 
triggering off of axis.0.f-error but nothing appears for any of the pins I was 
monitoring.   Are there any obvious errors in the config below to start with?

-Tom

======================== HAL ========================
loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD 
num_joints=[TRAJ]AXES
loadrt hostmot2
loadrt hm2_7i43  config="firmware=hm2/7i43/SVST2_4_7I47B.BIT num_encoders=3 
num_pwmgens=0 num_stepgens=4"
loadrt pid names=pid.x,pid.y,pid.z

addf hm2_7i43.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.x.do-pid-calcs servo-thread
addf pid.y.do-pid-calcs servo-thread
addf pid.z.do-pid-calcs servo-thread
addf hm2_7i43.0.write         servo-thread


#*******************
#  AXIS X
#*******************
# axis enable chain

setp    pid.x.Pgain     [AXIS_0]P
setp    pid.x.Igain     [AXIS_0]I
setp    pid.x.Dgain     [AXIS_0]D
setp    pid.x.bias      [AXIS_0]BIAS
setp    pid.x.FF0       [AXIS_0]FF0
setp    pid.x.FF1       [AXIS_0]FF1
setp    pid.x.FF2       [AXIS_0]FF2
setp    pid.x.deadband  [AXIS_0]DEADBAND
setp    pid.x.maxoutput [AXIS_0]MAX_OUTPUT

net x-index-enable <=> pid.x.index-enable
net x-enable => pid.x.enable
net x-ouput => pid.x.output
net x-pos-cmd => pid.x.command
net x-vel-fb => pid.x.feedback-deriv
net x-pos-fb => pid.x.feedback

# Step Gen signals/setup
setp hm2_7i43.0.stepgen.00.dirsetup        [AXIS_0]DIRSETUP
setp hm2_7i43.0.stepgen.00.dirhold         [AXIS_0]DIRHOLD
setp hm2_7i43.0.stepgen.00.steplen         [AXIS_0]STEPLEN
setp hm2_7i43.0.stepgen.00.stepspace       [AXIS_0]STEPSPACE
setp hm2_7i43.0.stepgen.00.position-scale  [AXIS_0]SCALE
setp hm2_7i43.0.stepgen.00.maxaccel        [AXIS_0]STEPGEN_MAXACCEL
setp hm2_7i43.0.stepgen.00.maxvel          [AXIS_0]STEPGEN_MAXVEL
setp hm2_7i43.0.stepgen.00.step_type    0
setp hm2_7i43.0.stepgen.00.control-type 1

# --closed loop stepper signals--
net x-pos-cmd axis.0.motor-pos-cmd
net x-output => hm2_7i43.0.stepgen.00.velocity-cmd
net x-enable axis.0.amp-enable-out => hm2_7i43.0.stepgen.00.enable

# ---Encoder feedback signals/setup---
setp hm2_7i43.0.encoder.00.counter-mode 0
setp hm2_7i43.0.encoder.00.filter 1
setp hm2_7i43.0.encoder.00.index-invert 0
setp hm2_7i43.0.encoder.00.index-mask 0
setp hm2_7i43.0.encoder.00.index-mask-invert 0
setp hm2_7i43.0.encoder.00.scale  [AXIS_0]INPUT_SCALE

net x-pos-fb <= hm2_7i43.0.encoder.00.position
net x-vel-fb <= hm2_7i43.0.encoder.00.velocity
net x-pos-fb => axis.0.motor-pos-fb
net x-index-enable axis.0.index-enable <=> hm2_7i43.0.encoder.00.index-enable
net x-pos-rawcounts <= hm2_7i43.0.encoder.00.rawcounts

# ---setup home / limit switch signals---
net x-home-sw     =>  axis.0.home-sw-in
net x-neg-limit     =>  axis.0.neg-lim-sw-in
net x-pos-limit     =>  axis.0.pos-lim-sw-in

======================== end HAL ========================

======================== INI ========================
[EMC]
MACHINE = EMCO
DEBUG = 0

[DISPLAY]
DISPLAY = axis
EDITOR = gedit
PYVCP = custom_pyvcp.xml
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.0
MAX_SPINDLE_OVERRIDE = 1.5
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 2
PROGRAM_PREFIX = /home/tom/linuxcnc/nc_files
INCREMENTS = .1in .05in .01in .005in .001in .0005in .0001in
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 0.250000
MAX_LINEAR_VELOCITY = 1.000000
MIN_LINEAR_VELOCITY = 0.010000
DEFAULT_ANGULAR_VELOCITY = 0.250000
MAX_ANGULAR_VELOCITY = 1.000000
MIN_ANGULAR_VELOCITY = 0.010000
GEOMETRY = xyz

[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python

[TASK]
TASK = milltask
CYCLE_TIME = 0.010

[RS274NGC]
PARAMETER_FILE = emc.var

[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
#BASE_PERIOD = 50000
SERVO_PERIOD = 1000000

# [HOSTMOT2]
# This is for info only - config line is in the .hal file
# DRIVER0=hm2_7i43 
# BOARD0=7i43
# CONFIG0="firmware=hm2/7i43/SVST2_4_7I47B.BIT num_encoders=3 num_pwmgens=0 
num_stepgens=4" 

[HAL]
HALUI = halui
HALFILE = EMCO-CL.hal
HALFILE = custom.hal
POSTGUI_HALFILE = custom_postgui.hal

[HALUI]
MDI_COMMAND = G53 G0 X0 Y0 Z0
MDI_COMMAND = o<probev2> call

[TRAJ]
AXES = 3
COORDINATES = X Y Z
LINEAR_UNITS = inch
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_VELOCITY = 0.5
MAX_LINEAR_VELOCITY = 2
DEFAULT_ANGULAR_VELOCITY = 0.25
MAX_ANGULAR_VELOCITY = 1.0

[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl

#********************
# Axis X
#********************
[AXIS_0]
TYPE = LINEAR
FERROR = 1
MIN_FERROR = 1
MAX_VELOCITY = 2.2
MAX_ACCELERATION = 20
# these are in nanoseconds
DIRSETUP   = 200
DIRHOLD    = 200
STEPLEN    = 2000
STEPSPACE  = 1200
STEPGEN_MAXACCEL = 40
STEPGEN_MAXVEL = 2.75
#
P = 1
I = 0
D = 0
FF0 = 0
FF1 = 1.0
FF2 = 0
BIAS = 0
DEADBAND = 0.001
MAX_OUTPUT = 8
#
INPUT_SCALE = -208076.8
SCALE = -50800
MIN_LIMIT = -0.001
MAX_LIMIT = 7.8
# homing
# move here after home switch found:
HOME = 4.0
# home switch is located here:
HOME_OFFSET = 7.8
# initial search velocity in/sec
HOME_SEARCH_VEL = 0.75
# 2nd pass search velocity
HOME_LATCH_VEL = 0.1
# speed to HOME
HOME_FINAL_VEL = 0.5
# yes use index
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = NO
HOME_IS_SHARED = NO
# do this after Z is homed
HOME_SEQUENCE = 2
# should unhome if estop or power off? no
VOLATILE_HOME = 0
======================== end INIL ========================



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to