- LinuxCNC
- General LinuxCNC Questions
- StepConf StepScale and Encoder Scaling not right, following error
StepConf StepScale and Encoder Scaling not right, following error
- Redneck92
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 7
21 Oct 2021 17:14 #223828
by Redneck92
StepConf StepScale and Encoder Scaling not right, following error was created by Redneck92
Hey guys,
I´m back with just another problem I can´t seem to figure out.
I got my Step_Scale calculated with the tool in the StepConf Wizard.
When I Test the axis in open loop with the wizard, and tell it to move 5mm it only moves about 4,91mm.
So I recon the step scale must be wrong.
The X and Y axis I have 4mm pitch ballscrews.
The Ballscrew has a 34 tooth pulley and
the Nema 34 motor has a 26 tooth pulley
The Z axis has a 5mm pitch ballscrew.
The Ballscrew has a 34 tooth pulley and
the Nema 34 motor has a 26 tooth pulley
Motors have 200 Steps per revolution and run on 2 times step multiplication eg. 400 steps per revolution.
I confirmed with the dial indicator that all the axis don´t have any backlash, they are as tight as can be.
Second problem I got is, when I run my machine in closed loop and jog it, I keep getting following error messages.
I think my encoder scaling is not right or my machine doesnt seem to like it.
Encoder PPM as stated on the box is 1000
I calculated as follows:
5mm pitch * (34/26 tooth) * 4000 counts / 5 = 5230.769 counts per millimeter
4mm pitch * (34/26 tooth) * 4000 counts / 4 = 5239.796 counts per millimeter
I´ll post my INI and my HAL file right below.
Woulkd be awesome if someone could help me with this or lead me on the right way.
Greeetings, Mike
HAL file:
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hostmot2
loadrt hm2_eth board_ip="10.10.10.10" config=" num_encoders=4 num_pwmgens=0 num_stepgens=4 sserial_port_0=0xxxxx"
loadrt pid names=pid.x,pid.y,pid.z,pid.s
setp hm2_7i96.0.watchdog.timeout_ns 5000000
setp hm2_7i96.0.dpll.01.timer-us -100
setp hm2_7i96.0.stepgen.timer-number 1
addf hm2_7i96.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 pid.s.do-pid-calcs servo-thread
addf hm2_7i96.0.write servo-thread
# external output signals
# external input signals
# --- BOTH-HOME-X ---
net both-home-x <= hm2_7i96.0.gpio.001.in
# --- BOTH-HOME-Y ---
net both-home-y <= hm2_7i96.0.gpio.002.in
# --- BOTH-HOME-Z ---
net both-home-z <= hm2_7i96.0.gpio.003.in
#*******************
# AXIS X JOINT 0
#*******************
#//---Positionsrueckmeldung/ Inkrementalgeber---
setp hm2_7i96.0.encoder.00.counter-mode 0
setp hm2_7i96.0.encoder.00.filter 1
setp hm2_7i96.0.encoder.00.index-invert 0
setp hm2_7i96.0.encoder.00.index-mask 0
setp hm2_7i96.0.encoder.00.index-mask-invert 0
setp hm2_7i96.0.encoder.00.scale [JOINT_0]ENCODER_SCALE
setp pid.x.Pgain [JOINT_0]P
setp pid.x.Igain [JOINT_0]I
setp pid.x.Dgain [JOINT_0]D
setp pid.x.bias [JOINT_0]BIAS
setp pid.x.FF0 [JOINT_0]FF0
setp pid.x.FF1 [JOINT_0]FF1
setp pid.x.FF2 [JOINT_0]FF2
setp pid.x.deadband [JOINT_0]DEADBAND
setp pid.x.maxoutput [JOINT_0]MAX_OUTPUT
setp pid.x.error-previous-target true
#setp pid.x.maxerror 0.012700
net x-index-enable <=> pid.x.index-enable
net x-enable => pid.x.enable
net x-pos-cmd => pid.x.command
net x-pos-fb => pid.x.feedback
net x-output <= pid.x.output
# Step Gen signals/setup
setp hm2_7i96.0.stepgen.00.dirsetup [JOINT_0]DIRSETUP
setp hm2_7i96.0.stepgen.00.dirhold [JOINT_0]DIRHOLD
setp hm2_7i96.0.stepgen.00.steplen [JOINT_0]STEPLEN
setp hm2_7i96.0.stepgen.00.stepspace [JOINT_0]STEPSPACE
setp hm2_7i96.0.stepgen.00.position-scale [JOINT_0]STEP_SCALE
setp hm2_7i96.0.stepgen.00.step_type 0
setp hm2_7i96.0.stepgen.00.control-type 1
setp hm2_7i96.0.stepgen.00.maxaccel [JOINT_0]STEPGEN_MAXACCEL
setp hm2_7i96.0.stepgen.00.maxvel [JOINT_0]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net x-pos-cmd <= joint.0.motor-pos-cmd
net x-vel-cmd <= joint.0.vel-cmd
net x-output <= hm2_7i96.0.stepgen.00.velocity-cmd
net x-pos-fb <= hm2_7i96.0.encoder.00.position
net x-pos-fb => joint.0.motor-pos-fb
net x-enable <= joint.0.amp-enable-out
net x-enable => hm2_7i96.0.stepgen.00.enable
# ---setup home / limit switch signals---
net both-home-x => joint.0.home-sw-in
net both-home-x => joint.0.neg-lim-sw-in
net both-home-x => joint.0.pos-lim-sw-in
#*******************
# AXIS Y JOINT 1
#*******************
#//---Positionsrueckmeldung/ Inkrementalgeber---
setp hm2_7i96.0.encoder.01.counter-mode 0
setp hm2_7i96.0.encoder.01.filter 1
setp hm2_7i96.0.encoder.01.index-invert 0
setp hm2_7i96.0.encoder.01.index-mask 0
setp hm2_7i96.0.encoder.01.index-mask-invert 0
setp hm2_7i96.0.encoder.01.scale [JOINT_1]ENCODER_SCALE
setp pid.y.Pgain [JOINT_1]P
setp pid.y.Igain [JOINT_1]I
setp pid.y.Dgain [JOINT_1]D
setp pid.y.bias [JOINT_1]BIAS
setp pid.y.FF0 [JOINT_1]FF0
setp pid.y.FF1 [JOINT_1]FF1
setp pid.y.FF2 [JOINT_1]FF2
setp pid.y.deadband [JOINT_1]DEADBAND
setp pid.y.maxoutput [JOINT_1]MAX_OUTPUT
setp pid.y.error-previous-target true
setp pid.y.maxerror 0.012700
net y-index-enable <=> pid.y.index-enable
net y-enable => pid.y.enable
net y-pos-cmd => pid.y.command
net y-pos-fb => pid.y.feedback
net y-output <= pid.y.output
# Step Gen signals/setup
setp hm2_7i96.0.stepgen.01.dirsetup [JOINT_1]DIRSETUP
setp hm2_7i96.0.stepgen.01.dirhold [JOINT_1]DIRHOLD
setp hm2_7i96.0.stepgen.01.steplen [JOINT_1]STEPLEN
setp hm2_7i96.0.stepgen.01.stepspace [JOINT_1]STEPSPACE
setp hm2_7i96.0.stepgen.01.position-scale [JOINT_1]STEP_SCALE
setp hm2_7i96.0.stepgen.01.step_type 0
setp hm2_7i96.0.stepgen.01.control-type 1
setp hm2_7i96.0.stepgen.01.maxaccel [JOINT_1]STEPGEN_MAXACCEL
setp hm2_7i96.0.stepgen.01.maxvel [JOINT_1]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net y-pos-cmd <= joint.1.motor-pos-cmd
net y-vel-cmd <= joint.1.vel-cmd
net y-output <= hm2_7i96.0.stepgen.01.velocity-cmd
net y-pos-fb <= hm2_7i96.0.encoder.01.position
net y-pos-fb => joint.1.motor-pos-fb
net y-enable <= joint.1.amp-enable-out
net y-enable => hm2_7i96.0.stepgen.01.enable
# ---setup home / limit switch signals---
net both-home-y => joint.1.home-sw-in
net both-home-y => joint.1.neg-lim-sw-in
net both-home-y => joint.1.pos-lim-sw-in
#*******************
# AXIS Z JOINT 2
#*******************
#//---Positionsrueckmeldung/ Inkrementalgeber---
setp hm2_7i96.0.encoder.02.counter-mode 0
setp hm2_7i96.0.encoder.02.filter 1
setp hm2_7i96.0.encoder.02.index-invert 0
setp hm2_7i96.0.encoder.02.index-mask 0
setp hm2_7i96.0.encoder.02.index-mask-invert 0
setp hm2_7i96.0.encoder.02.scale [JOINT_2]ENCODER_SCALE
setp pid.z.Pgain [JOINT_2]P
setp pid.z.Igain [JOINT_2]I
setp pid.z.Dgain [JOINT_2]D
setp pid.z.bias [JOINT_2]BIAS
setp pid.z.FF0 [JOINT_2]FF0
setp pid.z.FF1 [JOINT_2]FF1
setp pid.z.FF2 [JOINT_2]FF2
setp pid.z.deadband [JOINT_2]DEADBAND
setp pid.z.maxoutput [JOINT_2]MAX_OUTPUT
setp pid.z.error-previous-target true
setp pid.z.maxerror 0.012700
net z-index-enable <=> pid.z.index-enable
net z-enable => pid.z.enable
net z-pos-cmd => pid.z.command
net z-pos-fb => pid.z.feedback
net z-output <= pid.z.output
# Step Gen signals/setup
setp hm2_7i96.0.stepgen.02.dirsetup [JOINT_2]DIRSETUP
setp hm2_7i96.0.stepgen.02.dirhold [JOINT_2]DIRHOLD
setp hm2_7i96.0.stepgen.02.steplen [JOINT_2]STEPLEN
setp hm2_7i96.0.stepgen.02.stepspace [JOINT_2]STEPSPACE
setp hm2_7i96.0.stepgen.02.position-scale [JOINT_2]STEP_SCALE
setp hm2_7i96.0.stepgen.02.step_type 0
setp hm2_7i96.0.stepgen.02.control-type 1
setp hm2_7i96.0.stepgen.02.maxaccel [JOINT_2]STEPGEN_MAXACCEL
setp hm2_7i96.0.stepgen.02.maxvel [JOINT_2]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net z-pos-cmd <= joint.2.motor-pos-cmd
net z-vel-cmd <= joint.2.vel-cmd
net z-output <= hm2_7i96.0.stepgen.02.velocity-cmd
net z-pos-fb <= hm2_7i96.0.encoder.02.position
net z-pos-fb => joint.2.motor-pos-fb
net z-enable <= joint.2.amp-enable-out
net z-enable => hm2_7i96.0.stepgen.02.enable
# ---setup home / limit switch signals---
net both-home-z => joint.2.home-sw-in
net both-home-z => joint.2.neg-lim-sw-in
net both-home-z => joint.2.pos-lim-sw-in
#******************************
# connect miscellaneous signals
#******************************
# ---HALUI signals---
net axis-select-x halui.axis.x.select
net jog-x-pos halui.axis.x.plus
net jog-x-neg halui.axis.x.minus
net jog-x-analog halui.axis.x.analog
net x-is-homed halui.joint.0.is-homed
net axis-select-y halui.axis.y.select
net jog-y-pos halui.axis.y.plus
net jog-y-neg halui.axis.y.minus
net jog-y-analog halui.axis.y.analog
net y-is-homed halui.joint.1.is-homed
net axis-select-z halui.axis.z.select
net jog-z-pos halui.axis.z.plus
net jog-z-neg halui.axis.z.minus
net jog-z-analog halui.axis.z.analog
net z-is-homed halui.joint.2.is-homed
net jog-selected-pos halui.axis.selected.plus
net jog-selected-neg halui.axis.selected.minus
net spindle-manual-cw halui.spindle.0.forward
net spindle-manual-ccw halui.spindle.0.reverse
net spindle-manual-stop halui.spindle.0.stop
net machine-is-on halui.machine.is-on
net jog-speed halui.axis.jog-speed
net MDI-mode halui.mode.is-mdi
# ---coolant signals---
net coolant-mist <= iocontrol.0.coolant-mist
net coolant-flood <= iocontrol.0.coolant-flood
# ---probe signal---
net probe-in => motion.probe-input
# ---motion control signals---
net in-position <= motion.in-position
net machine-is-enabled <= motion.motion-enabled
# ---digital in / out signals---
# ---estop signals---
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
# ---manual tool change signals---
loadusr -W hal_manualtoolchange
net tool-change-request iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-change-confirmed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
INI File:
HOSTMOT2]
DRIVER = hm2_eth
BOARD = 7i96
Config = "num_encoders=4 num_pwmgens=0 num_stepgens=4 sserial_port_0=0xxxxx"
[EMC]
MACHINE = RedneckCNC
DEBUG = 0
VERSION = 1.1
[DISPLAY]
DISPLAY = axis
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 2.000000
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/redneck/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 6.000000
MAX_LINEAR_VELOCITY = 83.333333
MIN_LINEAR_VELOCITY = 0.500000
DEFAULT_ANGULAR_VELOCITY = 12.000000
MAX_ANGULAR_VELOCITY = 180.000000
MIN_ANGULAR_VELOCITY = 1.666667
EDITOR = gedit
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 = linuxcnc.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
[HMOT]
# **** This is for info only ****
CARD0=hm2_7i96.0
[HAL]
HALUI = halui
HALFILE = RedneckCNC.hal
HALFILE = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal
SHUTDOWN = shutdown.hal
[HALUI]
[KINS]
JOINTS = 3
KINEMATICS = trivkins coordinates=XYZ
[TRAJ]
COORDINATES = XYZ
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 16.67
MAX_LINEAR_VELOCITY = 166.67
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
#******************************************
[AXIS_X]
MAX_VELOCITY = 83.3333333333
MAX_ACCELERATION = 500.0
MIN_LIMIT = -5.0
MAX_LIMIT = 370.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
ENCODER_SCALE = 5230.769
FERROR = 10.0
MIN_FERROR = 1.0
MAX_VELOCITY = 83.3333333333
MAX_ACCELERATION = 500
STEPGEN_MAXVEL = 130.769
STEPGEN_MAXACCEL = 500
P = 20
I = 0
D = 0
FF0 = 0
FF1 = 1.6
FF2 = 0.01
BIAS = 0
DEADBAND = 0.005
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 10000
DIRHOLD = 10000
STEPLEN = 5000
STEPSPACE = 5000
STEP_SCALE = 130.7692
MIN_LIMIT = -5.0
MAX_LIMIT = 370
HOME_OFFSET = -5.000000
HOME_SEARCH_VEL = -6.500000
HOME_LATCH_VEL = -0.833333
HOME_FINAL_VEL = 8.333333
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1
#******************************************
#******************************************
[AXIS_Y]
MAX_VELOCITY = 83.3333333333
MAX_ACCELERATION = 500
MIN_LIMIT = -5.0
MAX_LIMIT = 250
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
ENCODER_SCALE = 5230.769
FERROR = 10.0
MIN_FERROR = 1.0
MAX_VELOCITY = 83.3333333333
MAX_ACCELERATION = 500
STEPGEN_MAXVEL = 130.769
STEPGEN_MAXACCEL = 500
P = 20
I = 0
D = 0
FF0 = 0
FF1 = 1.6
FF2 = 0.01
BIAS = 0
DEADBAND = 0.005
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 10000
DIRHOLD = 10000
STEPLEN = 5000
STEPSPACE = 5000
STEP_SCALE = 130.7692
MIN_LIMIT = -5.0
MAX_LIMIT = 250
HOME_OFFSET = -5.000000
HOME_SEARCH_VEL = -6.500000
HOME_LATCH_VEL = -0.833333
HOME_FINAL_VEL = 8.333333
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
#*******************
#******************************************
#******************************************
[AXIS_Z]
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 500.0
MIN_LIMIT = -300.0
MAX_LIMIT = 5.00
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
ENCODER_SCALE = 5230.769
FERROR = 10.0
MIN_FERROR = 1.0
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 500.0
STEPGEN_MAXVEL = 104.615
STEPGEN_MAXACCEL = 350
P = 50
I = 0
D = 0
FF0 = 0
FF1 = 1.9
FF2 = 0.001
BIAS = 0
DEADBAND = 0.005
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 10000
DIRHOLD = 10000
STEPLEN = 5000
STEPSPACE = 5000
STEP_SCALE = 104.6154
MIN_LIMIT = -300.0
MAX_LIMIT = 5.00
HOME_OFFSET = 5.0
HOME_SEARCH_VEL = 6.500000
HOME_LATCH_VEL = 0.833333
HOME_FINAL_VEL = 8.333333
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
#******************************************
[SPINDLE_0]
P = 0
I = 0
D = 0
FF0 = 1
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 2000
I´m back with just another problem I can´t seem to figure out.
I got my Step_Scale calculated with the tool in the StepConf Wizard.
When I Test the axis in open loop with the wizard, and tell it to move 5mm it only moves about 4,91mm.
So I recon the step scale must be wrong.
The X and Y axis I have 4mm pitch ballscrews.
The Ballscrew has a 34 tooth pulley and
the Nema 34 motor has a 26 tooth pulley
The Z axis has a 5mm pitch ballscrew.
The Ballscrew has a 34 tooth pulley and
the Nema 34 motor has a 26 tooth pulley
Motors have 200 Steps per revolution and run on 2 times step multiplication eg. 400 steps per revolution.
I confirmed with the dial indicator that all the axis don´t have any backlash, they are as tight as can be.
Second problem I got is, when I run my machine in closed loop and jog it, I keep getting following error messages.
I think my encoder scaling is not right or my machine doesnt seem to like it.
Encoder PPM as stated on the box is 1000
I calculated as follows:
5mm pitch * (34/26 tooth) * 4000 counts / 5 = 5230.769 counts per millimeter
4mm pitch * (34/26 tooth) * 4000 counts / 4 = 5239.796 counts per millimeter
I´ll post my INI and my HAL file right below.
Woulkd be awesome if someone could help me with this or lead me on the right way.
Greeetings, Mike
HAL file:
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt hostmot2
loadrt hm2_eth board_ip="10.10.10.10" config=" num_encoders=4 num_pwmgens=0 num_stepgens=4 sserial_port_0=0xxxxx"
loadrt pid names=pid.x,pid.y,pid.z,pid.s
setp hm2_7i96.0.watchdog.timeout_ns 5000000
setp hm2_7i96.0.dpll.01.timer-us -100
setp hm2_7i96.0.stepgen.timer-number 1
addf hm2_7i96.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 pid.s.do-pid-calcs servo-thread
addf hm2_7i96.0.write servo-thread
# external output signals
# external input signals
# --- BOTH-HOME-X ---
net both-home-x <= hm2_7i96.0.gpio.001.in
# --- BOTH-HOME-Y ---
net both-home-y <= hm2_7i96.0.gpio.002.in
# --- BOTH-HOME-Z ---
net both-home-z <= hm2_7i96.0.gpio.003.in
#*******************
# AXIS X JOINT 0
#*******************
#//---Positionsrueckmeldung/ Inkrementalgeber---
setp hm2_7i96.0.encoder.00.counter-mode 0
setp hm2_7i96.0.encoder.00.filter 1
setp hm2_7i96.0.encoder.00.index-invert 0
setp hm2_7i96.0.encoder.00.index-mask 0
setp hm2_7i96.0.encoder.00.index-mask-invert 0
setp hm2_7i96.0.encoder.00.scale [JOINT_0]ENCODER_SCALE
setp pid.x.Pgain [JOINT_0]P
setp pid.x.Igain [JOINT_0]I
setp pid.x.Dgain [JOINT_0]D
setp pid.x.bias [JOINT_0]BIAS
setp pid.x.FF0 [JOINT_0]FF0
setp pid.x.FF1 [JOINT_0]FF1
setp pid.x.FF2 [JOINT_0]FF2
setp pid.x.deadband [JOINT_0]DEADBAND
setp pid.x.maxoutput [JOINT_0]MAX_OUTPUT
setp pid.x.error-previous-target true
#setp pid.x.maxerror 0.012700
net x-index-enable <=> pid.x.index-enable
net x-enable => pid.x.enable
net x-pos-cmd => pid.x.command
net x-pos-fb => pid.x.feedback
net x-output <= pid.x.output
# Step Gen signals/setup
setp hm2_7i96.0.stepgen.00.dirsetup [JOINT_0]DIRSETUP
setp hm2_7i96.0.stepgen.00.dirhold [JOINT_0]DIRHOLD
setp hm2_7i96.0.stepgen.00.steplen [JOINT_0]STEPLEN
setp hm2_7i96.0.stepgen.00.stepspace [JOINT_0]STEPSPACE
setp hm2_7i96.0.stepgen.00.position-scale [JOINT_0]STEP_SCALE
setp hm2_7i96.0.stepgen.00.step_type 0
setp hm2_7i96.0.stepgen.00.control-type 1
setp hm2_7i96.0.stepgen.00.maxaccel [JOINT_0]STEPGEN_MAXACCEL
setp hm2_7i96.0.stepgen.00.maxvel [JOINT_0]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net x-pos-cmd <= joint.0.motor-pos-cmd
net x-vel-cmd <= joint.0.vel-cmd
net x-output <= hm2_7i96.0.stepgen.00.velocity-cmd
net x-pos-fb <= hm2_7i96.0.encoder.00.position
net x-pos-fb => joint.0.motor-pos-fb
net x-enable <= joint.0.amp-enable-out
net x-enable => hm2_7i96.0.stepgen.00.enable
# ---setup home / limit switch signals---
net both-home-x => joint.0.home-sw-in
net both-home-x => joint.0.neg-lim-sw-in
net both-home-x => joint.0.pos-lim-sw-in
#*******************
# AXIS Y JOINT 1
#*******************
#//---Positionsrueckmeldung/ Inkrementalgeber---
setp hm2_7i96.0.encoder.01.counter-mode 0
setp hm2_7i96.0.encoder.01.filter 1
setp hm2_7i96.0.encoder.01.index-invert 0
setp hm2_7i96.0.encoder.01.index-mask 0
setp hm2_7i96.0.encoder.01.index-mask-invert 0
setp hm2_7i96.0.encoder.01.scale [JOINT_1]ENCODER_SCALE
setp pid.y.Pgain [JOINT_1]P
setp pid.y.Igain [JOINT_1]I
setp pid.y.Dgain [JOINT_1]D
setp pid.y.bias [JOINT_1]BIAS
setp pid.y.FF0 [JOINT_1]FF0
setp pid.y.FF1 [JOINT_1]FF1
setp pid.y.FF2 [JOINT_1]FF2
setp pid.y.deadband [JOINT_1]DEADBAND
setp pid.y.maxoutput [JOINT_1]MAX_OUTPUT
setp pid.y.error-previous-target true
setp pid.y.maxerror 0.012700
net y-index-enable <=> pid.y.index-enable
net y-enable => pid.y.enable
net y-pos-cmd => pid.y.command
net y-pos-fb => pid.y.feedback
net y-output <= pid.y.output
# Step Gen signals/setup
setp hm2_7i96.0.stepgen.01.dirsetup [JOINT_1]DIRSETUP
setp hm2_7i96.0.stepgen.01.dirhold [JOINT_1]DIRHOLD
setp hm2_7i96.0.stepgen.01.steplen [JOINT_1]STEPLEN
setp hm2_7i96.0.stepgen.01.stepspace [JOINT_1]STEPSPACE
setp hm2_7i96.0.stepgen.01.position-scale [JOINT_1]STEP_SCALE
setp hm2_7i96.0.stepgen.01.step_type 0
setp hm2_7i96.0.stepgen.01.control-type 1
setp hm2_7i96.0.stepgen.01.maxaccel [JOINT_1]STEPGEN_MAXACCEL
setp hm2_7i96.0.stepgen.01.maxvel [JOINT_1]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net y-pos-cmd <= joint.1.motor-pos-cmd
net y-vel-cmd <= joint.1.vel-cmd
net y-output <= hm2_7i96.0.stepgen.01.velocity-cmd
net y-pos-fb <= hm2_7i96.0.encoder.01.position
net y-pos-fb => joint.1.motor-pos-fb
net y-enable <= joint.1.amp-enable-out
net y-enable => hm2_7i96.0.stepgen.01.enable
# ---setup home / limit switch signals---
net both-home-y => joint.1.home-sw-in
net both-home-y => joint.1.neg-lim-sw-in
net both-home-y => joint.1.pos-lim-sw-in
#*******************
# AXIS Z JOINT 2
#*******************
#//---Positionsrueckmeldung/ Inkrementalgeber---
setp hm2_7i96.0.encoder.02.counter-mode 0
setp hm2_7i96.0.encoder.02.filter 1
setp hm2_7i96.0.encoder.02.index-invert 0
setp hm2_7i96.0.encoder.02.index-mask 0
setp hm2_7i96.0.encoder.02.index-mask-invert 0
setp hm2_7i96.0.encoder.02.scale [JOINT_2]ENCODER_SCALE
setp pid.z.Pgain [JOINT_2]P
setp pid.z.Igain [JOINT_2]I
setp pid.z.Dgain [JOINT_2]D
setp pid.z.bias [JOINT_2]BIAS
setp pid.z.FF0 [JOINT_2]FF0
setp pid.z.FF1 [JOINT_2]FF1
setp pid.z.FF2 [JOINT_2]FF2
setp pid.z.deadband [JOINT_2]DEADBAND
setp pid.z.maxoutput [JOINT_2]MAX_OUTPUT
setp pid.z.error-previous-target true
setp pid.z.maxerror 0.012700
net z-index-enable <=> pid.z.index-enable
net z-enable => pid.z.enable
net z-pos-cmd => pid.z.command
net z-pos-fb => pid.z.feedback
net z-output <= pid.z.output
# Step Gen signals/setup
setp hm2_7i96.0.stepgen.02.dirsetup [JOINT_2]DIRSETUP
setp hm2_7i96.0.stepgen.02.dirhold [JOINT_2]DIRHOLD
setp hm2_7i96.0.stepgen.02.steplen [JOINT_2]STEPLEN
setp hm2_7i96.0.stepgen.02.stepspace [JOINT_2]STEPSPACE
setp hm2_7i96.0.stepgen.02.position-scale [JOINT_2]STEP_SCALE
setp hm2_7i96.0.stepgen.02.step_type 0
setp hm2_7i96.0.stepgen.02.control-type 1
setp hm2_7i96.0.stepgen.02.maxaccel [JOINT_2]STEPGEN_MAXACCEL
setp hm2_7i96.0.stepgen.02.maxvel [JOINT_2]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net z-pos-cmd <= joint.2.motor-pos-cmd
net z-vel-cmd <= joint.2.vel-cmd
net z-output <= hm2_7i96.0.stepgen.02.velocity-cmd
net z-pos-fb <= hm2_7i96.0.encoder.02.position
net z-pos-fb => joint.2.motor-pos-fb
net z-enable <= joint.2.amp-enable-out
net z-enable => hm2_7i96.0.stepgen.02.enable
# ---setup home / limit switch signals---
net both-home-z => joint.2.home-sw-in
net both-home-z => joint.2.neg-lim-sw-in
net both-home-z => joint.2.pos-lim-sw-in
#******************************
# connect miscellaneous signals
#******************************
# ---HALUI signals---
net axis-select-x halui.axis.x.select
net jog-x-pos halui.axis.x.plus
net jog-x-neg halui.axis.x.minus
net jog-x-analog halui.axis.x.analog
net x-is-homed halui.joint.0.is-homed
net axis-select-y halui.axis.y.select
net jog-y-pos halui.axis.y.plus
net jog-y-neg halui.axis.y.minus
net jog-y-analog halui.axis.y.analog
net y-is-homed halui.joint.1.is-homed
net axis-select-z halui.axis.z.select
net jog-z-pos halui.axis.z.plus
net jog-z-neg halui.axis.z.minus
net jog-z-analog halui.axis.z.analog
net z-is-homed halui.joint.2.is-homed
net jog-selected-pos halui.axis.selected.plus
net jog-selected-neg halui.axis.selected.minus
net spindle-manual-cw halui.spindle.0.forward
net spindle-manual-ccw halui.spindle.0.reverse
net spindle-manual-stop halui.spindle.0.stop
net machine-is-on halui.machine.is-on
net jog-speed halui.axis.jog-speed
net MDI-mode halui.mode.is-mdi
# ---coolant signals---
net coolant-mist <= iocontrol.0.coolant-mist
net coolant-flood <= iocontrol.0.coolant-flood
# ---probe signal---
net probe-in => motion.probe-input
# ---motion control signals---
net in-position <= motion.in-position
net machine-is-enabled <= motion.motion-enabled
# ---digital in / out signals---
# ---estop signals---
net estop-out <= iocontrol.0.user-enable-out
net estop-out => iocontrol.0.emc-enable-in
# ---manual tool change signals---
loadusr -W hal_manualtoolchange
net tool-change-request iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-change-confirmed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
INI File:
HOSTMOT2]
DRIVER = hm2_eth
BOARD = 7i96
Config = "num_encoders=4 num_pwmgens=0 num_stepgens=4 sserial_port_0=0xxxxx"
[EMC]
MACHINE = RedneckCNC
DEBUG = 0
VERSION = 1.1
[DISPLAY]
DISPLAY = axis
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 2.000000
MIN_SPINDLE_OVERRIDE = 0.500000
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/redneck/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 6.000000
MAX_LINEAR_VELOCITY = 83.333333
MIN_LINEAR_VELOCITY = 0.500000
DEFAULT_ANGULAR_VELOCITY = 12.000000
MAX_ANGULAR_VELOCITY = 180.000000
MIN_ANGULAR_VELOCITY = 1.666667
EDITOR = gedit
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 = linuxcnc.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
SERVO_PERIOD = 1000000
[HMOT]
# **** This is for info only ****
CARD0=hm2_7i96.0
[HAL]
HALUI = halui
HALFILE = RedneckCNC.hal
HALFILE = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal
SHUTDOWN = shutdown.hal
[HALUI]
[KINS]
JOINTS = 3
KINEMATICS = trivkins coordinates=XYZ
[TRAJ]
COORDINATES = XYZ
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 16.67
MAX_LINEAR_VELOCITY = 166.67
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
#******************************************
[AXIS_X]
MAX_VELOCITY = 83.3333333333
MAX_ACCELERATION = 500.0
MIN_LIMIT = -5.0
MAX_LIMIT = 370.0
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
ENCODER_SCALE = 5230.769
FERROR = 10.0
MIN_FERROR = 1.0
MAX_VELOCITY = 83.3333333333
MAX_ACCELERATION = 500
STEPGEN_MAXVEL = 130.769
STEPGEN_MAXACCEL = 500
P = 20
I = 0
D = 0
FF0 = 0
FF1 = 1.6
FF2 = 0.01
BIAS = 0
DEADBAND = 0.005
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 10000
DIRHOLD = 10000
STEPLEN = 5000
STEPSPACE = 5000
STEP_SCALE = 130.7692
MIN_LIMIT = -5.0
MAX_LIMIT = 370
HOME_OFFSET = -5.000000
HOME_SEARCH_VEL = -6.500000
HOME_LATCH_VEL = -0.833333
HOME_FINAL_VEL = 8.333333
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 1
#******************************************
#******************************************
[AXIS_Y]
MAX_VELOCITY = 83.3333333333
MAX_ACCELERATION = 500
MIN_LIMIT = -5.0
MAX_LIMIT = 250
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
ENCODER_SCALE = 5230.769
FERROR = 10.0
MIN_FERROR = 1.0
MAX_VELOCITY = 83.3333333333
MAX_ACCELERATION = 500
STEPGEN_MAXVEL = 130.769
STEPGEN_MAXACCEL = 500
P = 20
I = 0
D = 0
FF0 = 0
FF1 = 1.6
FF2 = 0.01
BIAS = 0
DEADBAND = 0.005
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 10000
DIRHOLD = 10000
STEPLEN = 5000
STEPSPACE = 5000
STEP_SCALE = 130.7692
MIN_LIMIT = -5.0
MAX_LIMIT = 250
HOME_OFFSET = -5.000000
HOME_SEARCH_VEL = -6.500000
HOME_LATCH_VEL = -0.833333
HOME_FINAL_VEL = 8.333333
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
#*******************
#******************************************
#******************************************
[AXIS_Z]
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 500.0
MIN_LIMIT = -300.0
MAX_LIMIT = 5.00
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
ENCODER_SCALE = 5230.769
FERROR = 10.0
MIN_FERROR = 1.0
MAX_VELOCITY = 50.0
MAX_ACCELERATION = 500.0
STEPGEN_MAXVEL = 104.615
STEPGEN_MAXACCEL = 350
P = 50
I = 0
D = 0
FF0 = 0
FF1 = 1.9
FF2 = 0.001
BIAS = 0
DEADBAND = 0.005
MAX_OUTPUT = 0
# these are in nanoseconds
DIRSETUP = 10000
DIRHOLD = 10000
STEPLEN = 5000
STEPSPACE = 5000
STEP_SCALE = 104.6154
MIN_LIMIT = -300.0
MAX_LIMIT = 5.00
HOME_OFFSET = 5.0
HOME_SEARCH_VEL = 6.500000
HOME_LATCH_VEL = 0.833333
HOME_FINAL_VEL = 8.333333
HOME_USE_INDEX = NO
HOME_IGNORE_LIMITS = YES
HOME_SEQUENCE = 0
#******************************************
[SPINDLE_0]
P = 0
I = 0
D = 0
FF0 = 1
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 2000
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17973
- Thank you received: 4830
22 Oct 2021 00:23 #223858
by PCW
Replied by PCW on topic StepConf StepScale and Encoder Scaling not right, following error
To get a step.dir system working with encoder feedback you need to
first get the scaling of the step/dir and encoders identical.
Also FF1 should always be 1.000. For tuning, the following error limits
need to be widened to allow for large errors with initial tuning
first get the scaling of the step/dir and encoders identical.
Also FF1 should always be 1.000. For tuning, the following error limits
need to be widened to allow for large errors with initial tuning
Please Log in or Create an account to join the conversation.
- Redneck92
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 7
22 Oct 2021 06:18 #223882
by Redneck92
Replied by Redneck92 on topic StepConf StepScale and Encoder Scaling not right, following error
Thank you on the tip with the ff1 and the following error.
Do you have any tips how I can accurately figure out the stepscale and encoder scale counts?
Do you have any tips how I can accurately figure out the stepscale and encoder scale counts?
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17973
- Thank you received: 4830
22 Oct 2021 16:05 #223928
by PCW
Replied by PCW on topic StepConf StepScale and Encoder Scaling not right, following error
You should be able to use your dial indicator to verify the encoder
position even in open loop mode by using halmeter to read the encoder
position pin value.
position even in open loop mode by using halmeter to read the encoder
position pin value.
The following user(s) said Thank You: Redneck92
Please Log in or Create an account to join the conversation.
- Redneck92
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 7
22 Oct 2021 17:14 - 22 Oct 2021 17:15 #223932
by Redneck92
Replied by Redneck92 on topic StepConf StepScale and Encoder Scaling not right, following error
I did as you said and got X and Y axis working perfectly now. Even finished to tune them with halscope and everything.
But Z axis on the other hand is giving me a headache.
I did the same procedures on Z and it will not work.
I started in open loop again, let the Step_Conf calculator do its thing and tested the axis.
When I told it to move + - 2mm it falls about 0.05mm short.
It only moves 3.95mm.
When I told it to move + - 5mm it did the exact same thing.
It moved 0.05mm to short.
I then manually raised the Step_Scale until it moved exactly what I wanted it to.
So far so good.
Then I went and put this Step_Scale and used it in Axis.
When I tell it to move Z -1 it exactly moves 1mm.
Then I tell it to move Z -5 and then it only moves 4.95mm again.
When I then tell it to move Z -7 it only moves to about 6.65mm.
But when I tell it to move to Z0 again, it moves exactly to the 0 starting point.
It´s like there is some kind of cascading error or something.
I can´t get my head around this.
Do you have more sugestions for me?
Thank you very much in advance.
But Z axis on the other hand is giving me a headache.
I did the same procedures on Z and it will not work.
I started in open loop again, let the Step_Conf calculator do its thing and tested the axis.
When I told it to move + - 2mm it falls about 0.05mm short.
It only moves 3.95mm.
When I told it to move + - 5mm it did the exact same thing.
It moved 0.05mm to short.
I then manually raised the Step_Scale until it moved exactly what I wanted it to.
So far so good.
Then I went and put this Step_Scale and used it in Axis.
When I tell it to move Z -1 it exactly moves 1mm.
Then I tell it to move Z -5 and then it only moves 4.95mm again.
When I then tell it to move Z -7 it only moves to about 6.65mm.
But when I tell it to move to Z0 again, it moves exactly to the 0 starting point.
It´s like there is some kind of cascading error or something.
I can´t get my head around this.
Do you have more sugestions for me?
Thank you very much in advance.
Last edit: 22 Oct 2021 17:15 by Redneck92.
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17973
- Thank you received: 4830
22 Oct 2021 17:57 #223936
by PCW
Replied by PCW on topic StepConf StepScale and Encoder Scaling not right, following error
is Z open or closed loop?
If closed loop what does the encoder position show vs the commanded position?
If closed loop what does the encoder position show vs the commanded position?
Please Log in or Create an account to join the conversation.
- Redneck92
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 7
22 Oct 2021 18:15 - 22 Oct 2021 18:15 #223937
by Redneck92
Replied by Redneck92 on topic StepConf StepScale and Encoder Scaling not right, following error
Z works in closed loop aswell in Axis.
How can I See the encoder Position and the commanded Position?
Can I check this with the hal Meter?
How can I See the encoder Position and the commanded Position?
Can I check this with the hal Meter?
Last edit: 22 Oct 2021 18:15 by Redneck92.
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17973
- Thank you received: 4830
22 Oct 2021 18:24 #223938
by PCW
Replied by PCW on topic StepConf StepScale and Encoder Scaling not right, following error
if its closed loop (and Z is mapped to joint 2):
joint.2.motor-pos-cmd
would be the commanded joint position, and:
joint.2.motor-pos-fb
would be connected to the encoder position
You can view these with halscope, halmeter or halshow
joint.2.motor-pos-cmd
would be the commanded joint position, and:
joint.2.motor-pos-fb
would be connected to the encoder position
You can view these with halscope, halmeter or halshow
Please Log in or Create an account to join the conversation.
- Redneck92
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 7
22 Oct 2021 18:28 #223939
by Redneck92
Replied by Redneck92 on topic StepConf StepScale and Encoder Scaling not right, following error
Thank you very much, I will check this tomorrow and report back
Please Log in or Create an account to join the conversation.
- Redneck92
- Offline
- Senior Member
Less
More
- Posts: 41
- Thank you received: 7
23 Oct 2021 10:06 #223977
by Redneck92
Replied by Redneck92 on topic StepConf StepScale and Encoder Scaling not right, following error
So I checked what you suggested yesterday.
I tried a more ridgid idicator stand and another dial indicator.
The error is actuall not cascading.
On every value it just moves 0.03mm to short.
Joint.2.motor-pos-cmd is 38.19773
joint.2.motor-pos-fb is 38.1961
So it seems to be 0.0011mm off as I See.
But this would not explain the 0.03mm that are missing.
I used the Step_Scale and Encoder_Scale values that were calculated from the Pncconf Programm.
Step_Scale 104.615
Encoder_Scale 1046.154
Could it be that the pitch on the Z ballscrew is off?
What Do you think?
I tried a more ridgid idicator stand and another dial indicator.
The error is actuall not cascading.
On every value it just moves 0.03mm to short.
Joint.2.motor-pos-cmd is 38.19773
joint.2.motor-pos-fb is 38.1961
So it seems to be 0.0011mm off as I See.
But this would not explain the 0.03mm that are missing.
I used the Step_Scale and Encoder_Scale values that were calculated from the Pncconf Programm.
Step_Scale 104.615
Encoder_Scale 1046.154
Could it be that the pitch on the Z ballscrew is off?
What Do you think?
Please Log in or Create an account to join the conversation.
- LinuxCNC
- General LinuxCNC Questions
- StepConf StepScale and Encoder Scaling not right, following error
Time to create page: 0.107 seconds