Glass scales index
21 Jan 2022 00:49 - 21 Jan 2022 00:56 #232586
by einarak
Glass scales index was created by einarak
I´m struggling to get a reliable signal from the index channel, running heidenhein ls486 glass scales. The index pulse is created with magnets under the scale.
But I just get an ocasional signal pulse in hal scope, but it works flawlessly in my oscilloscope. What am I missing here?
But I just get an ocasional signal pulse in hal scope, but it works flawlessly in my oscilloscope. What am I missing here?
HAL file
# Generated by PNCconf at Tue Jan 18 00:08:08 2022
# Using LinuxCNC version: Master (2.9)
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
loadusr -Wn pyvcp pyvcp -c pyvcp [DISPLAY](PYVCP)
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=6 num_pwmgens=6 num_stepgens=0 sserial_port_0=000xxx"
setp [HMOT](CARD0).watchdog.timeout_ns 5000000
loadrt pid names=pid.0,pid.1,pid.2,pid.s #xyz
loadrt abs names=abs.spindle
loadrt lowpass names=lowpass.spindle
loadrt charge_pump
addf charge-pump servo-thread
addf [HMOT](CARD0).read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.0.do-pid-calcs servo-thread
addf pid.1.do-pid-calcs servo-thread
addf pid.2.do-pid-calcs servo-thread
addf pid.s.do-pid-calcs servo-thread
addf abs.spindle servo-thread
addf lowpass.spindle servo-thread
addf [HMOT](CARD0).write servo-thread
# external output signals
# --- MACHINE-IS-ENABLED ---
net machine-is-enabled => hm2_7i97.0.ssr.00.out-00
# --- MACHINE-IS-ENABLED ---
#net machine-is-enabled => hm2_7i97.0.ssr.00.out-01 ##-setja delay?
# --- CHARGE-PUMP ---
net charge-pump => hm2_7i97.0.ssr.00.out-02
# --- COOLANT-FLOOD ---
net coolant-flood => hm2_7i97.0.ssr.00.out-03
# external input signals
# ######################################################
# Axis-of-motion Specific Configs (not the GUI)
# ######################################################
# ################
# X [0] Axis
# ################
# axis enable chain
newsig emcmot.00.enable bit
sets emcmot.00.enable FALSE
net emcmot.00.enable => pid.0.enable
net emcmot.00.enable => hm2_7i97.0.pwmgen.00.enable
net emcmot.00.enable <= joint.0.amp-enable-out
# encoder feedback
setp hm2_7i97.0.encoder.00.counter-mode 0
setp hm2_7i97.0.encoder.00.filter 1
setp hm2_7i97.0.encoder.00.index-enable TRUE ##TEST
setp hm2_7i97.0.encoder.00.index-invert 0
setp hm2_7i97.0.encoder.00.index-mask FALSE
setp hm2_7i97.0.encoder.00.index-mask-invert 0
setp hm2_7i97.0.encoder.00.scale [JOINT_0]ENCODER_SCALE
net motor.00.pos-fb hm2_7i97.0.encoder.00.position => pid.0.feedback
net motor.00.pos-fb => joint.0.motor-pos-fb #push copy back to Axis GUI
# set PID loop gains from inifile
setp pid.0.Pgain [JOINT_0]P
setp pid.0.Igain [JOINT_0]I
setp pid.0.Dgain [JOINT_0]D
setp pid.0.bias [JOINT_0]BIAS
setp pid.0.FF0 [JOINT_0]FF0
setp pid.0.FF1 [JOINT_0]FF1
setp pid.0.FF2 [JOINT_0]FF2
setp pid.0.deadband [JOINT_0]DEADBAND
setp pid.0.maxoutput [JOINT_0]MAX_OUTPUT
# position command signals
setp hm2_7i97.0.pwmgen.00.output-type 1 #PWM up on pin0, #PWM down on pin1
setp hm2_7i97.0.pwmgen.00.offset-mode 1 # offset mode so 50% = 0
setp hm2_7i97.0.pwmgen.00.scale [JOINT_0]OUTPUT_SCALE
net emcmot.00.pos-cmd joint.0.motor-pos-cmd => pid.0.command
net motor.00.command pid.0.output => hm2_7i97.0.pwmgen.00.value
# ################
# Y [1] Axis
# ################
# axis enable chain
newsig emcmot.01.enable bit
sets emcmot.01.enable FALSE
net emcmot.01.enable => pid.1.enable
net emcmot.01.enable => hm2_7i97.0.pwmgen.01.enable
net emcmot.01.enable <= joint.1.amp-enable-out
# encoder feedback
setp hm2_7i97.0.encoder.01.counter-mode 0
setp hm2_7i97.0.encoder.01.filter 1
setp hm2_7i97.0.encoder.01.index-invert 0
setp hm2_7i97.0.encoder.01.index-mask 0
setp hm2_7i97.0.encoder.01.index-mask-invert 0
setp hm2_7i97.0.encoder.01.scale [JOINT_1]ENCODER_SCALE
net motor.01.pos-fb hm2_7i97.0.encoder.01.position => pid.1.feedback
net motor.01.pos-fb => joint.1.motor-pos-fb #push copy back to Axis GUI
# set PID loop gains from inifile
setp pid.1.Pgain [JOINT_1]P
setp pid.1.Igain [JOINT_1]I
setp pid.1.Dgain [JOINT_1]D
setp pid.1.bias [JOINT_1]BIAS
setp pid.1.FF0 [JOINT_1]FF0
setp pid.1.FF1 [JOINT_1]FF1
setp pid.1.FF2 [JOINT_1]FF2
setp pid.1.deadband [JOINT_1]DEADBAND
setp pid.1.maxoutput [JOINT_1]MAX_OUTPUT
# position command signals
setp hm2_7i97.0.pwmgen.01.output-type 1 #PWM up on pin0, #PWM down on pin1
setp hm2_7i97.0.pwmgen.01.offset-mode 1 # offset mode so 50% = 0
setp hm2_7i97.0.pwmgen.01.scale [JOINT_1]OUTPUT_SCALE
net emcmot.01.pos-cmd joint.1.motor-pos-cmd => pid.1.command
#net motor.01.command pid.1.output => hm2_7i97.0.pwmgen.01.value
# ################
# Z [2] Axis
# ################
# axis enable chain
newsig emcmot.02.enable bit
sets emcmot.02.enable FALSE
net emcmot.02.enable => pid.2.enable
net emcmot.02.enable => hm2_7i97.0.pwmgen.02.enable
net emcmot.02.enable <= joint.2.amp-enable-out
# encoder feedback
setp hm2_7i97.0.encoder.02.counter-mode 0
setp hm2_7i97.0.encoder.02.filter 1
setp hm2_7i97.0.encoder.02.index-invert 0
setp hm2_7i97.0.encoder.02.index-mask 0
setp hm2_7i97.0.encoder.02.index-mask-invert 0
setp hm2_7i97.0.encoder.02.scale [JOINT_2]ENCODER_SCALE
net motor.02.pos-fb hm2_7i97.0.encoder.02.position => pid.2.feedback
net motor.02.pos-fb => joint.2.motor-pos-fb #push copy back to Axis GUI
# set PID loop gains from inifile
setp pid.2.Pgain [JOINT_2]P
setp pid.2.Igain [JOINT_2]I
setp pid.2.Dgain [JOINT_2]D
setp pid.2.bias [JOINT_2]BIAS
setp pid.2.FF0 [JOINT_2]FF0
setp pid.2.FF1 [JOINT_2]FF1
setp pid.2.FF2 [JOINT_2]FF2
setp pid.2.deadband [JOINT_2]DEADBAND
setp pid.2.maxoutput [JOINT_2]MAX_OUTPUT
# position command signals
setp hm2_7i97.0.pwmgen.02.output-type 1 #PWM up on pin0, #PWM down on pin1
setp hm2_7i97.0.pwmgen.02.offset-mode 1 # offset mode so 50% = 0
setp hm2_7i97.0.pwmgen.02.scale [JOINT_2]OUTPUT_SCALE
net emcmot.02.pos-cmd joint.2.motor-pos-cmd => pid.2.command
net motor.02.command pid.2.output => hm2_7i97.0.pwmgen.02.value
#*******************
# SPINDLE
#*******************
setp pid.s.Pgain [SPINDLE_0]P
setp pid.s.Igain [SPINDLE_0]I
setp pid.s.Dgain [SPINDLE_0]D
setp pid.s.bias [SPINDLE_0]BIAS
setp pid.s.FF0 [SPINDLE_0]FF0
setp pid.s.FF1 [SPINDLE_0]FF1
setp pid.s.FF2 [SPINDLE_0]FF2
setp pid.s.deadband [SPINDLE_0]DEADBAND
setp pid.s.maxoutput [SPINDLE_0]MAX_OUTPUT
setp pid.s.error-previous-target true
net spindle-index-enable <=> pid.s.index-enable
net spindle-enable => pid.s.enable
net spindle-vel-cmd-rpm => pid.s.command
net spindle-vel-fb-rpm => pid.s.feedback
net spindle-output <= pid.s.output
# ---PWM Generator signals/setup---
setp [HMOT](CARD0).pwmgen.05.output-type 1 #PWM pin0
setp [HMOT](CARD0).pwmgen.05.offset-mode 1 # offset mode so 50% = 0
setp [HMOT](CARD0).pwmgen.05.scale [SPINDLE_0]OUTPUT_SCALE
net spindle-output => [HMOT](CARD0).pwmgen.05.value
net spindle-enable => [HMOT](CARD0).pwmgen.05.enable
# ---Encoder feedback signals/setup---
setp [HMOT](CARD0).encoder.05.counter-mode 0
setp [HMOT](CARD0).encoder.05.filter 1
setp [HMOT](CARD0).encoder.05.index-invert 0
setp [HMOT](CARD0).encoder.05.index-mask 0
setp [HMOT](CARD0).encoder.05.index-mask-invert 0
setp [HMOT](CARD0).encoder.05.scale [SPINDLE_0]OUTPUT_SCALE
net spindle-revs <= [HMOT](CARD0).encoder.05.position
net spindle-vel-fb-rps <= [HMOT](CARD0).encoder.05.velocity
net spindle-vel-fb-rpm <= [HMOT](CARD0).encoder.05.velocity-rpm
net spindle-index-enable <=> [HMOT](CARD0).encoder.05.index-enable
# ---setup spindle control signals---
net spindle-vel-cmd-rps <= spindle.0.speed-out-rps
net spindle-vel-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-enable <= spindle.0.on
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-revs => spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
net spindle-vel-fb-rps => spindle.0.speed-in
net spindle-index-enable <=> spindle.0.index-enable
# ---Setup spindle at speed signals---
sets spindle-at-speed true
#******************************
# 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
# ---charge pump signals---
#net estop-out => charge-pump.enable
#net charge-pump <= charge-pump.out
# ---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---
##net tool-change-request <= iocontrol.0.tool-change
##net tool-change-confirmed => iocontrol.0.tool-changed
##net tool-number <= iocontrol.0.tool-prep-number
# ---ignore tool prepare requests---
##net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
INI file
# Generated by PNCconf at Tue Jan 18 00:08:08 2022
# Using LinuxCNC version: Master (2.9)
# If you make changes to this file, they will be
# overwritten when you run PNCconf again
[EMC]
MACHINE = EAK_LinuxCNC_MESA
DEBUG = 0
VERSION = 1.1
[DISPLAY]
DISPLAY = gmoccapy
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
MAX_FEED_OVERRIDE = 2.000000
MAX_SPINDLE_OVERRIDE = 1.000000
MIN_SPINDLE_OVERRIDE = 0.500000
MAX_RAPID_OVERRIDE = 1
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/einarak/linuxcnc/nc_files
PYVCP = pyvcp-panel.xml
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
POSITION_FEEDBACK = ACTUAL
DEFAULT_LINEAR_VELOCITY = 25.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
CYCLE_TIME = 100
[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 = 1026724
[HMOT]
CARD0=hm2_7i97.0
[HAL]
HALUI = halui
HALFILE = EAK_LinuxCNC_MESA.hal
HALFILE = custom.hal
POSTGUI_HALFILE = pyvcp_options.hal
POSTGUI_HALFILE = gmoccapy_postgui.hal
POSTGUI_HALFILE = custom_postgui.hal
SHUTDOWN = shutdown.hal
[HALUI]
[KINS]
JOINTS = 3
KINEMATICS = trivkins coordinates=XYZ
[TRAJ]
COORDINATES = XYZ
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 8.33
MAX_LINEAR_VELOCITY = 83.33
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
TOOL_CHANGE_QUILL_UP = 1
#******************************************
[AXIS_X]
MAX_VELOCITY = 83.33333333333333
MAX_ACCELERATION = 1000.0
MIN_LIMIT = -0.01
MAX_LIMIT = 500.01
[JOINT_0]
TYPE = LINEAR
HOME = 0.0
FERROR = 10.0
MIN_FERROR = 1.0
MAX_VELOCITY = 83.33333333333333
MAX_ACCELERATION = 1000.0
P = 50
I = 500
D = 500
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
ENCODER_SCALE = 192.3
OUTPUT_SCALE = 10
OUTPUT_MIN_LIMIT = -10.0
OUTPUT_MAX_LIMIT = 10.0
MIN_LIMIT = -0.01
MAX_LIMIT = 500.01
##tilraun til auto zero home
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 1.0
HOME_USE_INDEX = YES
##VOLATILE_HOME = YES
###
HOME_OFFSET = 0.0
HOME_SEQUENCE = 1
#******************************************
#******************************************
[AXIS_Y]
MAX_VELOCITY = 83.33333333333333
MAX_ACCELERATION = 1500.0
MIN_LIMIT = -0.01
MAX_LIMIT = 400.01
[JOINT_1]
TYPE = LINEAR
HOME = 0.0
FERROR = 10.0
MIN_FERROR = 1.0
MAX_VELOCITY = 83.33333333333333
MAX_ACCELERATION = 1500.0
P = 50
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
ENCODER_SCALE = 192.3
OUTPUT_SCALE = 10
OUTPUT_MIN_LIMIT = -10.0
OUTPUT_MAX_LIMIT = 10.0
MIN_LIMIT = -0.01
MAX_LIMIT = 400.01
HOME_OFFSET = 0.0
HOME_SEQUENCE = 2
#******************************************
#******************************************
[AXIS_Z]
MAX_VELOCITY = 83.33333333333333
MAX_ACCELERATION = 1000.0
MIN_LIMIT = -0.01
MAX_LIMIT = 400.01
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
FERROR = 10.0
MIN_FERROR = 1.0
MAX_VELOCITY = 83.33333333333333
MAX_ACCELERATION = 1000.0
P = 50
I = 0
D = 0
FF0 = 0
FF1 = 1
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 0
ENCODER_SCALE = 192.3
OUTPUT_SCALE = 10
OUTPUT_MIN_LIMIT = -10.0
OUTPUT_MAX_LIMIT = 10.0
MIN_LIMIT = -0.01
MAX_LIMIT = 400.01
HOME_OFFSET = 0.0
HOME_SEQUENCE = 0
#******************************************
[SPINDLE_0]
P = 0
I = 0
D = 0
FF0 = 1
FF1 = 0
FF2 = 0
BIAS = 0
DEADBAND = 0
MAX_OUTPUT = 4500
OUTPUT_SCALE = 4500
OUTPUT_MIN_LIMIT = -4500
OUTPUT_MAX_LIMIT = 4500
Last edit: 21 Jan 2022 00:56 by einarak.
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 18563
- Thank you received: 6220
21 Jan 2022 00:55 #232587
by tommylight
Replied by tommylight on topic Glass scales index
Hal scope works at servo thread speed, so 1ms, and that might be to much to reliably detect the index pulse.
Try setting the trigger to the index channel, also use "show hal configuration" to set the index low or high and watch it change.
Try setting the trigger to the index channel, also use "show hal configuration" to set the index low or high and watch it change.
Please Log in or Create an account to join the conversation.
21 Jan 2022 11:50 #232629
by einarak
Replied by einarak on topic Glass scales index
Thanks, how would the line look to connect those two? I am a total newbee here
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 18563
- Thank you received: 6220
21 Jan 2022 13:42 #232637
by tommylight
Replied by tommylight on topic Glass scales index
No connecting, those are for hal scope (your attached screenshot) on the lover right side there is a button named "trigger", click on it and choose the index pin, that way the scope will wait for that pin to change state and start monitoring.
The second hal show is also a LinuxCNC feature for live monitoring of pins and parameters, also for changing values on the fly, it is found in the "machine" menu.
The second hal show is also a LinuxCNC feature for live monitoring of pins and parameters, also for changing values on the fly, it is found in the "machine" menu.
Please Log in or Create an account to join the conversation.
21 Jan 2022 17:45 #232662
by einarak
Replied by einarak on topic Glass scales index
Aha, ofcourse.
I think I am missing something in the setup, I put my pulsgenerator on the input and it did´n give me anything on encoder input-index, it was set to 2v like the signal from the glass scale. Or could that be the problem, that 2v is not high enough so it might need a pullup?
I think I am missing something in the setup, I put my pulsgenerator on the input and it did´n give me anything on encoder input-index, it was set to 2v like the signal from the glass scale. Or could that be the problem, that 2v is not high enough so it might need a pullup?
Please Log in or Create an account to join the conversation.
21 Jan 2022 23:03 #232696
by einarak
Replied by einarak on topic Glass scales index
I did some experiments tonight, and found out that if the slider is moved slow enough the signal is picked up repeatedly and accurate. So that will be the solution of that. Next up, homing with index... Any tips on where to seek info on that one?
Please Log in or Create an account to join the conversation.
21 Jan 2022 23:58 #232708
by PCW
Replied by PCW on topic Glass scales index
Index will work at almost any speed because it does not depend
on LinuxCNCs servo thread rate but rather is implemented in hardware
in the encoder counter.
The way to check index operation is not by looking at the index
input (which is limited by LinuxCNC's servo thread period sampling)
but rather setting index-enable true and seeing if it gets set false
when the index signal occurs.
on LinuxCNCs servo thread rate but rather is implemented in hardware
in the encoder counter.
The way to check index operation is not by looking at the index
input (which is limited by LinuxCNC's servo thread period sampling)
but rather setting index-enable true and seeing if it gets set false
when the index signal occurs.
Please Log in or Create an account to join the conversation.
22 Jan 2022 11:31 #232756
by einarak
Replied by einarak on topic Glass scales index
Works like a charm, so the problem newer was a problem! Thanks for the inoput
The following user(s) said Thank You: tommylight
Please Log in or Create an account to join the conversation.
Time to create page: 0.205 seconds