dodalem probe basic

This commit is contained in:
2025-12-14 18:29:18 +01:00
parent e110bc87e9
commit 4d0e075a44
820 changed files with 223384 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
### RC Servo Test Configuration - coolant_cannon.hal ###
# loadrt 2 scale comps
addf scale.servo servo-thread
setp scale.servo.gain -0.00741
setp scale.servo.offset .8333
# enable 7i92 pwmgen0
setp hm2_7i92.0.pwmgen.00.enable 1
setp hm2_7i92.0.pwmgen.pwm_frequency 333
#CONNECTIONS
net scale-sig motion.analog-out-00 => scale.servo.in
net scale-pwm scale.servo.out => hm2_7i92.0.pwmgen.00.value

View File

@@ -0,0 +1,68 @@
# core HAL config file for simulation
# first load all the RT modules that will be needed
# kinematics
loadrt [KINS]KINEMATICS
# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS unlock_joints_mask=16 num_dio=6 num_aio=3
# load 6 differentiators (for velocity and accel signals)
loadrt ddt names=ddt_x,ddt_xv,ddt_y,ddt_yv,ddt_z,ddt_zv
# load additional blocks
loadrt hypot names=vel_xy,vel_xyz
# add motion controller functions to servo thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
# link the differentiator functions into the code
addf ddt_x servo-thread
addf ddt_xv servo-thread
addf ddt_y servo-thread
addf ddt_yv servo-thread
addf ddt_z servo-thread
addf ddt_zv servo-thread
addf vel_xy servo-thread
addf vel_xyz servo-thread
# create HAL signals for position commands from motion module
# loop position commands back to motion module feedback
net Xpos joint.0.motor-pos-cmd => joint.0.motor-pos-fb ddt_x.in
net Ypos joint.1.motor-pos-cmd => joint.1.motor-pos-fb ddt_y.in
net Zpos joint.2.motor-pos-cmd => joint.2.motor-pos-fb ddt_z.in
#net Apos joint.3.motor-pos-cmd => joint.3.motor-pos-fb
#net Bpos joint.4.motor-pos-cmd => joint.4.motor-pos-fb
#net Cpos joint.5.motor-pos-cmd => joint.5.motor-pos-fb
#net Upos joint.6.motor-pos-cmd => joint.6.motor-pos-fb
#net Vpos joint.7.motor-pos-cmd => joint.7.motor-pos-fb
#net Wpos joint.8.motor-pos-cmd => joint.8.motor-pos-fb
# send the position commands thru differentiators to
# generate velocity and accel signals
net Xvel ddt_x.out => ddt_xv.in vel_xy.in0
net Xacc <= ddt_xv.out
net Yvel ddt_y.out => ddt_yv.in vel_xy.in1
net Yacc <= ddt_yv.out
net Zvel ddt_z.out => ddt_zv.in vel_xyz.in0
net Zacc <= ddt_zv.out
# Cartesian 2- and 3-axis velocities
net XYvel vel_xy.out => vel_xyz.in1
net XYZvel <= vel_xyz.out
# estop loopback
net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
# probe input
net probe-in => motion.probe-input
# create signals for tool loading loopback
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
net spindle-fwd spindle.0.forward
net spindle-rev spindle.0.reverse
#net spindle-speed spindle.0.speed-out
# net lube iocontrol.0.lube # deprecated in lcnc 2.10
net flood iocontrol.0.coolant-flood
net mist iocontrol.0.coolant-mist
net tlo motion.analog-in-01 <= halui.tool.length_offset.z

View File

@@ -0,0 +1,68 @@
# core HAL config file for simulation
# first load all the RT modules that will be needed
# kinematics
loadrt [KINS]KINEMATICS
# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS unlock_joints_mask=16 num_dio=6 num_aio=3
# load 6 differentiators (for velocity and accel signals)
loadrt ddt names=ddt_x,ddt_xv,ddt_y,ddt_yv,ddt_z,ddt_zv
# load additional blocks
loadrt hypot names=vel_xy,vel_xyz
# add motion controller functions to servo thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
# link the differentiator functions into the code
addf ddt_x servo-thread
addf ddt_xv servo-thread
addf ddt_y servo-thread
addf ddt_yv servo-thread
addf ddt_z servo-thread
addf ddt_zv servo-thread
addf vel_xy servo-thread
addf vel_xyz servo-thread
# create HAL signals for position commands from motion module
# loop position commands back to motion module feedback
net Xpos joint.0.motor-pos-cmd => joint.0.motor-pos-fb ddt_x.in
net Ypos joint.1.motor-pos-cmd => joint.1.motor-pos-fb ddt_y.in
net Zpos joint.2.motor-pos-cmd => joint.2.motor-pos-fb ddt_z.in
net Apos joint.3.motor-pos-cmd => joint.3.motor-pos-fb
#net Bpos joint.4.motor-pos-cmd => joint.4.motor-pos-fb
#net Cpos joint.5.motor-pos-cmd => joint.5.motor-pos-fb
#net Upos joint.6.motor-pos-cmd => joint.6.motor-pos-fb
#net Vpos joint.7.motor-pos-cmd => joint.7.motor-pos-fb
#net Wpos joint.8.motor-pos-cmd => joint.8.motor-pos-fb
# send the position commands thru differentiators to
# generate velocity and accel signals
net Xvel ddt_x.out => ddt_xv.in vel_xy.in0
net Xacc <= ddt_xv.out
net Yvel ddt_y.out => ddt_yv.in vel_xy.in1
net Yacc <= ddt_yv.out
net Zvel ddt_z.out => ddt_zv.in vel_xyz.in0
net Zacc <= ddt_zv.out
# Cartesian 2- and 3-axis velocities
net XYvel vel_xy.out => vel_xyz.in1
net XYZvel <= vel_xyz.out
# estop loopback
net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
# probe input
net probe-in => motion.probe-input
# create signals for tool loading loopback
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
net spindle-fwd spindle.0.forward
net spindle-rev spindle.0.reverse
#net spindle-speed spindle.0.speed-out
# net lube iocontrol.0.lube # deprecated in lcnc 2.10
net flood iocontrol.0.coolant-flood
net mist iocontrol.0.coolant-mist
net tlo motion.analog-in-01 <= halui.tool.length_offset.z

View File

@@ -0,0 +1,77 @@
# core HAL config file for simulation
# first load all the RT modules that will be needed
# kinematics
loadrt [KINS]KINEMATICS
# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS unlock_joints_mask=16 num_dio=6 num_aio=3
# load 6 differentiators (for velocity and accel signals)
loadrt ddt names=ddt_x,ddt_xv,ddt_y,ddt_yv,ddt_z,ddt_zv
# load additional blocks
loadrt hypot names=vel_xy,vel_xyz
# add motion controller functions to servo thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
# link the differentiator functions into the code
addf ddt_x servo-thread
addf ddt_xv servo-thread
addf ddt_y servo-thread
addf ddt_yv servo-thread
addf ddt_z servo-thread
addf ddt_zv servo-thread
addf vel_xy servo-thread
addf vel_xyz servo-thread
# create HAL signals for position commands from motion module
# loop position commands back to motion module feedback
net Xpos joint.0.motor-pos-cmd => joint.0.motor-pos-fb ddt_x.in
net Ypos joint.1.motor-pos-cmd => joint.1.motor-pos-fb ddt_y.in
net Zpos joint.2.motor-pos-cmd => joint.2.motor-pos-fb ddt_z.in
net Apos joint.3.motor-pos-cmd => joint.3.motor-pos-fb
#net Bpos joint.4.motor-pos-cmd => joint.4.motor-pos-fb
net Cpos joint.4.motor-pos-cmd => joint.4.motor-pos-fb
#net Upos joint.6.motor-pos-cmd => joint.6.motor-pos-fb
#net Vpos joint.7.motor-pos-cmd => joint.7.motor-pos-fb
#net Wpos joint.8.motor-pos-cmd => joint.8.motor-pos-fb
# send the position commands thru differentiators to
# generate velocity and accel signals
net Xvel ddt_x.out => ddt_xv.in vel_xy.in0
net Xacc <= ddt_xv.out
net Yvel ddt_y.out => ddt_yv.in vel_xy.in1
net Yacc <= ddt_yv.out
net Zvel ddt_z.out => ddt_zv.in vel_xyz.in0
net Zacc <= ddt_zv.out
# Cartesian 2- and 3-axis velocities
net XYvel vel_xy.out => vel_xyz.in1
net XYZvel <= vel_xyz.out
# estop loopback
net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in
# probe input
net probe-in => motion.probe-input
# create signals for tool loading loopback
#net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
#net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed
# ---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
net spindle-fwd spindle.0.forward
net spindle-rev spindle.0.reverse
#net spindle-speed spindle.0.speed-out
# net lube iocontrol.0.lube # deprecated in lcnc 2.10
net flood iocontrol.0.coolant-flood
net mist iocontrol.0.coolant-mist
net tlo motion.analog-in-01 <= halui.tool.length_offset.z

View File

@@ -0,0 +1,25 @@
loadrt time
loadrt not
addf time.0 servo-thread
addf not.0 servo-thread
net prog-running not.0.in <= halui.program.is-idle
net prog-paused halui.program.is-paused => time.0.pause
net cycle-timer time.0.start <= not.0.out
net cycle-seconds qtpyvcp.timerseconds.in <= time.0.seconds
net cycle-minutes qtpyvcp.timerminutes.in <= time.0.minutes
net cycle-hours qtpyvcp.timerhours.in <= time.0.hours
# *** Time items required for Probe Basic to run ***
# ---manual tool change signals---
net tool-change-request => qtpyvcp_manualtoolchange.change
net tool-change-confirmed <= qtpyvcp_manualtoolchange.changed
net tool-number => qtpyvcp_manualtoolchange.number
# *** Probe graphic simulation trigger push probe tip ***
net probe-in => qtpyvcp.probe-in.out
net probe-in <= qtpyvcp.probe-led.on
# *** Set line below for actual spindle readout from your hal file ***
net spindle-rpm-filtered scale_to_rpm.out => qtpyvcp.spindle-encoder-rpm.in

View File

@@ -0,0 +1,15 @@
loadrt pwmgen output_type=0
addf scale.servo servo-thread
addf pwmgen.update servo-thread
addf pwmgen.make-pulses servo-thread
setp pwmgen.0.enable 1
setp pwmgen.0.pwm-freq 333
setp scale.servo.gain 0.0037
setp scale.servo.offset 0.333
#CONNECTIONS
net scale-sig motion.analog-out-00 => scale.servo.in #input degrees
net scale-pwm scale.servo.out => pwmgen.0.value

View File

@@ -0,0 +1,39 @@
# simulated spindle encoder (for spindle-synced moves)
loadrt sim_spindle names=sim_spindle
setp sim_spindle.scale 0.01666667
loadrt limit2 names=limit_speed
loadrt lowpass names=spindle_mass
loadrt near names=near_speed
# this limit doesnt make any sense to me:
setp limit_speed.maxv 5000.0 # rpm/second
# encoder reset control
# hook up motion controller's sync output
net spindle-index-enable spindle.0.index-enable <=> sim_spindle.index-enable
# report our revolution count to the motion controller
net spindle-pos sim_spindle.position-fb => spindle.0.revs
# simulate spindle mass
setp spindle_mass.gain .07
# spindle speed control
net spindle-speed-cmd spindle.0.speed-out => limit_speed.in
net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in
# for spindle velocity estimate
net spindle-rpm-filtered spindle_mass.out spindle.0.speed-in near_speed.in2
# at-speed detection
setp near_speed.scale 1.1
setp near_speed.difference 10
net spindle-speed-cmd => near_speed.in1
net spindle-at-speed near_speed.out spindle.0.at-speed
addf limit_speed servo-thread
addf spindle_mass servo-thread
addf near_speed servo-thread
addf sim_spindle servo-thread

View File

@@ -0,0 +1,53 @@
loadrt or2 names=or2_0
loadrt comp names=comp_x,comp_y,comp_z
net Xhomeswpos => comp_x.in0
net Yhomeswpos => comp_y.in0
net Zhomeswpos => comp_z.in0
#net Ahomeswpos => comp_a.in0
#net Bhomeswpos => comp_b.in0
#net Chomeswpos => comp_c.in0
sets Xhomeswpos 1
sets Yhomeswpos .5
sets Zhomeswpos 2
#sets Ahomeswpos 2
#sets Bhomeswpos 2
#sets Chomeswpos 2
net Xpos => comp_x.in1
net Ypos => comp_y.in1
net Zpos => comp_z.in1
#net Apos => comp_a.in1
#net Bpos => comp_b.in1
#net Cpos => comp_c.in1
setp comp_x.hyst .02
setp comp_y.hyst .02
setp comp_z.hyst .02
#setp comp_a.hyst .02
#setp comp_b.hyst .02
#setp comp_c.hyst .02
net Xhomesw <= comp_x.out => joint.0.home-sw-in
net Yhomesw <= comp_y.out => joint.1.home-sw-in
net Zhomesw <= comp_z.out => joint.2.home-sw-in
#net Ahomesw <= comp_a.out => joint.3.home-sw-in
#net Bhomesw <= comp_b.out => joint.4.home-sw-in
#net Chomesw <= comp_c.out => joint.4.home-sw-in
# net Xhomesw => or2_0.in0
# net Zhomesw => or2_0.in1
# net XZhomesw or2_0.out => joint.0.home-sw-in joint.2.home-sw-in
addf comp_x servo-thread
addf comp_y servo-thread
addf comp_z servo-thread
#addf comp_a servo-thread
#addf comp_b servo-thread
#addf comp_c servo-thread
addf or2_0 servo-thread

View File

@@ -0,0 +1,69 @@
# counting the spindle encoder in software
loadrt encoder names=encoder_0
# simulate the encoder
loadrt sim_encoder names=sim_encoder_0
loadrt limit2 names=limit_speed
addf limit_speed servo-thread
#######################################################
# Beginning of threading related stuff
#######################################################
# spindle speed control
net spindle-speed-cmd spindle.0.speed-out => limit_speed.in
net spindle-speed-limited limit_speed.out => sim_encoder_0.speed
# simulate spindle mass
setp limit_speed.maxv 3000.0 # rpm/second
# spindle encoder
# connect encoder signals to encoder counter
net spindle-phase-A sim_encoder_0.phase-A => encoder_0.phase-A
net spindle-phase-B sim_encoder_0.phase-B => encoder_0.phase-B
net spindle-phase-Z sim_encoder_0.phase-Z => encoder_0.phase-Z
# assume 120 ppr = 480 counts/rev for the spindle
setp sim_encoder_0.ppr 12
# iocontrol output is in rpm, but sim-encoder speed is rps
setp sim_encoder_0.scale 60
# scale encoder output to read in revolutions
# (that way thread pitches can be straightforward,
# a 20 tpi thread would multiply the encoder output
# by 1/20, etc)
setp encoder_0.position-scale 48
# encoder reset control
# hook up motion controller's sync output
net spindle-index-enable spindle.0.index-enable <=> encoder_0.index-enable
# report our revolution count to the motion controller
net spindle-pos encoder_0.position => spindle.0.revs
# for spindle velocity estimate
loadrt lowpass names=lowpass_velocity
loadrt scale names=scale_to_rpm,scale.servo
net spindle-rps-raw encoder_0.velocity lowpass_velocity.in
net spindle-rps-filtered lowpass_velocity.out scale_to_rpm.in spindle.0.speed-in
net spindle-rpm-filtered scale_to_rpm.out
setp scale_to_rpm.gain 60
setp lowpass_velocity.gain .07
addf lowpass_velocity servo-thread
addf scale_to_rpm servo-thread
# for at-speed detection
loadrt near names=near_speed
addf near_speed servo-thread
setp near_speed.scale 1.1
setp near_speed.difference 10
net spindle-speed-cmd => near_speed.in1
net spindle-rpm-filtered => near_speed.in2
net spindle-at-speed near_speed.out spindle.0.at-speed
net spindle-fwd <= spindle.0.forward
addf encoder.capture-position servo-thread
addf sim-encoder.update-speed servo-thread
addf sim-encoder.make-pulses base-thread
addf encoder.update-counters base-thread