diff --git a/configs/sim/axis/anglejog/anglejog.hal b/configs/sim/axis/anglejog/anglejog.hal new file mode 100644 index 00000000000..29b306690aa --- /dev/null +++ b/configs/sim/axis/anglejog/anglejog.hal @@ -0,0 +1,53 @@ +# Core HAL setup for the simulated lathe angle-jog demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# tool change +net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared diff --git a/configs/sim/axis/anglejog/anglejog.ini b/configs/sim/axis/anglejog/anglejog.ini index 696f6188bb2..c56cbde35a8 100644 --- a/configs/sim/axis/anglejog/anglejog.ini +++ b/configs/sim/axis/anglejog/anglejog.ini @@ -22,7 +22,7 @@ PARAMETER_FILE = anglejog.var [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 -BASE_PERIOD = 100000 +BASE_PERIOD = 0 SERVO_PERIOD = 1000000 [TASK] @@ -31,7 +31,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui - HALFILE = LIB:basic_sim.tcl -no_sim_spindle -no_use_hal_manualtoolchange + HALFILE = ./anglejog.hal # all provisions for anglejog: POSTGUI_HALFILE = anglejog_postgui.hal diff --git a/configs/sim/axis/axis_9axis.hal b/configs/sim/axis/axis_9axis.hal new file mode 100644 index 00000000000..28bd6e899cb --- /dev/null +++ b/configs/sim/axis/axis_9axis.hal @@ -0,0 +1,209 @@ +# Core HAL setup for the simulated nine-axis machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod unlock_joints_mask=0x10 base_period_nsec=0 servo_period_nsec=1000000 num_joints=9 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid,J6_pid,J7_pid,J8_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux,J6_mux,J7_mux,J8_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel,J6_vel,J6_accel,J7_vel,J7_accel,J8_vel,J8_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch,J6_switch,J7_switch,J8_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J6_pid.do-pid-calcs servo-thread +addf J7_pid.do-pid-calcs servo-thread +addf J8_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J6_mux servo-thread +addf J7_mux servo-thread +addf J8_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J6_vel servo-thread +addf J6_accel servo-thread +addf J7_vel servo-thread +addf J7_accel servo-thread +addf J8_vel servo-thread +addf J8_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf J6_switch servo-thread +addf J7_switch servo-thread +addf J8_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel J6_mux.sel J7_mux.sel J8_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-index-enable J0_switch.index-enable <=> joint.0.index-enable +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-index-enable J1_switch.index-enable <=> joint.1.index-enable +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-index-enable J2_switch.index-enable <=> joint.2.index-enable +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# joint 6 +setp J6_pid.FF0 1 +setp J6_pid.Pgain 0 +setp J6_switch.home-pos 0.1 +setp J6_switch.hysteresis 0.05 +net j6-enable joint.6.amp-enable-out => J6_pid.enable +net j6-home-sw J6_switch.home-sw => joint.6.home-sw-in +net j6-pid-output J6_pid.output => J6_mux.in1 +net j6-pos-cmd joint.6.motor-pos-cmd => J6_pid.command +net j6-pos-fb J6_mux.out => J6_mux.in0 J6_switch.cur-pos J6_vel.in joint.6.motor-pos-fb +net j6-vel J6_vel.out => J6_accel.in + +# joint 7 +setp J7_pid.FF0 1 +setp J7_pid.Pgain 0 +setp J7_switch.home-pos 0.1 +setp J7_switch.hysteresis 0.05 +net j7-enable joint.7.amp-enable-out => J7_pid.enable +net j7-home-sw J7_switch.home-sw => joint.7.home-sw-in +net j7-pid-output J7_pid.output => J7_mux.in1 +net j7-pos-cmd joint.7.motor-pos-cmd => J7_pid.command +net j7-pos-fb J7_mux.out => J7_mux.in0 J7_switch.cur-pos J7_vel.in joint.7.motor-pos-fb +net j7-vel J7_vel.out => J7_accel.in + +# joint 8 +setp J8_pid.FF0 1 +setp J8_pid.Pgain 0 +setp J8_switch.home-pos 0.1 +setp J8_switch.hysteresis 0.05 +net j8-enable joint.8.amp-enable-out => J8_pid.enable +net j8-home-sw J8_switch.home-sw => joint.8.home-sw-in +net j8-pid-output J8_pid.output => J8_mux.in1 +net j8-pos-cmd joint.8.motor-pos-cmd => J8_pid.command +net j8-pos-fb J8_mux.out => J8_mux.in0 J8_switch.cur-pos J8_vel.in joint.8.motor-pos-fb +net j8-vel J8_vel.out => J8_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/axis_9axis.ini b/configs/sim/axis/axis_9axis.ini index ff220c27567..4cdfddb60ba 100644 --- a/configs/sim/axis/axis_9axis.ini +++ b/configs/sim/axis/axis_9axis.ini @@ -46,7 +46,7 @@ TOOL_CHANGE_POSITION = 0 0 2 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./axis_9axis.hal HALFILE = locking_indexer.hal [TRAJ] diff --git a/configs/sim/axis/canterp.hal b/configs/sim/axis/canterp.hal new file mode 100644 index 00000000000..7f11737fe69 --- /dev/null +++ b/configs/sim/axis/canterp.hal @@ -0,0 +1,103 @@ +# Core HAL setup for the canonical interpreter demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/canterp.ini b/configs/sim/axis/canterp.ini index 1fc4c1ab779..796720c4b7c 100644 --- a/configs/sim/axis/canterp.ini +++ b/configs/sim/axis/canterp.ini @@ -33,7 +33,7 @@ SERVO_PERIOD = 1000000 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./canterp.hal [TRAJ] NO_FORCE_HOMING = 1 diff --git a/configs/sim/axis/db_demo/base.hal b/configs/sim/axis/db_demo/base.hal new file mode 100644 index 00000000000..12549afd1bd --- /dev/null +++ b/configs/sim/axis/db_demo/base.hal @@ -0,0 +1,201 @@ +# Core HAL setup for the database demo's simulated nine-joint machine. +# Automatic tool-change and display connections are in db_postgui.hal. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadrt trivkins coordinates=XYZABCUVW +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=9 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid,J6_pid,J7_pid,J8_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux,J6_mux,J7_mux,J8_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel,J6_vel,J6_accel,J7_vel,J7_accel,J8_vel,J8_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch,J6_switch,J7_switch,J8_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J6_pid.do-pid-calcs servo-thread +addf J7_pid.do-pid-calcs servo-thread +addf J8_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J6_mux servo-thread +addf J7_mux servo-thread +addf J8_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J6_vel servo-thread +addf J6_accel servo-thread +addf J7_vel servo-thread +addf J7_accel servo-thread +addf J8_vel servo-thread +addf J8_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf J6_switch servo-thread +addf J7_switch servo-thread +addf J8_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel J6_mux.sel J7_mux.sel J8_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +setp J3_switch.hysteresis 0.05 +setp J3_switch.home-pos 0.10 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1.0 +setp J4_pid.Pgain 0 +setp J4_switch.hysteresis 0.05 +setp J4_switch.home-pos 0.10 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1.0 +setp J5_pid.Pgain 0 +setp J5_switch.hysteresis 0.05 +setp J5_switch.home-pos 0.10 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# joint 6 +setp J6_pid.FF0 1.0 +setp J6_pid.Pgain 0 +setp J6_switch.hysteresis 0.05 +setp J6_switch.home-pos 0.10 +net j6-enable joint.6.amp-enable-out => J6_pid.enable +net j6-home-sw J6_switch.home-sw => joint.6.home-sw-in +net j6-pid-output J6_pid.output => J6_mux.in1 +net j6-pos-cmd joint.6.motor-pos-cmd => J6_pid.command +net j6-pos-fb J6_mux.out => J6_mux.in0 J6_switch.cur-pos J6_vel.in joint.6.motor-pos-fb +net j6-vel J6_vel.out => J6_accel.in + +# joint 7 +setp J7_pid.FF0 1.0 +setp J7_pid.Pgain 0 +setp J7_switch.hysteresis 0.05 +setp J7_switch.home-pos 0.10 +net j7-enable joint.7.amp-enable-out => J7_pid.enable +net j7-home-sw J7_switch.home-sw => joint.7.home-sw-in +net j7-pid-output J7_pid.output => J7_mux.in1 +net j7-pos-cmd joint.7.motor-pos-cmd => J7_pid.command +net j7-pos-fb J7_mux.out => J7_mux.in0 J7_switch.cur-pos J7_vel.in joint.7.motor-pos-fb +net j7-vel J7_vel.out => J7_accel.in + +# joint 8 +setp J8_pid.FF0 1.0 +setp J8_pid.Pgain 0 +setp J8_switch.hysteresis 0.05 +setp J8_switch.home-pos 0.10 +net j8-enable joint.8.amp-enable-out => J8_pid.enable +net j8-home-sw J8_switch.home-sw => joint.8.home-sw-in +net j8-pid-output J8_pid.output => J8_mux.in1 +net j8-pos-cmd joint.8.motor-pos-cmd => J8_pid.command +net j8-pos-fb J8_mux.out => J8_mux.in0 J8_switch.cur-pos J8_vel.in joint.8.motor-pos-fb +net j8-vel J8_vel.out => J8_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in diff --git a/configs/sim/axis/db_demo/base.inc b/configs/sim/axis/db_demo/base.inc index 8330fee7eb5..19e92d10fb8 100644 --- a/configs/sim/axis/db_demo/base.inc +++ b/configs/sim/axis/db_demo/base.inc @@ -21,7 +21,7 @@ SERVO_PERIOD = 1000000 [HAL] HALUI=halui -HALFILE = LIB:basic_sim.tcl -no_use_hal_manualtoolchange +HALFILE = ./base.hal POSTGUI_HALFILE = db_postgui.hal [TRAJ] diff --git a/configs/sim/axis/db_demo/db_postgui.hal b/configs/sim/axis/db_demo/db_postgui.hal index f7754548391..1a56f3fff61 100644 --- a/configs/sim/axis/db_demo/db_postgui.hal +++ b/configs/sim/axis/db_demo/db_postgui.hal @@ -1,8 +1,5 @@ # display iocontrol tool prepare/change pins # and simulate an automatic toolchanger -delsig tool:change-loop # remove basic_sim.tcl loops -delsig tool:prep-loop # remove basic_sim.tcl loops - loadrt oneshot names=prepare_time,prepare_pulse,change_time,change_pulse addf prepare_time servo-thread addf prepare_pulse servo-thread diff --git a/configs/sim/axis/external_offsets/dynamic_offsets.hal b/configs/sim/axis/external_offsets/dynamic_offsets.hal new file mode 100644 index 00000000000..61effd0453a --- /dev/null +++ b/configs/sim/axis/external_offsets/dynamic_offsets.hal @@ -0,0 +1,84 @@ +# Core HAL setup for the dynamic external-offsets demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=XYZ +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/external_offsets/dynamic_offsets.ini b/configs/sim/axis/external_offsets/dynamic_offsets.ini index b07b103c737..4107c01dbc5 100644 --- a/configs/sim/axis/external_offsets/dynamic_offsets.ini +++ b/configs/sim/axis/external_offsets/dynamic_offsets.ini @@ -5,7 +5,7 @@ APP = halscope -i dynamic_offsets.halscope [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -no_sim_spindle +HALFILE = ./dynamic_offsets.hal POSTGUI_HALFILE = dynamic_offsets_panel.hal [EMC] diff --git a/configs/sim/axis/external_offsets/eoffsets.ini b/configs/sim/axis/external_offsets/eoffsets.ini index 0542f67c902..e5fa019296b 100644 --- a/configs/sim/axis/external_offsets/eoffsets.ini +++ b/configs/sim/axis/external_offsets/eoffsets.ini @@ -19,7 +19,7 @@ APP = eoffsets_monitor.tcl [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -no_use_hal_manualtoolchange +HALFILE = ./eoffsets_core.hal HALFILE = eoffsets.hal POSTGUI_HALFILE = eoffsets_panel.hal diff --git a/configs/sim/axis/external_offsets/eoffsets_core.hal b/configs/sim/axis/external_offsets/eoffsets_core.hal new file mode 100644 index 00000000000..728e6688638 --- /dev/null +++ b/configs/sim/axis/external_offsets/eoffsets_core.hal @@ -0,0 +1,104 @@ +# Core HAL setup for the external-offsets demonstration. +# Display connections are in eoffsets_panel.hal. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadrt trivkins coordinates=XYZ +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared diff --git a/configs/sim/axis/external_offsets/eoffsets_panel.hal b/configs/sim/axis/external_offsets/eoffsets_panel.hal index c3bb8080afb..a0dd62251cc 100644 --- a/configs/sim/axis/external_offsets/eoffsets_panel.hal +++ b/configs/sim/axis/external_offsets/eoffsets_panel.hal @@ -1,7 +1,7 @@ # existing (basic_sim.tcl) signals for display: -net J0:pos-cmd => pyvcp.motor-pos-cmd.0-f -net J1:pos-cmd => pyvcp.motor-pos-cmd.1-f -net J2:pos-cmd => pyvcp.motor-pos-cmd.2-f +net j0-pos-cmd => pyvcp.motor-pos-cmd.0-f +net j1-pos-cmd => pyvcp.motor-pos-cmd.1-f +net j2-pos-cmd => pyvcp.motor-pos-cmd.2-f # motor-offset (display only): net E:motor-offset.0 <= joint.0.motor-offset => pyvcp.motor-offset.0-f diff --git a/configs/sim/axis/external_offsets/jwp_z.hal b/configs/sim/axis/external_offsets/jwp_z.hal new file mode 100644 index 00000000000..bb3e39d6beb --- /dev/null +++ b/configs/sim/axis/external_offsets/jwp_z.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the jog-while-paused Z-offset demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=XYZ +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/external_offsets/jwp_z.ini b/configs/sim/axis/external_offsets/jwp_z.ini index d99db80c758..9185c9e09ac 100644 --- a/configs/sim/axis/external_offsets/jwp_z.ini +++ b/configs/sim/axis/external_offsets/jwp_z.ini @@ -11,7 +11,7 @@ [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./jwp_z.hal POSTGUI_HALFILE = jwp_z_panel.hal [EMC] diff --git a/configs/sim/axis/external_offsets/opa.ini b/configs/sim/axis/external_offsets/opa.ini index 2301b15c977..6bcf8498d76 100644 --- a/configs/sim/axis/external_offsets/opa.ini +++ b/configs/sim/axis/external_offsets/opa.ini @@ -6,7 +6,7 @@ APP = sim_pin ini.x.max_acceleration ini.x.max_velocity [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./opa_core.hal HALFILE = opa.hal POSTGUI_HALFILE = opa_panel.hal diff --git a/configs/sim/axis/external_offsets/opa_core.hal b/configs/sim/axis/external_offsets/opa_core.hal new file mode 100644 index 00000000000..2f35200c1c4 --- /dev/null +++ b/configs/sim/axis/external_offsets/opa_core.hal @@ -0,0 +1,105 @@ +# Core HAL setup for the X-offset-per-C-angle demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=XZC +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/extrajoints/12extrajoints.hal b/configs/sim/axis/extrajoints/12extrajoints.hal new file mode 100644 index 00000000000..e19a7214646 --- /dev/null +++ b/configs/sim/axis/extrajoints/12extrajoints.hal @@ -0,0 +1,424 @@ +# HAL setup for the twelve-extra-joints demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +loadrt trivkins coordinates=XYYZ kinstype=both + +loadrt motmod num_extrajoints=12 base_period_nsec=0 servo_period_nsec=1000000 num_joints=16 +addf motion-command-handler servo-thread +addf motion-controller servo-thread + +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid,J6_pid,J7_pid,J8_pid,J9_pid,J10_pid,J11_pid,J12_pid,J13_pid,J14_pid,J15_pid +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J6_pid.do-pid-calcs servo-thread +addf J7_pid.do-pid-calcs servo-thread +addf J8_pid.do-pid-calcs servo-thread +addf J9_pid.do-pid-calcs servo-thread +addf J10_pid.do-pid-calcs servo-thread +addf J11_pid.do-pid-calcs servo-thread +addf J12_pid.do-pid-calcs servo-thread +addf J13_pid.do-pid-calcs servo-thread +addf J14_pid.do-pid-calcs servo-thread +addf J15_pid.do-pid-calcs servo-thread + +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux,J6_mux,J7_mux,J8_mux,J9_mux,J10_mux,J11_mux,J12_mux,J13_mux,J14_mux,J15_mux +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J6_mux servo-thread +addf J7_mux servo-thread +addf J8_mux servo-thread +addf J9_mux servo-thread +addf J10_mux servo-thread +addf J11_mux servo-thread +addf J12_mux servo-thread +addf J13_mux servo-thread +addf J14_mux servo-thread +addf J15_mux servo-thread + +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel,J6_vel,J6_accel,J7_vel,J7_accel,J8_vel,J8_accel,J9_vel,J9_accel,J10_vel,J10_accel,J11_vel,J11_accel,J12_vel,J12_accel,J13_vel,J13_accel,J14_vel,J14_accel,J15_vel,J15_accel +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J6_vel servo-thread +addf J6_accel servo-thread +addf J7_vel servo-thread +addf J7_accel servo-thread +addf J8_vel servo-thread +addf J8_accel servo-thread +addf J9_vel servo-thread +addf J9_accel servo-thread +addf J10_vel servo-thread +addf J10_accel servo-thread +addf J11_vel servo-thread +addf J11_accel servo-thread +addf J12_vel servo-thread +addf J12_accel servo-thread +addf J13_vel servo-thread +addf J13_accel servo-thread +addf J14_vel servo-thread +addf J14_accel servo-thread +addf J15_vel servo-thread +addf J15_accel servo-thread + +loadrt hypot names=hyp_xy,hyp_xyz +addf hyp_xy servo-thread +addf hyp_xyz servo-thread + +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch,J6_switch,J7_switch,J8_switch,J9_switch,J10_switch,J11_switch,J12_switch,J13_switch,J14_switch,J15_switch +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf J6_switch servo-thread +addf J7_switch servo-thread +addf J8_switch servo-thread +addf J9_switch servo-thread +addf J10_switch servo-thread +addf J11_switch servo-thread +addf J12_switch servo-thread +addf J13_switch servo-thread +addf J14_switch servo-thread +addf J15_switch servo-thread + +loadrt limit2 names=limit_speed +addf limit_speed servo-thread + +loadrt lowpass names=spindle_mass +addf spindle_mass servo-thread + +loadrt scale names=rpm_rps +addf rpm_rps servo-thread + +loadrt near names=near_speed +addf near_speed servo-thread + +loadrt sim_spindle names=sim_spindle +addf sim_spindle servo-thread + +loadrt limit3 names=j4.limit3,j5.limit3,j6.limit3,j7.limit3,j8.limit3,j9.limit3,j10.limit3,j11.limit3,j12.limit3,j13.limit3,j14.limit3,j15.limit3 +addf j4.limit3 servo-thread +addf j5.limit3 servo-thread +addf j6.limit3 servo-thread +addf j7.limit3 servo-thread +addf j8.limit3 servo-thread +addf j9.limit3 servo-thread +addf j10.limit3 servo-thread +addf j11.limit3 servo-thread +addf j12.limit3 servo-thread +addf j13.limit3 servo-thread +addf j14.limit3 servo-thread +addf j15.limit3 servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel J6_mux.sel J7_mux.sel J8_mux.sel J9_mux.sel J10_mux.sel J11_mux.sel J12_mux.sel J13_mux.sel J14_mux.sel J15_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +setp J3_switch.home-pos 0.1 +setp J3_switch.hysteresis 0.05 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in hyp_xyz.in2 + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +setp J4_switch.home-pos 0.1 +setp J4_switch.hysteresis 0.05 +setp j4.limit3.max 10 +setp j4.limit3.maxa 100 +setp j4.limit3.maxv 5 +setp j4.limit3.min -10 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-homed joint.4.homed => j4.limit3.enable +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-out j4.limit3.out => joint.4.posthome-cmd +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +setp J5_switch.home-pos 0.1 +setp J5_switch.hysteresis 0.05 +setp j5.limit3.max 10 +setp j5.limit3.maxa 100 +setp j5.limit3.maxv 5 +setp j5.limit3.min -10 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-homed joint.5.homed => j5.limit3.enable +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-out j5.limit3.out => joint.5.posthome-cmd +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# joint 6 +setp J6_pid.FF0 1 +setp J6_pid.Pgain 0 +setp J6_switch.home-pos 0.1 +setp J6_switch.hysteresis 0.05 +setp j6.limit3.max 10 +setp j6.limit3.maxa 100 +setp j6.limit3.maxv 5 +setp j6.limit3.min -10 +net j6-enable joint.6.amp-enable-out => J6_pid.enable +net j6-home-sw J6_switch.home-sw => joint.6.home-sw-in +net j6-homed joint.6.homed => j6.limit3.enable +net j6-pid-output J6_pid.output => J6_mux.in1 +net j6-out j6.limit3.out => joint.6.posthome-cmd +net j6-pos-cmd joint.6.motor-pos-cmd => J6_pid.command +net j6-pos-fb J6_mux.out => J6_mux.in0 J6_switch.cur-pos J6_vel.in joint.6.motor-pos-fb +net j6-vel J6_vel.out => J6_accel.in + +# joint 7 +setp J7_pid.FF0 1 +setp J7_pid.Pgain 0 +setp J7_switch.home-pos 0.1 +setp J7_switch.hysteresis 0.05 +setp j7.limit3.max 10 +setp j7.limit3.maxa 100 +setp j7.limit3.maxv 5 +setp j7.limit3.min -10 +net j7-enable joint.7.amp-enable-out => J7_pid.enable +net j7-home-sw J7_switch.home-sw => joint.7.home-sw-in +net j7-homed joint.7.homed => j7.limit3.enable +net j7-pid-output J7_pid.output => J7_mux.in1 +net j7-out j7.limit3.out => joint.7.posthome-cmd +net j7-pos-cmd joint.7.motor-pos-cmd => J7_pid.command +net j7-pos-fb J7_mux.out => J7_mux.in0 J7_switch.cur-pos J7_vel.in joint.7.motor-pos-fb +net j7-vel J7_vel.out => J7_accel.in + +# joint 8 +setp J8_pid.FF0 1 +setp J8_pid.Pgain 0 +setp J8_switch.home-pos 0.1 +setp J8_switch.hysteresis 0.05 +setp j8.limit3.max 10 +setp j8.limit3.maxa 100 +setp j8.limit3.maxv 5 +setp j8.limit3.min -10 +net j8-enable joint.8.amp-enable-out => J8_pid.enable +net j8-home-sw J8_switch.home-sw => joint.8.home-sw-in +net j8-homed joint.8.homed => j8.limit3.enable +net j8-pid-output J8_pid.output => J8_mux.in1 +net j8-out j8.limit3.out => joint.8.posthome-cmd +net j8-pos-cmd joint.8.motor-pos-cmd => J8_pid.command +net j8-pos-fb J8_mux.out => J8_mux.in0 J8_switch.cur-pos J8_vel.in joint.8.motor-pos-fb +net j8-vel J8_vel.out => J8_accel.in + +# joint 9 +setp J9_pid.FF0 1 +setp J9_pid.Pgain 0 +setp J9_switch.home-pos 0.1 +setp J9_switch.hysteresis 0.05 +setp j9.limit3.max 10 +setp j9.limit3.maxa 100 +setp j9.limit3.maxv 5 +setp j9.limit3.min -10 +net j9-enable joint.9.amp-enable-out => J9_pid.enable +net j9-home-sw J9_switch.home-sw => joint.9.home-sw-in +net j9-homed joint.9.homed => j9.limit3.enable +net j9-pid-output J9_pid.output => J9_mux.in1 +net j9-out j9.limit3.out => joint.9.posthome-cmd +net j9-pos-cmd joint.9.motor-pos-cmd => J9_pid.command +net j9-pos-fb J9_mux.out => J9_mux.in0 J9_switch.cur-pos J9_vel.in joint.9.motor-pos-fb +net j9-vel J9_vel.out => J9_accel.in + +# joint 10 +setp J10_pid.FF0 1 +setp J10_pid.Pgain 0 +setp J10_switch.home-pos 0.1 +setp J10_switch.hysteresis 0.05 +setp j10.limit3.max 10 +setp j10.limit3.maxa 100 +setp j10.limit3.maxv 5 +setp j10.limit3.min -10 +net j10-enable joint.10.amp-enable-out => J10_pid.enable +net j10-home-sw J10_switch.home-sw => joint.10.home-sw-in +net j10-homed joint.10.homed => j10.limit3.enable +net j10-pid-output J10_pid.output => J10_mux.in1 +net j10-out j10.limit3.out => joint.10.posthome-cmd +net j10-pos-cmd joint.10.motor-pos-cmd => J10_pid.command +net j10-pos-fb J10_mux.out => J10_mux.in0 J10_switch.cur-pos J10_vel.in joint.10.motor-pos-fb +net j10-vel J10_vel.out => J10_accel.in + +# joint 11 +setp J11_pid.FF0 1 +setp J11_pid.Pgain 0 +setp J11_switch.home-pos 0.1 +setp J11_switch.hysteresis 0.05 +setp j11.limit3.max 10 +setp j11.limit3.maxa 100 +setp j11.limit3.maxv 5 +setp j11.limit3.min -10 +net j11-enable joint.11.amp-enable-out => J11_pid.enable +net j11-home-sw J11_switch.home-sw => joint.11.home-sw-in +net j11-homed joint.11.homed => j11.limit3.enable +net j11-pid-output J11_pid.output => J11_mux.in1 +net j11-out j11.limit3.out => joint.11.posthome-cmd +net j11-pos-cmd joint.11.motor-pos-cmd => J11_pid.command +net j11-pos-fb J11_mux.out => J11_mux.in0 J11_switch.cur-pos J11_vel.in joint.11.motor-pos-fb +net j11-vel J11_vel.out => J11_accel.in + +# joint 12 +setp J12_pid.FF0 1 +setp J12_pid.Pgain 0 +setp J12_switch.home-pos 0.1 +setp J12_switch.hysteresis 0.05 +setp j12.limit3.max 10 +setp j12.limit3.maxa 100 +setp j12.limit3.maxv 5 +setp j12.limit3.min -10 +net j12-enable joint.12.amp-enable-out => J12_pid.enable +net j12-home-sw J12_switch.home-sw => joint.12.home-sw-in +net j12-homed joint.12.homed => j12.limit3.enable +net j12-pid-output J12_pid.output => J12_mux.in1 +net j12-out j12.limit3.out => joint.12.posthome-cmd +net j12-pos-cmd joint.12.motor-pos-cmd => J12_pid.command +net j12-pos-fb J12_mux.out => J12_mux.in0 J12_switch.cur-pos J12_vel.in joint.12.motor-pos-fb +net j12-vel J12_vel.out => J12_accel.in + +# joint 13 +setp J13_pid.FF0 1 +setp J13_pid.Pgain 0 +setp J13_switch.home-pos 0.1 +setp J13_switch.hysteresis 0.05 +setp j13.limit3.max 10 +setp j13.limit3.maxa 100 +setp j13.limit3.maxv 5 +setp j13.limit3.min -10 +net j13-enable joint.13.amp-enable-out => J13_pid.enable +net j13-home-sw J13_switch.home-sw => joint.13.home-sw-in +net j13-homed joint.13.homed => j13.limit3.enable +net j13-pid-output J13_pid.output => J13_mux.in1 +net j13-out j13.limit3.out => joint.13.posthome-cmd +net j13-pos-cmd joint.13.motor-pos-cmd => J13_pid.command +net j13-pos-fb J13_mux.out => J13_mux.in0 J13_switch.cur-pos J13_vel.in joint.13.motor-pos-fb +net j13-vel J13_vel.out => J13_accel.in + +# joint 14 +setp J14_pid.FF0 1 +setp J14_pid.Pgain 0 +setp J14_switch.home-pos 0.1 +setp J14_switch.hysteresis 0.05 +setp j14.limit3.max 10 +setp j14.limit3.maxa 100 +setp j14.limit3.maxv 5 +setp j14.limit3.min -10 +net j14-enable joint.14.amp-enable-out => J14_pid.enable +net j14-home-sw J14_switch.home-sw => joint.14.home-sw-in +net j14-homed joint.14.homed => j14.limit3.enable +net j14-pid-output J14_pid.output => J14_mux.in1 +net j14-out j14.limit3.out => joint.14.posthome-cmd +net j14-pos-cmd joint.14.motor-pos-cmd => J14_pid.command +net j14-pos-fb J14_mux.out => J14_mux.in0 J14_switch.cur-pos J14_vel.in joint.14.motor-pos-fb +net j14-vel J14_vel.out => J14_accel.in + +# joint 15 +setp J15_pid.FF0 1 +setp J15_pid.Pgain 0 +setp J15_switch.home-pos 0.1 +setp J15_switch.hysteresis 0.05 +setp j15.limit3.max 10 +setp j15.limit3.maxa 100 +setp j15.limit3.maxv 5 +setp j15.limit3.min -10 +net j15-enable joint.15.amp-enable-out => J15_pid.enable +net j15-home-sw J15_switch.home-sw => joint.15.home-sw-in +net j15-homed joint.15.homed => j15.limit3.enable +net j15-pid-output J15_pid.output => J15_mux.in1 +net j15-out j15.limit3.out => joint.15.posthome-cmd +net j15-pos-cmd joint.15.motor-pos-cmd => J15_pid.command +net j15-pos-fb J15_mux.out => J15_mux.in0 J15_switch.cur-pos J15_vel.in joint.15.motor-pos-fb +net j15-vel J15_vel.out => J15_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/extrajoints/12extrajoints.ini b/configs/sim/axis/extrajoints/12extrajoints.ini index ff8f8f02c39..c564cfc22c4 100644 --- a/configs/sim/axis/extrajoints/12extrajoints.ini +++ b/configs/sim/axis/extrajoints/12extrajoints.ini @@ -23,9 +23,7 @@ EMCMOT = motmod num_extrajoints=12 SERVO_PERIOD = 1000000 [HAL] -TWOPASS = on -HALFILE = LIB:basic_sim.tcl -HALFILE = ./extrajoints.tcl +HALFILE = ./12extrajoints.hal HALUI = halui [DISPLAY] diff --git a/configs/sim/axis/extrajoints/2extrajoints.ini b/configs/sim/axis/extrajoints/2extrajoints.ini index fee8ff15c41..3ab185bbbe5 100644 --- a/configs/sim/axis/extrajoints/2extrajoints.ini +++ b/configs/sim/axis/extrajoints/2extrajoints.ini @@ -29,7 +29,7 @@ EMCMOT = motmod num_extrajoints=2 SERVO_PERIOD = 1000000 [HAL] -HALFILE = LIB:basic_sim.tcl +HALFILE = ./2extrajoints_core.hal HALFILE = ./2extrajoints.hal HALUI = halui diff --git a/configs/sim/axis/extrajoints/2extrajoints_core.hal b/configs/sim/axis/extrajoints/2extrajoints_core.hal new file mode 100644 index 00000000000..49eb94cad79 --- /dev/null +++ b/configs/sim/axis/extrajoints/2extrajoints_core.hal @@ -0,0 +1,161 @@ +# HAL setup for the two-extra-joints demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=XYYZ kinstype=both +loadrt motmod num_extrajoints=2 base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +setp J3_switch.home-pos 0.1 +setp J3_switch.hysteresis 0.05 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in hyp_xyz.in2 + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +setp J4_switch.home-pos 0.1 +setp J4_switch.hysteresis 0.05 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +setp J5_switch.home-pos 0.1 +setp J5_switch.hysteresis 0.05 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/foam/axis_foam.hal b/configs/sim/axis/foam/axis_foam.hal new file mode 100644 index 00000000000..487e534db66 --- /dev/null +++ b/configs/sim/axis/foam/axis_foam.hal @@ -0,0 +1,121 @@ +# Core HAL setup for the simulated foam-cutting machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyuv +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=4 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/foam/axis_foam.ini b/configs/sim/axis/foam/axis_foam.ini index db93a5f2849..6109588bb71 100644 --- a/configs/sim/axis/foam/axis_foam.ini +++ b/configs/sim/axis/foam/axis_foam.ini @@ -42,7 +42,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./axis_foam.hal [TRAJ] NO_FORCE_HOMING = 1 diff --git a/configs/sim/axis/geometry/xyzc.hal b/configs/sim/axis/geometry/xyzc.hal new file mode 100644 index 00000000000..45525f1ff34 --- /dev/null +++ b/configs/sim/axis/geometry/xyzc.hal @@ -0,0 +1,124 @@ +# Core HAL setup for the XYZC offset-rotation demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=XYZC kinstype=both +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=4 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/geometry/xyzc.ini b/configs/sim/axis/geometry/xyzc.ini index 3a6dd4c33e3..ed7ffaa7efb 100644 --- a/configs/sim/axis/geometry/xyzc.ini +++ b/configs/sim/axis/geometry/xyzc.ini @@ -22,7 +22,7 @@ EMCMOT = motmod SERVO_PERIOD = 1000000 [HAL] -HALFILE = LIB:basic_sim.tcl +HALFILE = ./xyzc.hal [KINS] JOINTS = 4 diff --git a/configs/sim/axis/geometry/xyzc_origin.hal b/configs/sim/axis/geometry/xyzc_origin.hal new file mode 100644 index 00000000000..156ba6afe91 --- /dev/null +++ b/configs/sim/axis/geometry/xyzc_origin.hal @@ -0,0 +1,124 @@ +# Core HAL setup for XYZC rotation about the machine origin. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=XYZC kinstype=both +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=4 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/geometry/xyzc_origin.ini b/configs/sim/axis/geometry/xyzc_origin.ini index 5dfbbb6269e..c49a728afb5 100644 --- a/configs/sim/axis/geometry/xyzc_origin.ini +++ b/configs/sim/axis/geometry/xyzc_origin.ini @@ -23,7 +23,7 @@ EMCMOT = motmod SERVO_PERIOD = 1000000 [HAL] -HALFILE = LIB:basic_sim.tcl +HALFILE = ./xyzc_origin.hal [KINS] JOINTS = 4 diff --git a/configs/sim/axis/gladevcp/gladevcp_panel.hal b/configs/sim/axis/gladevcp/gladevcp_panel.hal new file mode 100644 index 00000000000..4c03fc7258b --- /dev/null +++ b/configs/sim/axis/gladevcp/gladevcp_panel.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the GladeVCP panel demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/gladevcp/gladevcp_panel.ini b/configs/sim/axis/gladevcp/gladevcp_panel.ini index a8f477b8ade..f914669c18e 100644 --- a/configs/sim/axis/gladevcp/gladevcp_panel.ini +++ b/configs/sim/axis/gladevcp/gladevcp_panel.ini @@ -45,7 +45,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./gladevcp_panel.hal POSTGUI_HALFILE= manual-example.hal [TRAJ] diff --git a/configs/sim/axis/gladevcp/gladevcp_panel_tester.hal b/configs/sim/axis/gladevcp/gladevcp_panel_tester.hal new file mode 100644 index 00000000000..41b042a02fe --- /dev/null +++ b/configs/sim/axis/gladevcp/gladevcp_panel_tester.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the GladeVCP panel test configuration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/gladevcp/gladevcp_panel_tester.ini b/configs/sim/axis/gladevcp/gladevcp_panel_tester.ini index 26b292677c7..f7b224128c8 100644 --- a/configs/sim/axis/gladevcp/gladevcp_panel_tester.ini +++ b/configs/sim/axis/gladevcp/gladevcp_panel_tester.ini @@ -45,7 +45,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./gladevcp_panel_tester.hal #POSTGUI_HALFILE= manual-example.hal [TRAJ] diff --git a/configs/sim/axis/gladevcp/gladevcp_tab.hal b/configs/sim/axis/gladevcp/gladevcp_tab.hal new file mode 100644 index 00000000000..0f4f6f163ca --- /dev/null +++ b/configs/sim/axis/gladevcp/gladevcp_tab.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the GladeVCP tab demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/gladevcp/gladevcp_tab.ini b/configs/sim/axis/gladevcp/gladevcp_tab.ini index 4395c542d52..04c4ce5d7a8 100644 --- a/configs/sim/axis/gladevcp/gladevcp_tab.ini +++ b/configs/sim/axis/gladevcp/gladevcp_tab.ini @@ -49,7 +49,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./gladevcp_tab.hal POSTGUI_HALFILE = manual-example.hal [TRAJ] diff --git a/configs/sim/axis/gladevcp/probe.ini b/configs/sim/axis/gladevcp/probe.ini index 635f6424b62..a77f10d0bab 100644 --- a/configs/sim/axis/gladevcp/probe.ini +++ b/configs/sim/axis/gladevcp/probe.ini @@ -47,7 +47,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./probe_core.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/gladevcp/probe_core.hal b/configs/sim/axis/gladevcp/probe_core.hal new file mode 100644 index 00000000000..61d131d95cd --- /dev/null +++ b/configs/sim/axis/gladevcp/probe_core.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the GladeVCP probing demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/gladevcp/set-param-from-ini.hal b/configs/sim/axis/gladevcp/set-param-from-ini.hal new file mode 100644 index 00000000000..1d145768862 --- /dev/null +++ b/configs/sim/axis/gladevcp/set-param-from-ini.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the INI-to-HAL parameter demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/gladevcp/set-param-from-ini.ini b/configs/sim/axis/gladevcp/set-param-from-ini.ini index 43da20df92f..51a9991f456 100644 --- a/configs/sim/axis/gladevcp/set-param-from-ini.ini +++ b/configs/sim/axis/gladevcp/set-param-from-ini.ini @@ -45,7 +45,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./set-param-from-ini.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/histogram_demo.hal b/configs/sim/axis/histogram_demo.hal new file mode 100644 index 00000000000..1e699de9e3c --- /dev/null +++ b/configs/sim/axis/histogram_demo.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the histogram demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/histogram_demo.ini b/configs/sim/axis/histogram_demo.ini index 615f01859fe..8f4f8c66a8f 100644 --- a/configs/sim/axis/histogram_demo.ini +++ b/configs/sim/axis/histogram_demo.ini @@ -46,7 +46,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./histogram_demo.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/ini_hal_demo.hal b/configs/sim/axis/ini_hal_demo.hal new file mode 100644 index 00000000000..751f5eacda6 --- /dev/null +++ b/configs/sim/axis/ini_hal_demo.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the INI and HAL integration demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyz kinstype=both +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ini_hal_demo.ini b/configs/sim/axis/ini_hal_demo.ini index 75c5992b7f9..2f65b20d35d 100644 --- a/configs/sim/axis/ini_hal_demo.ini +++ b/configs/sim/axis/ini_hal_demo.ini @@ -48,7 +48,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui - HALFILE = LIB:basic_sim.tcl + HALFILE = ./ini_hal_demo.hal POSTGUI_HALFILE = postgui_calib_helper.hal [TRAJ] diff --git a/configs/sim/axis/ini_with_includes/hal.hal b/configs/sim/axis/ini_with_includes/hal.hal new file mode 100644 index 00000000000..d52cc0daace --- /dev/null +++ b/configs/sim/axis/ini_with_includes/hal.hal @@ -0,0 +1,110 @@ +# Core HAL setup for the INI include demonstration. +# This file is included by includes_demo.ini through hal.inc. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ini_with_includes/hal.inc b/configs/sim/axis/ini_with_includes/hal.inc index f627913c476..08af6e69c29 100644 --- a/configs/sim/axis/ini_with_includes/hal.inc +++ b/configs/sim/axis/ini_with_includes/hal.inc @@ -4,5 +4,5 @@ # # list of hal config files to run through halcmd # files are executed in the order in which they appear -HALFILE = LIB:basic_sim.tcl +HALFILE = ./hal.hal HALUI = halui diff --git a/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyyzb.hal b/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyyzb.hal new file mode 100644 index 00000000000..e86c8e640b7 --- /dev/null +++ b/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyyzb.hal @@ -0,0 +1,172 @@ +# HAL setup for the XYYZB locking-indexer kinematics test. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyyzb kinstype=both +loadrt motmod unlock_joints_mask=0x10 base_period_nsec=0 servo_period_nsec=1000000 num_joints=5 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +setp J3_switch.home-pos 0.1 +setp J3_switch.hysteresis 0.05 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in hyp_xyz.in2 + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +# wheel jogging +setp axis.a.jog-enable TRUE +setp axis.a.jog-scale 0.1 +setp axis.b.jog-enable TRUE +setp axis.b.jog-scale 0.1 +setp axis.c.jog-enable TRUE +setp axis.c.jog-scale 0.1 +setp axis.u.jog-enable TRUE +setp axis.u.jog-scale 0.1 +setp axis.v.jog-enable TRUE +setp axis.v.jog-scale 0.1 +setp axis.w.jog-enable TRUE +setp axis.w.jog-scale 0.1 +setp axis.x.jog-enable TRUE +setp axis.x.jog-scale 0.1 +setp axis.y.jog-enable TRUE +setp axis.y.jog-scale 0.1 +setp axis.z.jog-enable TRUE +setp axis.z.jog-scale 0.1 +setp joint.0.jog-enable TRUE +setp joint.0.jog-scale 0.1 +setp joint.1.jog-enable TRUE +setp joint.1.jog-scale 0.1 +setp joint.2.jog-enable TRUE +setp joint.2.jog-scale 0.1 +setp joint.3.jog-enable TRUE +setp joint.3.jog-scale 0.1 +setp joint.4.jog-enable TRUE +setp joint.4.jog-scale 0.1 diff --git a/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyyzb.ini b/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyyzb.ini index bce8ab912bc..8856ed6cd34 100644 --- a/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyyzb.ini +++ b/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyyzb.ini @@ -21,8 +21,7 @@ KINEMATICS = trivkins coordinates=xyyzb kinstype=both [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -HALFILE = LIB:wheeljogpins.tcl 0.1 +HALFILE = ./xyyzb.hal # simulate a locking rotary joint4 HALCMD = loadrt timedelay names=timedelay_unlock diff --git a/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyzb.ini b/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyzb.ini index 8cc06b086f2..5df3f6e806a 100644 --- a/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyzb.ini +++ b/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyzb.ini @@ -14,8 +14,7 @@ KINEMATICS = trivkins coordinates=xyzb [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -HALFILE = LIB:wheeljogpins.tcl 0.1 +HALFILE = ./xyzb_core.hal # simulate a locking rotary joint3 HALCMD = loadrt timedelay names=timedelay_unlock diff --git a/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyzb_core.hal b/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyzb_core.hal new file mode 100644 index 00000000000..11f1be035e9 --- /dev/null +++ b/configs/sim/axis/ja_tests/xyzb_locking_indexer/xyzb_core.hal @@ -0,0 +1,153 @@ +# HAL setup for the XYZB locking-indexer kinematics test. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyzb +loadrt motmod unlock_joints_mask=0x08 base_period_nsec=0 servo_period_nsec=1000000 num_joints=4 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +# wheel jogging +setp axis.a.jog-enable TRUE +setp axis.a.jog-scale 0.1 +setp axis.b.jog-enable TRUE +setp axis.b.jog-scale 0.1 +setp axis.c.jog-enable TRUE +setp axis.c.jog-scale 0.1 +setp axis.u.jog-enable TRUE +setp axis.u.jog-scale 0.1 +setp axis.v.jog-enable TRUE +setp axis.v.jog-scale 0.1 +setp axis.w.jog-enable TRUE +setp axis.w.jog-scale 0.1 +setp axis.x.jog-enable TRUE +setp axis.x.jog-scale 0.1 +setp axis.y.jog-enable TRUE +setp axis.y.jog-scale 0.1 +setp axis.z.jog-enable TRUE +setp axis.z.jog-scale 0.1 +setp joint.0.jog-enable TRUE +setp joint.0.jog-scale 0.1 +setp joint.1.jog-enable TRUE +setp joint.1.jog-scale 0.1 +setp joint.2.jog-enable TRUE +setp joint.2.jog-scale 0.1 +setp joint.3.jog-enable TRUE +setp joint.3.jog-scale 0.1 diff --git a/configs/sim/axis/ja_tests/xyzx_mpg/README b/configs/sim/axis/ja_tests/xyzx_mpg/README index 2f41912fa36..b918c6570ca 100644 --- a/configs/sim/axis/ja_tests/xyzx_mpg/README +++ b/configs/sim/axis/ja_tests/xyzx_mpg/README @@ -54,12 +54,11 @@ a) For simplicity, the configs connect: b) The configs use [KINS]AUTOTELEOP= to automatically switch to teleop mode after homing. -c) The LIB:xhc-hb04.tcl script handles configurations - with known kinematics -- trivkins for the configs - provided here. +c) The flat xyzx-xhc-hb04.hal file provides pendant connections + for the trivkins configuration provided here. -d) For a machine configured as xyzx, the 0,1,2 --> x,y,z - connections are handled automatically by LIB:xhc-hb04.tcl. +d) For a machine configured as xyzx, the 0,1,2 => x,y,z + connections are included in xyzx-xhc-hb04.hal. Additional hal connections to allow jogging joint_3 are done in a postgui hal file (xhc-hb04-postgui.hal). diff --git a/configs/sim/axis/ja_tests/xyzx_mpg/xhc-hb04-postgui.hal b/configs/sim/axis/ja_tests/xyzx_mpg/xhc-hb04-postgui.hal index 7cdc60ffaed..e358d4c4878 100644 --- a/configs/sim/axis/ja_tests/xyzx_mpg/xhc-hb04-postgui.hal +++ b/configs/sim/axis/ja_tests/xyzx_mpg/xhc-hb04-postgui.hal @@ -2,18 +2,18 @@ # using the fourth xhc-hb04 rotary switch position (labeled 'a') # connect to existing signals: -net pendant:jog-scale => joint.3.jog-scale -net pendant:wheel-counts => pendant_util.in3 +net pendant-jog-scale => joint.3.jog-scale +net pendant-wheel-counts => pendant_util.in3 -# make new signals and connections for optionalj3 jogging: -net optionalj3:enable <= xhc-hb04.jog.enable-a -net optionalj3:enable => joint.3.jog-enable +# make new signals and connections for optional joint 3 jogging: +net optional-j3-enable <= xhc-hb04.jog.enable-a +net optional-j3-enable => joint.3.jog-enable -net optionalj3:filtered <= pendant_util.out3 -net optionalj3:filtered => joint.3.jog-counts +net optional-j3-filtered <= pendant_util.out3 +net optional-j3-filtered => joint.3.jog-counts -# scale3 value is: kvalue * scale_for_rotary_switch_a -# kvalue=100 is a constant defined in xhc-hb04.tcl -# scale_for_rotary_switch_a=1 defined in xhc-hb04.inc +# scale3 = kvalue * scale for the fourth rotary switch position +# kvalue=100 is set by pendant_util.k in xyzx-xhc-hb04.hal +# the fourth-position scale factor is 1 setp pendant_util.scale3 100 diff --git a/configs/sim/axis/ja_tests/xyzx_mpg/xhc-hb04.inc b/configs/sim/axis/ja_tests/xyzx_mpg/xhc-hb04.inc index 4313de461ea..3b2ec7ebf65 100644 --- a/configs/sim/axis/ja_tests/xyzx_mpg/xhc-hb04.inc +++ b/configs/sim/axis/ja_tests/xyzx_mpg/xhc-hb04.inc @@ -1,77 +1,3 @@ -[XHC_HB04_CONFIG] -# specify layout = n for LIB:xhc-hb04-layout{n}.cfg files -layout = 2 -# coords: specify upto 4 letters from set {x y z a b c u v w} -# coords: switch labels are xyza but any unique 4 letters -# from the set {xyxabcuvw} can be used (if the coord exists) -coords = x y z -# lowpass settings: -# coef: slows rate of change of output, range: 0 < coef < 1 -coefs = 1 1 1 1 -# scale plus or minus, rotaries may require larger scale factor: -scales = 1 1 1 1 -# jogmode normal(default) or vnormal -jogmode = normal -# sequence 1: 0.001,0.010,0.100,1.000 (mm-based machine) -# sequence 2: 0.001,0.005,0.010,0.020 (inch-based machine) -# sequence 3: 0.001,0.010,0.100 -# sequence 4: 0.001,0.005,0.010,0.020,0.050,0.100 -# sequence 5: 0.001,0.010,0.050,0.100,1.000 -sequence = 2 -# require_pendant = no: create xhc-hb04 hal pins when pendant not -# connected at startup -require_pendant = no -# inch_or_mm = in | mm -inch_or_mm = in -# mpg_accels: provision for reduced acceleration for manual mode jogging -mpg_accels = 20 20 20 20 - -[XHC_HB04_BUTTONS] -# use button names according to layout file LIB:xhc-hb04-layout{n}.cfg -# note: "start_pause" is connected for standard behavior -# controlling halui.pause/halui.resume/halui.run -# these are examples, edit as required: - -goto_zero = halui.mdi-command-00 -# synthesized per-axis buttons for goto-zero button: -goto_zero_x = "" -goto_zero_y = "" -goto_zero_z = "" -goto_zero_a = "" - -start_pause = std_start_pause -rewind = halui.program.step -# probe-input for simulating a probe: -probe_z = motion.probe-input -macro_3 = halui.mdi-command-03 - -half = halui.spindle.0.stop -# synthesized per-axis buttons for half button: -half_x = "" -half_y = "" -half_z = "" -half_a = "" - -zero = "" -# synthesized per-axis buttons for zero button: -zero_x = halui.mdi-command-12 -zero_y = halui.mdi-command-13 -zero_z = halui.mdi-command-14 -zero_a = halui.mdi-command-15 - -safe_z = halui.mdi-command-10 -# in this sim, home-all only works first time, hold down till finished: -home = halui.home-all -macro_1 = halui.mdi-command-01 -macro_2 = halui.mdi-command-02 -spindle = halui.spindle.0.start -step = xhc-hb04.stepsize-up -mode = "" -macro_6 = halui.mdi-command-06 -macro_7 = halui.mdi-command-07 -stop = halui.program.stop -reset = halui.estop.activate - [HALUI] # these are examples, edit as required: # a halui hal pin is created for each MDI_COMMAND below diff --git a/configs/sim/axis/ja_tests/xyzx_mpg/xyzx-xhc-hb04.hal b/configs/sim/axis/ja_tests/xyzx_mpg/xyzx-xhc-hb04.hal new file mode 100644 index 00000000000..eb31ab68df5 --- /dev/null +++ b/configs/sim/axis/ja_tests/xyzx_mpg/xyzx-xhc-hb04.hal @@ -0,0 +1,200 @@ +# HAL setup for the XYZX machine with XHC-HB04 pendant control. +# Optional joint 3 jogging connections are in xhc-hb04-postgui.hal. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +# user space components +loadusr -W hal_manualtoolchange +loadusr -W xhc-hb04 -s 2 -I $(HALLIB_DIR)/xhc-hb04-layout2.cfg -H + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyzx kinstype=BOTH +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=4 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt xhc_hb04_util names=pendant_util +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread +addf pendant_util servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +setp J3_switch.home-pos 0.1 +setp J3_switch.hysteresis 0.05 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in hyp_xy.in0 hyp_xyz.in0 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# pendant +setp axis.x.jog-accel-fraction 0.1 +setp axis.y.jog-accel-fraction 0.1 +setp axis.z.jog-accel-fraction 0.1 +setp halui.feed-override.scale 0.01 +setp halui.spindle.0.override.scale 0.01 +setp joint.0.jog-accel-fraction 0.1 +setp joint.1.jog-accel-fraction 0.1 +setp joint.2.jog-accel-fraction 0.1 +setp pendant_util.coef0 1 +setp pendant_util.coef1 1 +setp pendant_util.coef2 1 +setp pendant_util.coef3 1 +setp pendant_util.in3 0 +setp pendant_util.k 100 +setp pendant_util.scale0 100 +setp pendant_util.scale1 100 +setp pendant_util.scale2 100 +setp pendant_util.scale3 1 +setp xhc-hb04.inch-icon TRUE +net pendant-feed-override halui.feed-override.value => xhc-hb04.feed-override +net pendant-feed-override-enable xhc-hb04.jog.enable-feed-override => halui.feed-override.count-enable +net pendant-feed-value motion.current-vel => xhc-hb04.feed-value +net pendant-goto-zero xhc-hb04.button-goto-zero => halui.mdi-command-00 +net pendant-half xhc-hb04.button-half => halui.spindle.0.stop +net pendant-home xhc-hb04.button-home => halui.home-all +net pendant-is-idle halui.program.is-idle => pendant_util.is-idle +net pendant-is-paused halui.program.is-paused => pendant_util.is-paused +net pendant-is-running halui.program.is-running => pendant_util.is-running +net pendant-jog-prescale xhc-hb04.jog.scale => pendant_util.divide-by-k-in +net pendant-jog-scale pendant_util.divide-by-k-out => axis.x.jog-scale axis.y.jog-scale axis.z.jog-scale joint.0.jog-scale joint.1.jog-scale joint.2.jog-scale +net pendant-jog-x xhc-hb04.jog.enable-x => axis.x.jog-enable joint.0.jog-enable +net pendant-jog-y xhc-hb04.jog.enable-y => axis.y.jog-enable joint.1.jog-enable +net pendant-jog-z xhc-hb04.jog.enable-z => axis.z.jog-enable joint.2.jog-enable +net pendant-macro-1 xhc-hb04.button-macro-1 => halui.mdi-command-01 +net pendant-macro-2 xhc-hb04.button-macro-2 => halui.mdi-command-02 +net pendant-macro-3 xhc-hb04.button-macro-3 => halui.mdi-command-03 +net pendant-macro-6 xhc-hb04.button-macro-6 => halui.mdi-command-06 +net pendant-macro-7 xhc-hb04.button-macro-7 => halui.mdi-command-07 +net pendant-pos-rel-x halui.axis.x.pos-relative => xhc-hb04.x.pos-relative +net pendant-pos-rel-y halui.axis.y.pos-relative => xhc-hb04.y.pos-relative +net pendant-pos-rel-z halui.axis.z.pos-relative => xhc-hb04.z.pos-relative +net pendant-pos-x halui.axis.x.pos-feedback => xhc-hb04.x.pos-absolute +net pendant-pos-y halui.axis.y.pos-feedback => xhc-hb04.y.pos-absolute +net pendant-pos-z halui.axis.z.pos-feedback => xhc-hb04.z.pos-absolute +net pendant-probe-z xhc-hb04.button-probe-z => motion.probe-input +net pendant-program-pause pendant_util.pause => halui.program.pause +net pendant-program-resume pendant_util.resume => halui.program.resume +net pendant-program-run pendant_util.run => halui.mode.auto halui.program.run +net pendant-reset xhc-hb04.button-reset => halui.estop.activate +net pendant-rewind xhc-hb04.button-rewind => halui.program.step +net pendant-safe-z xhc-hb04.button-safe-z => halui.mdi-command-10 +net pendant-spindle xhc-hb04.button-spindle => halui.spindle.0.start +net pendant-spindle-override halui.spindle.0.override.value => xhc-hb04.spindle-override +net pendant-spindle-override-enable xhc-hb04.jog.enable-spindle-override => halui.spindle.0.override.count-enable +net pendant-spindle-rps spindle.0.speed-out-rps-abs => xhc-hb04.spindle-rps +net pendant-start-or-pause xhc-hb04.button-start-pause => pendant_util.start-or-pause +net pendant-step xhc-hb04.button-step => xhc-hb04.stepsize-up +net pendant-stop xhc-hb04.button-stop => halui.program.stop +net pendant-wheel-counts xhc-hb04.jog.counts => halui.feed-override.counts halui.spindle.0.override.counts pendant_util.in0 pendant_util.in1 pendant_util.in2 +net pendant-wheel-counts-x-filtered pendant_util.out0 => axis.x.jog-counts joint.0.jog-counts +net pendant-wheel-counts-y-filtered pendant_util.out1 => axis.y.jog-counts joint.1.jog-counts +net pendant-wheel-counts-z-filtered pendant_util.out2 => axis.z.jog-counts joint.2.jog-counts +net pendant-zero-a xhc-hb04.button-zero-a => halui.mdi-command-15 +net pendant-zero-x xhc-hb04.button-zero-x => halui.mdi-command-12 +net pendant-zero-y xhc-hb04.button-zero-y => halui.mdi-command-13 +net pendant-zero-z xhc-hb04.button-zero-z => halui.mdi-command-14 + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ja_tests/xyzx_mpg/xyzx-xhc-hb04.ini b/configs/sim/axis/ja_tests/xyzx_mpg/xyzx-xhc-hb04.ini index 8918f2f36ae..0ef31a0613a 100644 --- a/configs/sim/axis/ja_tests/xyzx_mpg/xyzx-xhc-hb04.ini +++ b/configs/sim/axis/ja_tests/xyzx_mpg/xyzx-xhc-hb04.ini @@ -6,8 +6,7 @@ APP = halshow xyzx.halshow [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -HALFILE = LIB:xhc-hb04.tcl +HALFILE = ./xyzx-xhc-hb04.hal # optional, use to support jogging of joint_3: POSTGUI_HALFILE = ./xhc-hb04-postgui.hal diff --git a/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.hal b/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.hal new file mode 100644 index 00000000000..9a9ef2c82b5 --- /dev/null +++ b/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.hal @@ -0,0 +1,127 @@ +# HAL setup for the XYZX machine with MPG jogging. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyzx kinstype=BOTH +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=4 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +setp J3_switch.home-pos 0.1 +setp J3_switch.hysteresis 0.05 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in hyp_xy.in0 hyp_xyz.in0 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.halshow b/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.halshow index 1aff90512bf..273ec672f25 100644 --- a/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.halshow +++ b/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.halshow @@ -1,5 +1,5 @@ pin+motion.teleop-mode -sig+pendant:wheel-counts +sig+pendant-wheel-counts pin+joint.0.jog-enable pin+joint.1.jog-enable diff --git a/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.ini b/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.ini index 997ab73cc95..241e467bc24 100644 --- a/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.ini +++ b/configs/sim/axis/ja_tests/xyzx_mpg/xyzx.ini @@ -12,6 +12,6 @@ APP = halshow xyzx.halshow [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./xyzx.hal HALFILE = ./xyzx_jog.hal diff --git a/configs/sim/axis/ja_tests/xz/xz.hal b/configs/sim/axis/ja_tests/xz/xz.hal new file mode 100644 index 00000000000..06a6868bcb8 --- /dev/null +++ b/configs/sim/axis/ja_tests/xz/xz.hal @@ -0,0 +1,89 @@ +# HAL setup for the XZ identity-kinematics test. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ja_tests/xz/xz.ini b/configs/sim/axis/ja_tests/xz/xz.ini index 27bc8ccbd63..76b0f140882 100644 --- a/configs/sim/axis/ja_tests/xz/xz.ini +++ b/configs/sim/axis/ja_tests/xz/xz.ini @@ -10,3 +10,6 @@ DEBUG = 0 # trivkins with no kinstype defaults to KINEMATICS_IDENTITY KINEMATICS = trivkins coordinates=xz JOINTS = 2 + +[HAL] +HALFILE = ./xz.hal diff --git a/configs/sim/axis/ja_tests/xz/xz_both.hal b/configs/sim/axis/ja_tests/xz/xz_both.hal new file mode 100644 index 00000000000..f740d81aae6 --- /dev/null +++ b/configs/sim/axis/ja_tests/xz/xz_both.hal @@ -0,0 +1,89 @@ +# HAL setup for the XZ joint/axis kinematics test. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xz kinstype=BOTH +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ja_tests/xz/xz_both.ini b/configs/sim/axis/ja_tests/xz/xz_both.ini index 13ca0e698df..fd48f92b7fa 100644 --- a/configs/sim/axis/ja_tests/xz/xz_both.ini +++ b/configs/sim/axis/ja_tests/xz/xz_both.ini @@ -9,3 +9,6 @@ DEBUG = 0 # Note: coordinates must agree with [TRAJ]COORDINATES KINEMATICS = trivkins coordinates=xz kinstype=BOTH JOINTS = 2 + +[HAL] +HALFILE = ./xz_both.hal diff --git a/configs/sim/axis/ja_tests/xz/xz_both_auto.ini b/configs/sim/axis/ja_tests/xz/xz_both_auto.ini index 1c31bef5771..2923893694d 100644 --- a/configs/sim/axis/ja_tests/xz/xz_both_auto.ini +++ b/configs/sim/axis/ja_tests/xz/xz_both_auto.ini @@ -9,3 +9,6 @@ DEBUG = 0 # Note: coordinates must agree with [TRAJ]COORDINATES KINEMATICS = trivkins coordinates=xz kinstype=BOTH JOINTS = 2 + +[HAL] +HALFILE = ./xz_both.hal diff --git a/configs/sim/axis/ja_tests/xz/xzbase.inc b/configs/sim/axis/ja_tests/xz/xzbase.inc index 0ed6ec2841a..6b94c24399b 100644 --- a/configs/sim/axis/ja_tests/xz/xzbase.inc +++ b/configs/sim/axis/ja_tests/xz/xzbase.inc @@ -1,5 +1,4 @@ [HAL] -HALFILE = LIB:basic_sim.tcl HALUI = halui [TRAJ] @@ -40,7 +39,7 @@ PARAMETER_FILE = xz.var [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 - BASE_PERIOD = 50000 + BASE_PERIOD = 0 SERVO_PERIOD = 1000000 [TASK] diff --git a/configs/sim/axis/laser/laser.hal b/configs/sim/axis/laser/laser.hal index 8d8bffe10bf..a66b74128a5 100644 --- a/configs/sim/axis/laser/laser.hal +++ b/configs/sim/axis/laser/laser.hal @@ -62,7 +62,7 @@ net laser.motion.req-vel <= motion.requested-vel net laser.motion.req-vel => laser.control.req-velocity #rastering controller -net J0:pos-fb => laser.raster.position +net j0-pos-fb => laser.raster.position net laser.raster.program-sig <= laser.raster.program sets laser.raster.program-sig 20000 diff --git a/configs/sim/axis/laser/laser.ini b/configs/sim/axis/laser/laser.ini index 9ca8259791b..ce19cc44d59 100644 --- a/configs/sim/axis/laser/laser.ini +++ b/configs/sim/axis/laser/laser.ini @@ -14,7 +14,7 @@ ANGULAR_UNITS = degree [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./laser_core.hal HALFILE = laser.hal POSTGUI_HALFILE = postgui.hal diff --git a/configs/sim/axis/laser/laser_core.hal b/configs/sim/axis/laser/laser_core.hal new file mode 100644 index 00000000000..d1dbc0d4ddb --- /dev/null +++ b/configs/sim/axis/laser/laser_core.hal @@ -0,0 +1,102 @@ +# Core HAL setup for the simulated laser machine. +# Laser control and raster connections are in laser.hal. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt corexykins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/lathe-fanucy/lathe-fanucy.hal b/configs/sim/axis/lathe-fanucy/lathe-fanucy.hal new file mode 100644 index 00000000000..c2b7ba7db41 --- /dev/null +++ b/configs/sim/axis/lathe-fanucy/lathe-fanucy.hal @@ -0,0 +1,89 @@ +# Core HAL setup for the simulated Fanuc-style lathe. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/lathe-fanucy/lathe-fanucy.ini b/configs/sim/axis/lathe-fanucy/lathe-fanucy.ini index fc4c7fa987c..da0479a61ee 100644 --- a/configs/sim/axis/lathe-fanucy/lathe-fanucy.ini +++ b/configs/sim/axis/lathe-fanucy/lathe-fanucy.ini @@ -32,7 +32,7 @@ SUBROUTINE_PATH = ./:../ [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 - BASE_PERIOD = 50000 + BASE_PERIOD = 0 SERVO_PERIOD = 1000000 [TASK] @@ -40,7 +40,7 @@ SERVO_PERIOD = 1000000 CYCLE_TIME = 0.001 [HAL] -HALFILE = LIB:basic_sim.tcl +HALFILE = ./lathe-fanucy.hal [TRAJ] COORDINATES = X Z diff --git a/configs/sim/axis/lathe.hal b/configs/sim/axis/lathe.hal new file mode 100644 index 00000000000..c5689b532c1 --- /dev/null +++ b/configs/sim/axis/lathe.hal @@ -0,0 +1,89 @@ +# Core HAL setup for the simulated XZ lathe. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/lathe.ini b/configs/sim/axis/lathe.ini index dcbfba03341..6891d2cea8f 100644 --- a/configs/sim/axis/lathe.ini +++ b/configs/sim/axis/lathe.ini @@ -32,7 +32,7 @@ PARAMETER_FILE = sim-lathe.var [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 - BASE_PERIOD = 50000 + BASE_PERIOD = 0 SERVO_PERIOD = 1000000 [TASK] @@ -41,7 +41,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui - HALFILE = LIB:basic_sim.tcl + HALFILE = ./lathe.hal POSTGUI_HALFILE = lathe_postgui.hal [TRAJ] diff --git a/configs/sim/axis/minimal_xyz.hal b/configs/sim/axis/minimal_xyz.hal new file mode 100644 index 00000000000..92d3ace460f --- /dev/null +++ b/configs/sim/axis/minimal_xyz.hal @@ -0,0 +1,110 @@ +# Core HAL setup for a minimal simulated XYZ machine. +# Includes motion, joints, home switches, spindle, and manual tool change. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=XYZ +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/minimal_xyz.ini b/configs/sim/axis/minimal_xyz.ini index f2a62738974..c2349d75d41 100644 --- a/configs/sim/axis/minimal_xyz.ini +++ b/configs/sim/axis/minimal_xyz.ini @@ -18,7 +18,7 @@ EMCMOT = motmod SERVO_PERIOD = 1000000 [HAL] -HALFILE = LIB:basic_sim.tcl +HALFILE = ./minimal_xyz.hal # NOTE: Must have consistent values for # [TRAJ]COORDINATES = LETTERS diff --git a/configs/sim/axis/moveoff/1_onpause_local.hal b/configs/sim/axis/moveoff/1_onpause_local.hal new file mode 100644 index 00000000000..37cb3bf2889 --- /dev/null +++ b/configs/sim/axis/moveoff/1_onpause_local.hal @@ -0,0 +1,137 @@ +# HAL setup for local moveoff offsets while paused. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt moveoff personality=3 names=mv +# realtime thread/function links +addf mv.read-inputs servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf mv.write-outputs servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +net hu:fb-0 J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in mv.fb-0 +net hu:fb-1 J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in mv.fb-1 +net hu:fb-2 J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in mv.fb-2 +net hu:minus-0 mv.fb-minusoffset-0 => joint.0.motor-pos-fb +net hu:minus-1 mv.fb-minusoffset-1 => joint.1.motor-pos-fb +net hu:minus-2 mv.fb-minusoffset-2 => joint.2.motor-pos-fb +net hu:plus-0 mv.pos-plusoffset-0 => J0_pid.command +net hu:plus-1 mv.pos-plusoffset-1 => J1_pid.command +net hu:plus-2 mv.pos-plusoffset-2 => J2_pid.command +net hu:pos-0 joint.0.motor-pos-cmd => mv.pos-0 +net hu:pos-1 joint.1.motor-pos-cmd => mv.pos-1 +net hu:pos-2 joint.2.motor-pos-cmd => mv.pos-2 + +# moveoff settings +setp mv.epsilon 0.001 +setp mv.offset-accel-0 60 +setp mv.offset-accel-1 60 +setp mv.offset-accel-2 60 +setp mv.offset-max-0 10 +setp mv.offset-max-1 10 +setp mv.offset-max-2 10 +setp mv.offset-min-0 -10 +setp mv.offset-min-1 -10 +setp mv.offset-min-2 -10 +setp mv.offset-vel-0 6 +setp mv.offset-vel-1 6 +setp mv.offset-vel-2 6 +setp mv.waypoint-sample-secs 0.05 +setp mv.waypoint-threshold 0.05 diff --git a/configs/sim/axis/moveoff/1_onpause_local.ini b/configs/sim/axis/moveoff/1_onpause_local.ini index b6cf30a605a..ae8b68dfc73 100644 --- a/configs/sim/axis/moveoff/1_onpause_local.ini +++ b/configs/sim/axis/moveoff/1_onpause_local.ini @@ -8,10 +8,9 @@ MACHINE = moveoff,onpause,local [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./1_onpause_local.hal # hookup a moveoff component: -HALFILE = LIB:hookup_moveoff.tcl [APPLICATIONS] APP = moveoff_gui \ diff --git a/configs/sim/axis/moveoff/2_onpause_external.hal b/configs/sim/axis/moveoff/2_onpause_external.hal new file mode 100644 index 00000000000..265a7c7f288 --- /dev/null +++ b/configs/sim/axis/moveoff/2_onpause_external.hal @@ -0,0 +1,142 @@ +# HAL setup for external moveoff offsets while paused. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt moveoff personality=3 names=mv +# realtime thread/function links +addf mv.read-inputs servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf mv.write-outputs servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +net external_backtrack_en mv.backtrack-enable +net external_enable mv.move-enable +net external_offset_0 mv.offset-in-0 +net external_offset_1 mv.offset-in-1 +net external_offset_2 mv.offset-in-2 +net hu:fb-0 J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in mv.fb-0 +net hu:fb-1 J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in mv.fb-1 +net hu:fb-2 J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in mv.fb-2 +net hu:minus-0 mv.fb-minusoffset-0 => joint.0.motor-pos-fb +net hu:minus-1 mv.fb-minusoffset-1 => joint.1.motor-pos-fb +net hu:minus-2 mv.fb-minusoffset-2 => joint.2.motor-pos-fb +net hu:plus-0 mv.pos-plusoffset-0 => J0_pid.command +net hu:plus-1 mv.pos-plusoffset-1 => J1_pid.command +net hu:plus-2 mv.pos-plusoffset-2 => J2_pid.command +net hu:pos-0 joint.0.motor-pos-cmd => mv.pos-0 +net hu:pos-1 joint.1.motor-pos-cmd => mv.pos-1 +net hu:pos-2 joint.2.motor-pos-cmd => mv.pos-2 + +# moveoff settings +setp mv.epsilon 0.001 +setp mv.offset-accel-0 60 +setp mv.offset-accel-1 60 +setp mv.offset-accel-2 60 +setp mv.offset-max-0 10 +setp mv.offset-max-1 10 +setp mv.offset-max-2 10 +setp mv.offset-min-0 -10 +setp mv.offset-min-1 -10 +setp mv.offset-min-2 -10 +setp mv.offset-vel-0 6 +setp mv.offset-vel-1 6 +setp mv.offset-vel-2 6 +setp mv.waypoint-sample-secs 0.05 +setp mv.waypoint-threshold 0.05 diff --git a/configs/sim/axis/moveoff/2_onpause_external.ini b/configs/sim/axis/moveoff/2_onpause_external.ini index 46c594a7d8d..7556f4ba295 100644 --- a/configs/sim/axis/moveoff/2_onpause_external.ini +++ b/configs/sim/axis/moveoff/2_onpause_external.ini @@ -8,13 +8,11 @@ MACHINE = moveoff,onpause,external [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./2_onpause_external.hal # hookup a moveoff component: -HALFILE = LIB:hookup_moveoff.tcl # simulate external controls: -HALFILE = LIB:moveoff_external.hal [APPLICATIONS] APP = moveoff_gui \ diff --git a/configs/sim/axis/moveoff/3_always_local.hal b/configs/sim/axis/moveoff/3_always_local.hal new file mode 100644 index 00000000000..7d65a5809c0 --- /dev/null +++ b/configs/sim/axis/moveoff/3_always_local.hal @@ -0,0 +1,137 @@ +# HAL setup for continuously enabled local moveoff offsets. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt moveoff personality=3 names=mv +# realtime thread/function links +addf mv.read-inputs servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf mv.write-outputs servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +net hu:fb-0 J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in mv.fb-0 +net hu:fb-1 J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in mv.fb-1 +net hu:fb-2 J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in mv.fb-2 +net hu:minus-0 mv.fb-minusoffset-0 => joint.0.motor-pos-fb +net hu:minus-1 mv.fb-minusoffset-1 => joint.1.motor-pos-fb +net hu:minus-2 mv.fb-minusoffset-2 => joint.2.motor-pos-fb +net hu:plus-0 mv.pos-plusoffset-0 => J0_pid.command +net hu:plus-1 mv.pos-plusoffset-1 => J1_pid.command +net hu:plus-2 mv.pos-plusoffset-2 => J2_pid.command +net hu:pos-0 joint.0.motor-pos-cmd => mv.pos-0 +net hu:pos-1 joint.1.motor-pos-cmd => mv.pos-1 +net hu:pos-2 joint.2.motor-pos-cmd => mv.pos-2 + +# moveoff settings +setp mv.epsilon 0.001 +setp mv.offset-accel-0 60 +setp mv.offset-accel-1 60 +setp mv.offset-accel-2 60 +setp mv.offset-max-0 10 +setp mv.offset-max-1 10 +setp mv.offset-max-2 10 +setp mv.offset-min-0 -10 +setp mv.offset-min-1 -10 +setp mv.offset-min-2 -10 +setp mv.offset-vel-0 6 +setp mv.offset-vel-1 6 +setp mv.offset-vel-2 6 +setp mv.waypoint-sample-secs 0.05 +setp mv.waypoint-threshold 0.05 diff --git a/configs/sim/axis/moveoff/3_always_local.ini b/configs/sim/axis/moveoff/3_always_local.ini index eedd656d649..77bdca8cd03 100644 --- a/configs/sim/axis/moveoff/3_always_local.ini +++ b/configs/sim/axis/moveoff/3_always_local.ini @@ -8,10 +8,9 @@ MACHINE = moveoff,always,local [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./3_always_local.hal # hookup a moveoff component: -HALFILE = LIB:hookup_moveoff.tcl [APPLICATIONS] APP = moveoff_gui \ diff --git a/configs/sim/axis/moveoff/4_always_external.hal b/configs/sim/axis/moveoff/4_always_external.hal new file mode 100644 index 00000000000..02e73221ff2 --- /dev/null +++ b/configs/sim/axis/moveoff/4_always_external.hal @@ -0,0 +1,142 @@ +# HAL setup for continuously enabled external moveoff offsets. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt moveoff personality=3 names=mv +# realtime thread/function links +addf mv.read-inputs servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf mv.write-outputs servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +net external_backtrack_en mv.backtrack-enable +net external_enable mv.move-enable +net external_offset_0 mv.offset-in-0 +net external_offset_1 mv.offset-in-1 +net external_offset_2 mv.offset-in-2 +net hu:fb-0 J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in mv.fb-0 +net hu:fb-1 J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in mv.fb-1 +net hu:fb-2 J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in mv.fb-2 +net hu:minus-0 mv.fb-minusoffset-0 => joint.0.motor-pos-fb +net hu:minus-1 mv.fb-minusoffset-1 => joint.1.motor-pos-fb +net hu:minus-2 mv.fb-minusoffset-2 => joint.2.motor-pos-fb +net hu:plus-0 mv.pos-plusoffset-0 => J0_pid.command +net hu:plus-1 mv.pos-plusoffset-1 => J1_pid.command +net hu:plus-2 mv.pos-plusoffset-2 => J2_pid.command +net hu:pos-0 joint.0.motor-pos-cmd => mv.pos-0 +net hu:pos-1 joint.1.motor-pos-cmd => mv.pos-1 +net hu:pos-2 joint.2.motor-pos-cmd => mv.pos-2 + +# moveoff settings +setp mv.epsilon 0.001 +setp mv.offset-accel-0 60 +setp mv.offset-accel-1 60 +setp mv.offset-accel-2 60 +setp mv.offset-max-0 10 +setp mv.offset-max-1 10 +setp mv.offset-max-2 10 +setp mv.offset-min-0 -10 +setp mv.offset-min-1 -10 +setp mv.offset-min-2 -10 +setp mv.offset-vel-0 6 +setp mv.offset-vel-1 6 +setp mv.offset-vel-2 6 +setp mv.waypoint-sample-secs 0.05 +setp mv.waypoint-threshold 0.05 diff --git a/configs/sim/axis/moveoff/4_always_external.ini b/configs/sim/axis/moveoff/4_always_external.ini index 635bc49ce4f..d766c766ffc 100644 --- a/configs/sim/axis/moveoff/4_always_external.ini +++ b/configs/sim/axis/moveoff/4_always_external.ini @@ -8,13 +8,11 @@ MACHINE = moveoff,always,external [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./4_always_external.hal # hookup a moveoff component: -HALFILE = LIB:hookup_moveoff.tcl # simulate external controls: -HALFILE = LIB:moveoff_external.hal [APPLICATIONS] APP = moveoff_gui \ diff --git a/configs/sim/axis/moveoff/5_no_gui.hal b/configs/sim/axis/moveoff/5_no_gui.hal new file mode 100644 index 00000000000..2190b5fb222 --- /dev/null +++ b/configs/sim/axis/moveoff/5_no_gui.hal @@ -0,0 +1,137 @@ +# HAL setup for the moveoff demonstration without GUI controls. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt moveoff personality=3 names=mv +# realtime thread/function links +addf mv.read-inputs servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf mv.write-outputs servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +net hu:fb-0 J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in mv.fb-0 +net hu:fb-1 J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in mv.fb-1 +net hu:fb-2 J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in mv.fb-2 +net hu:minus-0 mv.fb-minusoffset-0 => joint.0.motor-pos-fb +net hu:minus-1 mv.fb-minusoffset-1 => joint.1.motor-pos-fb +net hu:minus-2 mv.fb-minusoffset-2 => joint.2.motor-pos-fb +net hu:plus-0 mv.pos-plusoffset-0 => J0_pid.command +net hu:plus-1 mv.pos-plusoffset-1 => J1_pid.command +net hu:plus-2 mv.pos-plusoffset-2 => J2_pid.command +net hu:pos-0 joint.0.motor-pos-cmd => mv.pos-0 +net hu:pos-1 joint.1.motor-pos-cmd => mv.pos-1 +net hu:pos-2 joint.2.motor-pos-cmd => mv.pos-2 + +# moveoff settings +setp mv.epsilon 0.001 +setp mv.offset-accel-0 60 +setp mv.offset-accel-1 60 +setp mv.offset-accel-2 60 +setp mv.offset-max-0 10 +setp mv.offset-max-1 10 +setp mv.offset-max-2 10 +setp mv.offset-min-0 -10 +setp mv.offset-min-1 -10 +setp mv.offset-min-2 -10 +setp mv.offset-vel-0 6 +setp mv.offset-vel-1 6 +setp mv.offset-vel-2 6 +setp mv.waypoint-sample-secs 0.05 +setp mv.waypoint-threshold 0.05 diff --git a/configs/sim/axis/moveoff/5_no_gui.ini b/configs/sim/axis/moveoff/5_no_gui.ini index 45c1ba29823..0ddd6321b51 100644 --- a/configs/sim/axis/moveoff/5_no_gui.ini +++ b/configs/sim/axis/moveoff/5_no_gui.ini @@ -8,8 +8,7 @@ MACHINE = moveoff,no_gui [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -HALFILE = LIB:hookup_moveoff.tcl +HALFILE = ./5_no_gui.hal [APPLICATIONS] APP = halshow ./moveoff.halshow diff --git a/configs/sim/axis/moveoff/6_zretract.hal b/configs/sim/axis/moveoff/6_zretract.hal new file mode 100644 index 00000000000..03db52a05b0 --- /dev/null +++ b/configs/sim/axis/moveoff/6_zretract.hal @@ -0,0 +1,142 @@ +# HAL setup for the moveoff Z-retract demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt moveoff personality=3 names=mv +# realtime thread/function links +addf mv.read-inputs servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf mv.write-outputs servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +net external_backtrack_en mv.backtrack-enable +net external_enable mv.move-enable +net external_offset_0 mv.offset-in-0 +net external_offset_1 mv.offset-in-1 +net external_offset_2 mv.offset-in-2 +net hu:fb-0 J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in mv.fb-0 +net hu:fb-1 J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in mv.fb-1 +net hu:fb-2 J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in mv.fb-2 +net hu:minus-0 mv.fb-minusoffset-0 => joint.0.motor-pos-fb +net hu:minus-1 mv.fb-minusoffset-1 => joint.1.motor-pos-fb +net hu:minus-2 mv.fb-minusoffset-2 => joint.2.motor-pos-fb +net hu:plus-0 mv.pos-plusoffset-0 => J0_pid.command +net hu:plus-1 mv.pos-plusoffset-1 => J1_pid.command +net hu:plus-2 mv.pos-plusoffset-2 => J2_pid.command +net hu:pos-0 joint.0.motor-pos-cmd => mv.pos-0 +net hu:pos-1 joint.1.motor-pos-cmd => mv.pos-1 +net hu:pos-2 joint.2.motor-pos-cmd => mv.pos-2 + +# moveoff settings +setp mv.epsilon 0.001 +setp mv.offset-accel-0 60 +setp mv.offset-accel-1 60 +setp mv.offset-accel-2 60 +setp mv.offset-max-0 10 +setp mv.offset-max-1 10 +setp mv.offset-max-2 10 +setp mv.offset-min-0 -10 +setp mv.offset-min-1 -10 +setp mv.offset-min-2 -10 +setp mv.offset-vel-0 6 +setp mv.offset-vel-1 6 +setp mv.offset-vel-2 6 +setp mv.waypoint-sample-secs 0.05 +setp mv.waypoint-threshold 0.05 diff --git a/configs/sim/axis/moveoff/6_zretract.ini b/configs/sim/axis/moveoff/6_zretract.ini index a26f98bb48b..f77a9cd21b1 100644 --- a/configs/sim/axis/moveoff/6_zretract.ini +++ b/configs/sim/axis/moveoff/6_zretract.ini @@ -8,13 +8,11 @@ MACHINE = moveoff zretract demo [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./6_zretract.hal # hookup a moveoff component: -HALFILE = LIB:hookup_moveoff.tcl # simulate external controls: -HALFILE = LIB:moveoff_external.hal # demonstrate fixed zretract offset = 0.1234 # set offset,accel,velocity for axis 2 (z): diff --git a/configs/sim/axis/moveoff/7_pyvcp.hal b/configs/sim/axis/moveoff/7_pyvcp.hal new file mode 100644 index 00000000000..a5b8d7ab869 --- /dev/null +++ b/configs/sim/axis/moveoff/7_pyvcp.hal @@ -0,0 +1,143 @@ +# HAL setup for the PyVCP moveoff demonstration. +# Display connections are in moveoff_display_7.hal. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt moveoff personality=3 names=mv +# realtime thread/function links +addf mv.read-inputs servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf mv.write-outputs servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +net external_backtrack_en mv.backtrack-enable +net external_enable mv.move-enable +net external_offset_0 mv.offset-in-0 +net external_offset_1 mv.offset-in-1 +net external_offset_2 mv.offset-in-2 +net hu:fb-0 J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in mv.fb-0 +net hu:fb-1 J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in mv.fb-1 +net hu:fb-2 J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in mv.fb-2 +net hu:minus-0 mv.fb-minusoffset-0 => joint.0.motor-pos-fb +net hu:minus-1 mv.fb-minusoffset-1 => joint.1.motor-pos-fb +net hu:minus-2 mv.fb-minusoffset-2 => joint.2.motor-pos-fb +net hu:plus-0 mv.pos-plusoffset-0 => J0_pid.command +net hu:plus-1 mv.pos-plusoffset-1 => J1_pid.command +net hu:plus-2 mv.pos-plusoffset-2 => J2_pid.command +net hu:pos-0 joint.0.motor-pos-cmd => mv.pos-0 +net hu:pos-1 joint.1.motor-pos-cmd => mv.pos-1 +net hu:pos-2 joint.2.motor-pos-cmd => mv.pos-2 + +# moveoff settings +setp mv.epsilon 0.001 +setp mv.offset-accel-0 60 +setp mv.offset-accel-1 60 +setp mv.offset-accel-2 60 +setp mv.offset-max-0 10 +setp mv.offset-max-1 10 +setp mv.offset-max-2 10 +setp mv.offset-min-0 -10 +setp mv.offset-min-1 -10 +setp mv.offset-min-2 -10 +setp mv.offset-vel-0 6 +setp mv.offset-vel-1 6 +setp mv.offset-vel-2 6 +setp mv.waypoint-sample-secs 0.05 +setp mv.waypoint-threshold 0.05 diff --git a/configs/sim/axis/moveoff/7_pyvcp.ini b/configs/sim/axis/moveoff/7_pyvcp.ini index 191a2b7fe17..e2b16292bf9 100644 --- a/configs/sim/axis/moveoff/7_pyvcp.ini +++ b/configs/sim/axis/moveoff/7_pyvcp.ini @@ -8,13 +8,11 @@ MACHINE = moveoff,onpause,external [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./7_pyvcp.hal # hookup a moveoff component: -HALFILE = LIB:hookup_moveoff.tcl # simulate external controls: -HALFILE = LIB:moveoff_external.hal POSTGUI_HALFILE = moveoff_display_7.hal diff --git a/configs/sim/axis/moveoff/8_gladevcp.hal b/configs/sim/axis/moveoff/8_gladevcp.hal new file mode 100644 index 00000000000..ecbda2deab6 --- /dev/null +++ b/configs/sim/axis/moveoff/8_gladevcp.hal @@ -0,0 +1,143 @@ +# HAL setup for the GladeVCP moveoff demonstration. +# Display connections are in moveoff_display_8.hal. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt moveoff personality=3 names=mv +# realtime thread/function links +addf mv.read-inputs servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf mv.write-outputs servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +net external_backtrack_en mv.backtrack-enable +net external_enable mv.move-enable +net external_offset_0 mv.offset-in-0 +net external_offset_1 mv.offset-in-1 +net external_offset_2 mv.offset-in-2 +net hu:fb-0 J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in mv.fb-0 +net hu:fb-1 J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in mv.fb-1 +net hu:fb-2 J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in mv.fb-2 +net hu:minus-0 mv.fb-minusoffset-0 => joint.0.motor-pos-fb +net hu:minus-1 mv.fb-minusoffset-1 => joint.1.motor-pos-fb +net hu:minus-2 mv.fb-minusoffset-2 => joint.2.motor-pos-fb +net hu:plus-0 mv.pos-plusoffset-0 => J0_pid.command +net hu:plus-1 mv.pos-plusoffset-1 => J1_pid.command +net hu:plus-2 mv.pos-plusoffset-2 => J2_pid.command +net hu:pos-0 joint.0.motor-pos-cmd => mv.pos-0 +net hu:pos-1 joint.1.motor-pos-cmd => mv.pos-1 +net hu:pos-2 joint.2.motor-pos-cmd => mv.pos-2 + +# moveoff settings +setp mv.epsilon 0.001 +setp mv.offset-accel-0 60 +setp mv.offset-accel-1 60 +setp mv.offset-accel-2 60 +setp mv.offset-max-0 10 +setp mv.offset-max-1 10 +setp mv.offset-max-2 10 +setp mv.offset-min-0 -10 +setp mv.offset-min-1 -10 +setp mv.offset-min-2 -10 +setp mv.offset-vel-0 6 +setp mv.offset-vel-1 6 +setp mv.offset-vel-2 6 +setp mv.waypoint-sample-secs 0.05 +setp mv.waypoint-threshold 0.05 diff --git a/configs/sim/axis/moveoff/8_gladevcp.ini b/configs/sim/axis/moveoff/8_gladevcp.ini index 1c61c46b552..bb63b3d6478 100644 --- a/configs/sim/axis/moveoff/8_gladevcp.ini +++ b/configs/sim/axis/moveoff/8_gladevcp.ini @@ -8,13 +8,11 @@ MACHINE = moveoff,onpause,external [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./8_gladevcp.hal # hookup a moveoff component: -HALFILE = LIB:hookup_moveoff.tcl # simulate external controls: -HALFILE = LIB:moveoff_external.hal # connections for gladevcp: POSTGUI_HALFILE = moveoff_display_8.hal diff --git a/configs/sim/axis/ngcgui/ngcgui.hal b/configs/sim/axis/ngcgui/ngcgui.hal new file mode 100644 index 00000000000..7cdbb953690 --- /dev/null +++ b/configs/sim/axis/ngcgui/ngcgui.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the NGCGUI demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ngcgui/ngcgui.ini b/configs/sim/axis/ngcgui/ngcgui.ini index 538017966e6..e39d10e1a38 100644 --- a/configs/sim/axis/ngcgui/ngcgui.ini +++ b/configs/sim/axis/ngcgui/ngcgui.ini @@ -82,7 +82,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./ngcgui.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/ngcgui/ngcgui_gcmc.hal b/configs/sim/axis/ngcgui/ngcgui_gcmc.hal new file mode 100644 index 00000000000..5abad4d0852 --- /dev/null +++ b/configs/sim/axis/ngcgui/ngcgui_gcmc.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the NGCGUI and GCMC demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ngcgui/ngcgui_gcmc.ini b/configs/sim/axis/ngcgui/ngcgui_gcmc.ini index 9139f793ee4..9a023d6f42a 100644 --- a/configs/sim/axis/ngcgui/ngcgui_gcmc.ini +++ b/configs/sim/axis/ngcgui/ngcgui_gcmc.ini @@ -86,7 +86,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./ngcgui_gcmc.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/ngcgui/ngcgui_lathe.hal b/configs/sim/axis/ngcgui/ngcgui_lathe.hal new file mode 100644 index 00000000000..6aadf34259d --- /dev/null +++ b/configs/sim/axis/ngcgui/ngcgui_lathe.hal @@ -0,0 +1,89 @@ +# Core HAL setup for the NGCGUI lathe demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ngcgui/ngcgui_lathe.ini b/configs/sim/axis/ngcgui/ngcgui_lathe.ini index dff7147df02..10e1cceee74 100644 --- a/configs/sim/axis/ngcgui/ngcgui_lathe.ini +++ b/configs/sim/axis/ngcgui/ngcgui_lathe.ini @@ -59,7 +59,7 @@ USER_M_PATH = ../../nc_files/ngcgui_lib/mfiles [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 -BASE_PERIOD = 50000 +BASE_PERIOD = 0 SERVO_PERIOD = 1000000 [TASK] @@ -68,7 +68,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./ngcgui_lathe.hal [TRAJ] COORDINATES = X Z diff --git a/configs/sim/axis/ngcgui/ngcgui_simple.hal b/configs/sim/axis/ngcgui/ngcgui_simple.hal new file mode 100644 index 00000000000..296e7a0587b --- /dev/null +++ b/configs/sim/axis/ngcgui/ngcgui_simple.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the simple NGCGUI demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ngcgui/ngcgui_simple.ini b/configs/sim/axis/ngcgui/ngcgui_simple.ini index ccb896d7e1f..fb6d0a475bb 100644 --- a/configs/sim/axis/ngcgui/ngcgui_simple.ini +++ b/configs/sim/axis/ngcgui/ngcgui_simple.ini @@ -69,7 +69,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./ngcgui_simple.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/ngcgui/pyngcgui_axis.hal b/configs/sim/axis/ngcgui/pyngcgui_axis.hal new file mode 100644 index 00000000000..111b35d56c1 --- /dev/null +++ b/configs/sim/axis/ngcgui/pyngcgui_axis.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the PyNGCGUI Axis demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/ngcgui/pyngcgui_axis.ini b/configs/sim/axis/ngcgui/pyngcgui_axis.ini index 8cab0e77f10..0da7300e4c5 100644 --- a/configs/sim/axis/ngcgui/pyngcgui_axis.ini +++ b/configs/sim/axis/ngcgui/pyngcgui_axis.ini @@ -83,7 +83,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./pyngcgui_axis.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/pentapod/pentapod.hal b/configs/sim/axis/pentapod/pentapod.hal new file mode 100644 index 00000000000..5ce549a1b98 --- /dev/null +++ b/configs/sim/axis/pentapod/pentapod.hal @@ -0,0 +1,157 @@ +# HAL setup for the simulated pentapod machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt pentakins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=5 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +setp pentakins.base.0.x -418.03 +setp pentakins.base.0.y 324.56 +setp pentakins.base.0.z 895.56 +setp pentakins.base.1.x 417.96 +setp pentakins.base.1.y 324.56 +setp pentakins.base.1.z 895.56 +setp pentakins.base.2.x -418.03 +setp pentakins.base.2.y -325.44 +setp pentakins.base.2.z 895.56 +setp pentakins.base.3.x 417.96 +setp pentakins.base.3.y -325.44 +setp pentakins.base.3.z 895.56 +setp pentakins.base.4.x -0.06 +setp pentakins.base.4.y -492.96 +setp pentakins.base.4.z 895.56 +setp pentakins.effector.0.r 80.32 +setp pentakins.effector.0.z -185.5 +setp pentakins.effector.1.r 80.32 +setp pentakins.effector.1.z -159.5 +setp pentakins.effector.2.r 80.32 +setp pentakins.effector.2.z -67.5 +setp pentakins.effector.3.r 80.32 +setp pentakins.effector.3.z -41.5 +setp pentakins.effector.4.r 80.32 +setp pentakins.effector.4.z -14 diff --git a/configs/sim/axis/pentapod/pentapod.ini b/configs/sim/axis/pentapod/pentapod.ini index 943a62c0c2d..6d0b87c7d11 100644 --- a/configs/sim/axis/pentapod/pentapod.ini +++ b/configs/sim/axis/pentapod/pentapod.ini @@ -43,7 +43,7 @@ CYCLE_TIME = 0.010 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./pentapod.hal HALFILE = kinematics.hal POSTGUI_HALFILE = pentapod_postgui.hal diff --git a/configs/sim/axis/plasma/imperial.hal b/configs/sim/axis/plasma/imperial.hal new file mode 100644 index 00000000000..14db2aa3b2a --- /dev/null +++ b/configs/sim/axis/plasma/imperial.hal @@ -0,0 +1,108 @@ +# HAL setup for the imperial plasma-cutting simulation. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyyz +loadrt motmod base_period_nsec=100000 servo_period_nsec=1000000 num_joints=4 num_spindles=3 +loadrt plasmac +loadrt sim_home_switch names=sim-joint.0.home-switch,sim-joint.1.home-switch,sim-joint.2.home-switch,sim-joint.3.home-switch +loadrt stepgen step_type=0,0,0,0 +loadrt dbounce names=db_breakaway,db_float,db_ohmic,db_arc-ok +loadrt or2 names=estop_or +loadrt not names=estop_not,estop_not_1 +# realtime thread/function links +addf stepgen.capture-position servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf plasmac servo-thread +addf stepgen.update-freq servo-thread +addf sim-joint.0.home-switch servo-thread +addf sim-joint.1.home-switch servo-thread +addf sim-joint.2.home-switch servo-thread +addf sim-joint.3.home-switch servo-thread +addf db_float servo-thread +addf db_ohmic servo-thread +addf db_breakaway servo-thread +addf db_arc-ok servo-thread +addf estop_or servo-thread +addf estop_not servo-thread +addf estop_not_1 servo-thread +addf stepgen.make-pulses base-thread +# pin aliases +# param aliases +# signals +# nets +net machine-is-on halui.machine.is-on => plasmac.machine-is-on +net plasmac:adaptive-feed plasmac.adaptive-feed => motion.adaptive-feed +net plasmac:arc-ok db_arc-ok.out => plasmac.arc-ok-in +net plasmac:axis-position joint.3.pos-fb => plasmac.axis-z-position +net plasmac:axis-x-position axis.x.pos-cmd => plasmac.axis-x-position +net plasmac:axis-y-position axis.y.pos-cmd => plasmac.axis-y-position +net plasmac:breakaway-switch-out db_breakaway.out => plasmac.breakaway +net plasmac:current-velocity motion.current-vel => plasmac.current-velocity +net plasmac:cutting-start spindle.0.on => plasmac.cutting-start +net plasmac:cutting-stop plasmac.cutting-stop => halui.spindle.0.stop +net plasmac:feed-hold plasmac.feed-hold => motion.feed-hold +net plasmac:feed-override halui.feed-override.value => plasmac.feed-override +net plasmac:feed-reduction motion.analog-out-03 => plasmac.feed-reduction +net plasmac:feed-upm motion.feed-upm => plasmac.feed-upm +net plasmac:float-switch-out db_float.out => plasmac.float-switch +net plasmac:homed motion.is-all-homed => plasmac.homed +net plasmac:ignore-arc-ok-0 motion.digital-out-01 => plasmac.ignore-arc-ok-0 +net plasmac:jog-inhibit plasmac.jog-inhibit => motion.jog-inhibit motion.jog-stop +net plasmac:motion-type motion.motion-type => plasmac.motion-type +net plasmac:offset-scale plasmac.offset-scale => axis.x.eoffset-scale axis.y.eoffset-scale axis.z.eoffset-scale +net plasmac:offsets-active motion.eoffset-active => plasmac.offsets-active +net plasmac:ohmic-probe-out db_ohmic.out => plasmac.ohmic-probe +net plasmac:probe-out plasmac.probe-out => motion.probe-input +net plasmac:program-is-idle halui.program.is-idle => plasmac.program-is-idle +net plasmac:program-is-paused halui.program.is-paused => plasmac.program-is-paused +net plasmac:program-is-running halui.program.is-running => plasmac.program-is-running +net plasmac:program-pause plasmac.program-pause => halui.program.pause +net plasmac:program-resume plasmac.program-resume => halui.program.resume +net plasmac:program-run plasmac.program-run => halui.program.run +net plasmac:program-stop plasmac.program-stop => halui.program.stop +net plasmac:scribe-start spindle.1.on => plasmac.scribe-start +net plasmac:spotting-start spindle.2.on => plasmac.spotting-start +net plasmac:thc-disable motion.digital-out-02 => plasmac.thc-disable +net plasmac:torch-off motion.digital-out-03 => plasmac.torch-off +net plasmac:torch-on plasmac.torch-on +net plasmac:units-per-mm halui.machine.units-per-mm => plasmac.units-per-mm +net plasmac:x-offset-counts plasmac.x-offset-counts => axis.x.eoffset-counts +net plasmac:x-offset-current axis.x.eoffset => plasmac.x-offset-current +net plasmac:xy-offset-enable plasmac.xy-offset-enable => axis.x.eoffset-enable axis.y.eoffset-enable +net plasmac:y-offset-counts plasmac.y-offset-counts => axis.y.eoffset-counts +net plasmac:y-offset-current axis.y.eoffset => plasmac.y-offset-current +net plasmac:z-offset-counts plasmac.z-offset-counts => axis.z.eoffset-counts +net plasmac:z-offset-current axis.z.eoffset => plasmac.z-offset-current +net plasmac:z-offset-enable plasmac.z-offset-enable => axis.z.eoffset-enable +net sim:joint0.enable joint.0.amp-enable-out => stepgen.0.enable +net sim:joint0.homesw sim-joint.0.home-switch.home-sw => joint.0.home-sw-in +net sim:joint0.pos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd +net sim:joint0.pos-fb stepgen.0.position-fb => joint.0.motor-pos-fb sim-joint.0.home-switch.cur-pos +net sim:joint1.enable joint.1.amp-enable-out => stepgen.1.enable +net sim:joint1.homesw sim-joint.1.home-switch.home-sw => joint.1.home-sw-in +net sim:joint1.pos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd +net sim:joint1.pos-fb stepgen.1.position-fb => joint.1.motor-pos-fb sim-joint.1.home-switch.cur-pos +net sim:joint2.enable joint.2.amp-enable-out => stepgen.2.enable +net sim:joint2.homesw sim-joint.2.home-switch.home-sw => joint.2.home-sw-in +net sim:joint2.pos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd +net sim:joint2.pos-fb stepgen.2.position-fb => joint.2.motor-pos-fb sim-joint.2.home-switch.cur-pos +net sim:joint3.enable joint.3.amp-enable-out => stepgen.3.enable +net sim:joint3.homesw sim-joint.3.home-switch.home-sw => joint.3.home-sw-in +net sim:joint3.pos-cmd joint.3.motor-pos-cmd => stepgen.3.position-cmd +net sim:joint3.pos-fb stepgen.3.position-fb => joint.3.motor-pos-fb sim-joint.3.home-switch.cur-pos +net sim:tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed +net sim:tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +# parameter values +setp stepgen.0.maxaccel 120 +setp stepgen.1.maxaccel 120 +setp stepgen.2.maxaccel 120 +setp stepgen.3.maxaccel 35 diff --git a/configs/sim/axis/plasma/imperial.ini b/configs/sim/axis/plasma/imperial.ini index 191753ece71..f606d0199e6 100644 --- a/configs/sim/axis/plasma/imperial.ini +++ b/configs/sim/axis/plasma/imperial.ini @@ -16,10 +16,7 @@ FEATURES = 12 USER_M_PATH = ./:plasmac2/lib [HAL] -TWOPASS = ON -HALFILE = plasmac2/lib/sim/sim_stepgen.tcl -HALFILE = qtplasmac_comp.hal -HALFILE = custom.hal +HALFILE = ./imperial.hal HALUI = halui [DISPLAY] diff --git a/configs/sim/axis/plasma/metric.hal b/configs/sim/axis/plasma/metric.hal new file mode 100644 index 00000000000..c32ef1e3393 --- /dev/null +++ b/configs/sim/axis/plasma/metric.hal @@ -0,0 +1,108 @@ +# HAL setup for the metric plasma-cutting simulation. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyyz +loadrt motmod base_period_nsec=100000 servo_period_nsec=1000000 num_joints=4 num_spindles=3 +loadrt plasmac +loadrt sim_home_switch names=sim-joint.0.home-switch,sim-joint.1.home-switch,sim-joint.2.home-switch,sim-joint.3.home-switch +loadrt stepgen step_type=0,0,0,0 +loadrt dbounce names=db_breakaway,db_float,db_ohmic,db_arc-ok +loadrt or2 names=estop_or +loadrt not names=estop_not,estop_not_1 +# realtime thread/function links +addf stepgen.capture-position servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf plasmac servo-thread +addf stepgen.update-freq servo-thread +addf sim-joint.0.home-switch servo-thread +addf sim-joint.1.home-switch servo-thread +addf sim-joint.2.home-switch servo-thread +addf sim-joint.3.home-switch servo-thread +addf db_float servo-thread +addf db_ohmic servo-thread +addf db_breakaway servo-thread +addf db_arc-ok servo-thread +addf estop_or servo-thread +addf estop_not servo-thread +addf estop_not_1 servo-thread +addf stepgen.make-pulses base-thread +# pin aliases +# param aliases +# signals +# nets +net machine-is-on halui.machine.is-on => plasmac.machine-is-on +net plasmac:adaptive-feed plasmac.adaptive-feed => motion.adaptive-feed +net plasmac:arc-ok db_arc-ok.out => plasmac.arc-ok-in +net plasmac:axis-position joint.3.pos-fb => plasmac.axis-z-position +net plasmac:axis-x-position axis.x.pos-cmd => plasmac.axis-x-position +net plasmac:axis-y-position axis.y.pos-cmd => plasmac.axis-y-position +net plasmac:breakaway-switch-out db_breakaway.out => plasmac.breakaway +net plasmac:current-velocity motion.current-vel => plasmac.current-velocity +net plasmac:cutting-start spindle.0.on => plasmac.cutting-start +net plasmac:cutting-stop plasmac.cutting-stop => halui.spindle.0.stop +net plasmac:feed-hold plasmac.feed-hold => motion.feed-hold +net plasmac:feed-override halui.feed-override.value => plasmac.feed-override +net plasmac:feed-reduction motion.analog-out-03 => plasmac.feed-reduction +net plasmac:feed-upm motion.feed-upm => plasmac.feed-upm +net plasmac:float-switch-out db_float.out => plasmac.float-switch +net plasmac:homed motion.is-all-homed => plasmac.homed +net plasmac:ignore-arc-ok-0 motion.digital-out-01 => plasmac.ignore-arc-ok-0 +net plasmac:jog-inhibit plasmac.jog-inhibit => motion.jog-inhibit motion.jog-stop +net plasmac:motion-type motion.motion-type => plasmac.motion-type +net plasmac:offset-scale plasmac.offset-scale => axis.x.eoffset-scale axis.y.eoffset-scale axis.z.eoffset-scale +net plasmac:offsets-active motion.eoffset-active => plasmac.offsets-active +net plasmac:ohmic-probe-out db_ohmic.out => plasmac.ohmic-probe +net plasmac:probe-out plasmac.probe-out => motion.probe-input +net plasmac:program-is-idle halui.program.is-idle => plasmac.program-is-idle +net plasmac:program-is-paused halui.program.is-paused => plasmac.program-is-paused +net plasmac:program-is-running halui.program.is-running => plasmac.program-is-running +net plasmac:program-pause plasmac.program-pause => halui.program.pause +net plasmac:program-resume plasmac.program-resume => halui.program.resume +net plasmac:program-run plasmac.program-run => halui.program.run +net plasmac:program-stop plasmac.program-stop => halui.program.stop +net plasmac:scribe-start spindle.1.on => plasmac.scribe-start +net plasmac:spotting-start spindle.2.on => plasmac.spotting-start +net plasmac:thc-disable motion.digital-out-02 => plasmac.thc-disable +net plasmac:torch-off motion.digital-out-03 => plasmac.torch-off +net plasmac:torch-on plasmac.torch-on +net plasmac:units-per-mm halui.machine.units-per-mm => plasmac.units-per-mm +net plasmac:x-offset-counts plasmac.x-offset-counts => axis.x.eoffset-counts +net plasmac:x-offset-current axis.x.eoffset => plasmac.x-offset-current +net plasmac:xy-offset-enable plasmac.xy-offset-enable => axis.x.eoffset-enable axis.y.eoffset-enable +net plasmac:y-offset-counts plasmac.y-offset-counts => axis.y.eoffset-counts +net plasmac:y-offset-current axis.y.eoffset => plasmac.y-offset-current +net plasmac:z-offset-counts plasmac.z-offset-counts => axis.z.eoffset-counts +net plasmac:z-offset-current axis.z.eoffset => plasmac.z-offset-current +net plasmac:z-offset-enable plasmac.z-offset-enable => axis.z.eoffset-enable +net sim:joint0.enable joint.0.amp-enable-out => stepgen.0.enable +net sim:joint0.homesw sim-joint.0.home-switch.home-sw => joint.0.home-sw-in +net sim:joint0.pos-cmd joint.0.motor-pos-cmd => stepgen.0.position-cmd +net sim:joint0.pos-fb stepgen.0.position-fb => joint.0.motor-pos-fb sim-joint.0.home-switch.cur-pos +net sim:joint1.enable joint.1.amp-enable-out => stepgen.1.enable +net sim:joint1.homesw sim-joint.1.home-switch.home-sw => joint.1.home-sw-in +net sim:joint1.pos-cmd joint.1.motor-pos-cmd => stepgen.1.position-cmd +net sim:joint1.pos-fb stepgen.1.position-fb => joint.1.motor-pos-fb sim-joint.1.home-switch.cur-pos +net sim:joint2.enable joint.2.amp-enable-out => stepgen.2.enable +net sim:joint2.homesw sim-joint.2.home-switch.home-sw => joint.2.home-sw-in +net sim:joint2.pos-cmd joint.2.motor-pos-cmd => stepgen.2.position-cmd +net sim:joint2.pos-fb stepgen.2.position-fb => joint.2.motor-pos-fb sim-joint.2.home-switch.cur-pos +net sim:joint3.enable joint.3.amp-enable-out => stepgen.3.enable +net sim:joint3.homesw sim-joint.3.home-switch.home-sw => joint.3.home-sw-in +net sim:joint3.pos-cmd joint.3.motor-pos-cmd => stepgen.3.position-cmd +net sim:joint3.pos-fb stepgen.3.position-fb => joint.3.motor-pos-fb sim-joint.3.home-switch.cur-pos +net sim:tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed +net sim:tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +# parameter values +setp stepgen.0.maxaccel 3000 +setp stepgen.1.maxaccel 3000 +setp stepgen.2.maxaccel 3000 +setp stepgen.3.maxaccel 900 diff --git a/configs/sim/axis/plasma/metric.ini b/configs/sim/axis/plasma/metric.ini index 59eda7ede61..418b3f2bd66 100644 --- a/configs/sim/axis/plasma/metric.ini +++ b/configs/sim/axis/plasma/metric.ini @@ -16,10 +16,7 @@ FEATURES = 12 USER_M_PATH = ./:plasmac2/lib [HAL] -TWOPASS = ON -HALFILE = plasmac2/lib/sim/sim_stepgen.tcl -HALFILE = qtplasmac_comp.hal -HALFILE = custom.hal +HALFILE = ./metric.hal HALUI = halui [DISPLAY] diff --git a/configs/sim/axis/profile_axis.hal b/configs/sim/axis/profile_axis.hal new file mode 100644 index 00000000000..64ee141fe3f --- /dev/null +++ b/configs/sim/axis/profile_axis.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the Axis profile demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/profile_axis.ini b/configs/sim/axis/profile_axis.ini index e43ef4f7946..6a43fff8336 100644 --- a/configs/sim/axis/profile_axis.ini +++ b/configs/sim/axis/profile_axis.ini @@ -43,7 +43,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./profile_axis.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/qtvcp/qtvcp_tab.hal b/configs/sim/axis/qtvcp/qtvcp_tab.hal new file mode 100644 index 00000000000..c3a0ef45253 --- /dev/null +++ b/configs/sim/axis/qtvcp/qtvcp_tab.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the QtVCP tab demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/qtvcp/qtvcp_tab.ini b/configs/sim/axis/qtvcp/qtvcp_tab.ini index 7822089cb27..ac887b4e6e4 100644 --- a/configs/sim/axis/qtvcp/qtvcp_tab.ini +++ b/configs/sim/axis/qtvcp/qtvcp_tab.ini @@ -52,7 +52,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./qtvcp_tab.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/qtvcp/qtvismach_tab.hal b/configs/sim/axis/qtvcp/qtvismach_tab.hal new file mode 100644 index 00000000000..a1094be4566 --- /dev/null +++ b/configs/sim/axis/qtvcp/qtvismach_tab.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the QtVCP Vismach tab demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/qtvcp/qtvismach_tab.ini b/configs/sim/axis/qtvcp/qtvismach_tab.ini index 561c9b4c2a2..b162224967e 100644 --- a/configs/sim/axis/qtvcp/qtvismach_tab.ini +++ b/configs/sim/axis/qtvcp/qtvismach_tab.ini @@ -46,7 +46,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./qtvismach_tab.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/random_tc.hal b/configs/sim/axis/random_tc.hal new file mode 100644 index 00000000000..d686d4a7a8b --- /dev/null +++ b/configs/sim/axis/random_tc.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the random-tool-change demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/random_tc.ini b/configs/sim/axis/random_tc.ini index 442449ee371..b6ee0fd966e 100644 --- a/configs/sim/axis/random_tc.ini +++ b/configs/sim/axis/random_tc.ini @@ -43,7 +43,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./random_tc.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/remap/cycle/cycle.hal b/configs/sim/axis/remap/cycle/cycle.hal new file mode 100644 index 00000000000..24cdeee5d86 --- /dev/null +++ b/configs/sim/axis/remap/cycle/cycle.hal @@ -0,0 +1,206 @@ +# HAL setup for the canned-cycle remapping demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod unlock_joints_mask=0x10 base_period_nsec=0 servo_period_nsec=1000000 num_joints=9 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid,J6_pid,J7_pid,J8_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux,J6_mux,J7_mux,J8_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel,J6_vel,J6_accel,J7_vel,J7_accel,J8_vel,J8_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch,J6_switch,J7_switch,J8_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J6_pid.do-pid-calcs servo-thread +addf J7_pid.do-pid-calcs servo-thread +addf J8_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J6_mux servo-thread +addf J7_mux servo-thread +addf J8_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J6_vel servo-thread +addf J6_accel servo-thread +addf J7_vel servo-thread +addf J7_accel servo-thread +addf J8_vel servo-thread +addf J8_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf J6_switch servo-thread +addf J7_switch servo-thread +addf J8_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel J6_mux.sel J7_mux.sel J8_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# joint 6 +setp J6_pid.FF0 1 +setp J6_pid.Pgain 0 +setp J6_switch.home-pos 0.1 +setp J6_switch.hysteresis 0.05 +net j6-enable joint.6.amp-enable-out => J6_pid.enable +net j6-home-sw J6_switch.home-sw => joint.6.home-sw-in +net j6-pid-output J6_pid.output => J6_mux.in1 +net j6-pos-cmd joint.6.motor-pos-cmd => J6_pid.command +net j6-pos-fb J6_mux.out => J6_mux.in0 J6_switch.cur-pos J6_vel.in joint.6.motor-pos-fb +net j6-vel J6_vel.out => J6_accel.in + +# joint 7 +setp J7_pid.FF0 1 +setp J7_pid.Pgain 0 +setp J7_switch.home-pos 0.1 +setp J7_switch.hysteresis 0.05 +net j7-enable joint.7.amp-enable-out => J7_pid.enable +net j7-home-sw J7_switch.home-sw => joint.7.home-sw-in +net j7-pid-output J7_pid.output => J7_mux.in1 +net j7-pos-cmd joint.7.motor-pos-cmd => J7_pid.command +net j7-pos-fb J7_mux.out => J7_mux.in0 J7_switch.cur-pos J7_vel.in joint.7.motor-pos-fb +net j7-vel J7_vel.out => J7_accel.in + +# joint 8 +setp J8_pid.FF0 1 +setp J8_pid.Pgain 0 +setp J8_switch.home-pos 0.1 +setp J8_switch.hysteresis 0.05 +net j8-enable joint.8.amp-enable-out => J8_pid.enable +net j8-home-sw J8_switch.home-sw => joint.8.home-sw-in +net j8-pid-output J8_pid.output => J8_mux.in1 +net j8-pos-cmd joint.8.motor-pos-cmd => J8_pid.command +net j8-pos-fb J8_mux.out => J8_mux.in0 J8_switch.cur-pos J8_vel.in joint.8.motor-pos-fb +net j8-vel J8_vel.out => J8_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/remap/cycle/cycle.ini b/configs/sim/axis/remap/cycle/cycle.ini index 6f3ebe6e5de..e70902a5711 100644 --- a/configs/sim/axis/remap/cycle/cycle.ini +++ b/configs/sim/axis/remap/cycle/cycle.ini @@ -51,7 +51,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./cycle.hal HALFILE = locking_indexer.hal [TRAJ] diff --git a/configs/sim/axis/remap/extend-builtins/extend-builtins.hal b/configs/sim/axis/remap/extend-builtins/extend-builtins.hal new file mode 100644 index 00000000000..4c1f409d62f --- /dev/null +++ b/configs/sim/axis/remap/extend-builtins/extend-builtins.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the built-in-code remapping demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/remap/extend-builtins/extend-builtins.ini b/configs/sim/axis/remap/extend-builtins/extend-builtins.ini index 67634a009a1..61191af431e 100644 --- a/configs/sim/axis/remap/extend-builtins/extend-builtins.ini +++ b/configs/sim/axis/remap/extend-builtins/extend-builtins.ini @@ -84,7 +84,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./extend-builtins.hal POSTGUI_HALFILE = gladevcp.hal [TRAJ] diff --git a/configs/sim/axis/remap/getting-started/demo.hal b/configs/sim/axis/remap/getting-started/demo.hal new file mode 100644 index 00000000000..8530f73e493 --- /dev/null +++ b/configs/sim/axis/remap/getting-started/demo.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the getting-started remapping demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/remap/getting-started/demo.ini b/configs/sim/axis/remap/getting-started/demo.ini index e2e7ac32dc0..7dd11cb03d8 100644 --- a/configs/sim/axis/remap/getting-started/demo.ini +++ b/configs/sim/axis/remap/getting-started/demo.ini @@ -133,7 +133,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./demo.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/manualtoolchange.ini b/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/manualtoolchange.ini index 20fc4388e68..038c399fa06 100644 --- a/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/manualtoolchange.ini +++ b/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/manualtoolchange.ini @@ -57,7 +57,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./manualtoolchange_core.hal POSTGUI_HALFILE= gladevcp.hal [TRAJ] diff --git a/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/manualtoolchange_core.hal b/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/manualtoolchange_core.hal new file mode 100644 index 00000000000..27f8993d1be --- /dev/null +++ b/configs/sim/axis/remap/manual-toolchange-with-tool-length-switch/manualtoolchange_core.hal @@ -0,0 +1,103 @@ +# HAL setup for manual tool change with a tool-length switch. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/remap/rack-toolchange/racktoolchange.ini b/configs/sim/axis/remap/rack-toolchange/racktoolchange.ini index 659bda067c3..b570a855e10 100644 --- a/configs/sim/axis/remap/rack-toolchange/racktoolchange.ini +++ b/configs/sim/axis/remap/rack-toolchange/racktoolchange.ini @@ -55,7 +55,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./racktoolchange_core.hal HALFILE = racktoolchange.hal POSTGUI_HALFILE= gladevcp.hal diff --git a/configs/sim/axis/remap/rack-toolchange/racktoolchange_core.hal b/configs/sim/axis/remap/rack-toolchange/racktoolchange_core.hal new file mode 100644 index 00000000000..f0b1e3c8db5 --- /dev/null +++ b/configs/sim/axis/remap/rack-toolchange/racktoolchange_core.hal @@ -0,0 +1,104 @@ +# HAL setup for the rack-tool-change remapping demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/remap/stop-lookahead/demo.hal b/configs/sim/axis/remap/stop-lookahead/demo.hal new file mode 100644 index 00000000000..27b4624c44b --- /dev/null +++ b/configs/sim/axis/remap/stop-lookahead/demo.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the stop-lookahead remapping demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/remap/stop-lookahead/demo.ini b/configs/sim/axis/remap/stop-lookahead/demo.ini index 43aade97169..61d3eab361c 100644 --- a/configs/sim/axis/remap/stop-lookahead/demo.ini +++ b/configs/sim/axis/remap/stop-lookahead/demo.ini @@ -51,7 +51,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./demo.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/axis/rose_engine/rose_engine.hal b/configs/sim/axis/rose_engine/rose_engine.hal new file mode 100644 index 00000000000..46de6e56546 --- /dev/null +++ b/configs/sim/axis/rose_engine/rose_engine.hal @@ -0,0 +1,104 @@ +# Core HAL setup for the simulated rose-engine machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt rosekins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/rose_engine/rose_engine.ini b/configs/sim/axis/rose_engine/rose_engine.ini index 7ad0172a7bd..fa110a48837 100644 --- a/configs/sim/axis/rose_engine/rose_engine.ini +++ b/configs/sim/axis/rose_engine/rose_engine.ini @@ -2,7 +2,7 @@ APP = halshow rose_engine.halshow [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./rose_engine.hal [TRAJ] COORDINATES = XYZ diff --git a/configs/sim/axis/vismach/5axis/bridgemill/5axis.hal b/configs/sim/axis/vismach/5axis/bridgemill/5axis.hal new file mode 100644 index 00000000000..65dc33f3a0f --- /dev/null +++ b/configs/sim/axis/vismach/5axis/bridgemill/5axis.hal @@ -0,0 +1,161 @@ +# HAL setup for the simulated XYZBCW bridge mill. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt 5axiskins coordinates=xyzbcwy +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=7 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid,J6_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux,J6_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel,J6_vel,J6_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch,J6_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J6_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J6_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J6_vel servo-thread +addf J6_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf J6_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel J6_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# joint 6 +setp J6_pid.FF0 1 +setp J6_pid.Pgain 0 +net j6-enable joint.6.amp-enable-out => J6_pid.enable +net j6-home-sw J6_switch.home-sw => joint.6.home-sw-in +net j6-pid-output J6_pid.output => J6_mux.in1 +net j6-pos-cmd joint.6.motor-pos-cmd => J6_pid.command +net j6-pos-fb J6_mux.out => J6_mux.in0 J6_switch.cur-pos J6_vel.in joint.6.motor-pos-fb +net j6-vel J6_vel.out => J6_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/5axis/bridgemill/5axis.ini b/configs/sim/axis/vismach/5axis/bridgemill/5axis.ini index c66ba5e7238..bb41b5e5697 100644 --- a/configs/sim/axis/vismach/5axis/bridgemill/5axis.ini +++ b/configs/sim/axis/vismach/5axis/bridgemill/5axis.ini @@ -50,7 +50,7 @@ CYCLE_TIME = 0.010 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./5axis.hal HALFILE = 5axisgui.hal POSTGUI_HALFILE = 5axis_postgui.hal diff --git a/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr-gui.py b/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr-gui.py old mode 100644 new mode 100755 diff --git a/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.hal b/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.hal new file mode 100644 index 00000000000..077d8c56ef2 --- /dev/null +++ b/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.hal @@ -0,0 +1,130 @@ +# HAL setup for the XYZAB table-dual-rotary machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt xyzab_tdr_kins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=5 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1.0 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.ini b/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.ini index d5a083dad1d..f8f6054225b 100644 --- a/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.ini +++ b/configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.ini @@ -39,7 +39,7 @@ KINEMATICS = xyzab_tdr_kins [HAL] HALUI = halui - HALFILE = LIB:basic_sim.tcl + HALFILE = ./xyzab-tdr.hal POSTGUI_HALFILE = xyzab-tdr-postgui.hal diff --git a/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.hal b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.hal new file mode 100644 index 00000000000..8e79fa57424 --- /dev/null +++ b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.hal @@ -0,0 +1,130 @@ +# HAL setup for the XYZAC table-rotary-tilting machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt xyzac-trt-kins sparm=identityfirst +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=5 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1.0 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini index ae0995c189c..7a15fa8cc52 100644 --- a/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini +++ b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini @@ -51,7 +51,7 @@ KINEMATICS = xyzac-trt-kins sparm=identityfirst [HAL] HALUI = halui - HALFILE = LIB:basic_sim.tcl + HALFILE = ./xyzac-trt.hal POSTGUI_HALFILE = switchkins_postgui.hal diff --git a/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.hal b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.hal new file mode 100644 index 00000000000..873e9c1d255 --- /dev/null +++ b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.hal @@ -0,0 +1,130 @@ +# HAL setup for the XYZBC table-rotary-tilting machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt xyzbc-trt-kins sparm=identityfirst +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=5 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1.0 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini index 0311dfcba4a..3ff3e3ae3a6 100644 --- a/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini +++ b/configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini @@ -51,7 +51,7 @@ KINEMATICS = xyzbc-trt-kins sparm=identityfirst [HAL] HALUI = halui - HALFILE = LIB:basic_sim.tcl + HALFILE = ./xyzbc-trt.hal POSTGUI_HALFILE = switchkins_postgui.hal diff --git a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzacb-trsrn_twp/xyzacb-trsrn.hal b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzacb-trsrn_twp/xyzacb-trsrn.hal new file mode 100644 index 00000000000..37eb45b966e --- /dev/null +++ b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzacb-trsrn_twp/xyzacb-trsrn.hal @@ -0,0 +1,145 @@ +# HAL setup for the XYZACB rotary-nutating machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt xyzacb_trsrn +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1.0 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1.0 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzacb-trsrn_twp/xyzacb-trsrn.ini b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzacb-trsrn_twp/xyzacb-trsrn.ini index fdbab9b291f..24bb5fffa3d 100644 --- a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzacb-trsrn_twp/xyzacb-trsrn.ini +++ b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzacb-trsrn_twp/xyzacb-trsrn.ini @@ -49,7 +49,7 @@ KINEMATICS = xyzacb_trsrn [HAL] HALUI = halui - HALFILE = LIB:basic_sim.tcl + HALFILE = ./xyzacb-trsrn.hal POSTGUI_HALFILE = xyzacb-trsrn_postgui.hal #HALCMD = loadusr ../python/feed_zero.py diff --git a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzbca-trsrn_twp/xyzbca-trsrn.hal b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzbca-trsrn_twp/xyzbca-trsrn.hal new file mode 100644 index 00000000000..142f1b068f1 --- /dev/null +++ b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzbca-trsrn_twp/xyzbca-trsrn.hal @@ -0,0 +1,145 @@ +# HAL setup for the XYZBCA rotary-nutating machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt xyzbca_trsrn +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1.0 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1.0 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzbca-trsrn_twp/xyzbca-trsrn.ini b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzbca-trsrn_twp/xyzbca-trsrn.ini index 4162f8f0248..b889332f50f 100644 --- a/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzbca-trsrn_twp/xyzbca-trsrn.ini +++ b/configs/sim/axis/vismach/5axis/table-rotary_spindle-rotary-nutating/xyzbca-trsrn_twp/xyzbca-trsrn.ini @@ -49,7 +49,7 @@ KINEMATICS = xyzbca_trsrn [HAL] HALUI = halui - HALFILE = LIB:basic_sim.tcl + HALFILE = ./xyzbca-trsrn.hal POSTGUI_HALFILE = xyzbca-trsrn_postgui.hal # connections required for the kinematics component diff --git a/configs/sim/axis/vismach/hexapod-sim/hexapod.hal b/configs/sim/axis/vismach/hexapod-sim/hexapod.hal new file mode 100644 index 00000000000..bf8bcd27945 --- /dev/null +++ b/configs/sim/axis/vismach/hexapod-sim/hexapod.hal @@ -0,0 +1,158 @@ +# HAL setup for the simulated hexapod machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt genhexkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +setp J3_switch.home-pos 0.1 +setp J3_switch.hysteresis 0.05 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +setp J4_switch.home-pos 0.1 +setp J4_switch.hysteresis 0.05 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +setp J5_switch.home-pos 0.1 +setp J5_switch.hysteresis 0.05 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/hexapod-sim/hexapod.ini b/configs/sim/axis/vismach/hexapod-sim/hexapod.ini index f42a14799a0..fae51da5998 100644 --- a/configs/sim/axis/vismach/hexapod-sim/hexapod.ini +++ b/configs/sim/axis/vismach/hexapod-sim/hexapod.ini @@ -37,7 +37,7 @@ CYCLE_TIME = 0.010 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./hexapod.hal HALFILE = kinematics.hal HALCMD = loadusr -W ./hexagui.py POSTGUI_HALFILE = hexapod_postgui.hal diff --git a/configs/sim/axis/vismach/melfa-sim/melfa-sim-genser/melfa-sim-genser.hal b/configs/sim/axis/vismach/melfa-sim/melfa-sim-genser/melfa-sim-genser.hal new file mode 100644 index 00000000000..4b304414313 --- /dev/null +++ b/configs/sim/axis/vismach/melfa-sim/melfa-sim-genser/melfa-sim-genser.hal @@ -0,0 +1,146 @@ +# HAL setup for the Melfa robot using generalized serial kinematics. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt genserkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/melfa-sim/melfa-sim-genser/melfa-sim-genser.ini b/configs/sim/axis/vismach/melfa-sim/melfa-sim-genser/melfa-sim-genser.ini index cfea9e01701..223afab8810 100644 --- a/configs/sim/axis/vismach/melfa-sim/melfa-sim-genser/melfa-sim-genser.ini +++ b/configs/sim/axis/vismach/melfa-sim/melfa-sim-genser/melfa-sim-genser.ini @@ -9,7 +9,7 @@ JOINTS= 6 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./melfa-sim-genser.hal HALFILE = melfa_mdh.hal HALCMD = loadusr -W ../melfagui.py POSTGUI_HALFILE = ../melfa-postgui.hal diff --git a/configs/sim/axis/vismach/melfa-sim/melfa-sim-three21/melfa_321.hal b/configs/sim/axis/vismach/melfa-sim/melfa-sim-three21/melfa_321.hal new file mode 100644 index 00000000000..3dfc26f8cc6 --- /dev/null +++ b/configs/sim/axis/vismach/melfa-sim/melfa-sim-three21/melfa_321.hal @@ -0,0 +1,146 @@ +# HAL setup for the Melfa robot using three21 kinematics. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt three21kins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/melfa-sim/melfa-sim-three21/melfa_321.ini b/configs/sim/axis/vismach/melfa-sim/melfa-sim-three21/melfa_321.ini index 5a8ba9d4787..67aa5ffc5ce 100644 --- a/configs/sim/axis/vismach/melfa-sim/melfa-sim-three21/melfa_321.ini +++ b/configs/sim/axis/vismach/melfa-sim/melfa-sim-three21/melfa_321.ini @@ -9,7 +9,7 @@ JOINTS= 6 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./melfa_321.hal HALFILE = melfa_dh.hal HALCMD = loadusr -W ../melfagui.py POSTGUI_HALFILE = ../melfa-postgui.hal diff --git a/configs/sim/axis/vismach/millturn/millturn.ini b/configs/sim/axis/vismach/millturn/millturn.ini index 575947d9dce..6178a45dd61 100644 --- a/configs/sim/axis/vismach/millturn/millturn.ini +++ b/configs/sim/axis/vismach/millturn/millturn.ini @@ -12,7 +12,7 @@ JOINTS= 4 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./millturn_core.hal HALFILE = millturn.hal POSTGUI_HALFILE = millturn-postgui.hal diff --git a/configs/sim/axis/vismach/millturn/millturn_core.hal b/configs/sim/axis/vismach/millturn/millturn_core.hal new file mode 100644 index 00000000000..4f763a40758 --- /dev/null +++ b/configs/sim/axis/vismach/millturn/millturn_core.hal @@ -0,0 +1,116 @@ +# HAL setup for the simulated mill-turn machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt millturn +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=4 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/puma/puma.hal b/configs/sim/axis/vismach/puma/puma.hal new file mode 100644 index 00000000000..89c833484c6 --- /dev/null +++ b/configs/sim/axis/vismach/puma/puma.hal @@ -0,0 +1,146 @@ +# HAL setup for the simulated PUMA robot. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt pumakins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/puma/puma.ini b/configs/sim/axis/vismach/puma/puma.ini index 99c0fa33112..199d5009441 100644 --- a/configs/sim/axis/vismach/puma/puma.ini +++ b/configs/sim/axis/vismach/puma/puma.ini @@ -9,7 +9,7 @@ JOINTS = 6 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./puma.hal HALFILE = puma_dh.hal HALCMD = loadusr -W ./pumagui.py POSTGUI_HALFILE = puma_postgui.hal diff --git a/configs/sim/axis/vismach/puma/puma560.hal b/configs/sim/axis/vismach/puma/puma560.hal new file mode 100644 index 00000000000..79ac3bc8474 --- /dev/null +++ b/configs/sim/axis/vismach/puma/puma560.hal @@ -0,0 +1,146 @@ +# HAL setup for the simulated PUMA 560 robot. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt genserkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/puma/puma560.ini b/configs/sim/axis/vismach/puma/puma560.ini index 046f5d118d5..b3149e92789 100644 --- a/configs/sim/axis/vismach/puma/puma560.ini +++ b/configs/sim/axis/vismach/puma/puma560.ini @@ -14,7 +14,7 @@ KINEMATICS= genserkins [HAL] HALUI = halui HALCMD = loadusr -W ./puma560gui.py -HALFILE = LIB:basic_sim.tcl +HALFILE = ./puma560.hal HALFILE = puma560_dh.hal POSTGUI_HALFILE = puma560_postgui.hal diff --git a/configs/sim/axis/vismach/puma/puma560_uvw.hal b/configs/sim/axis/vismach/puma/puma560_uvw.hal new file mode 100644 index 00000000000..69e9153f6f7 --- /dev/null +++ b/configs/sim/axis/vismach/puma/puma560_uvw.hal @@ -0,0 +1,191 @@ +# HAL setup for the PUMA 560 robot with UVW coordinates. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt genserkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=9 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid,J6_pid,J7_pid,J8_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux,J6_mux,J7_mux,J8_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel,J6_vel,J6_accel,J7_vel,J7_accel,J8_vel,J8_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch,J6_switch,J7_switch,J8_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J6_pid.do-pid-calcs servo-thread +addf J7_pid.do-pid-calcs servo-thread +addf J8_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J6_mux servo-thread +addf J7_mux servo-thread +addf J8_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J6_vel servo-thread +addf J6_accel servo-thread +addf J7_vel servo-thread +addf J7_accel servo-thread +addf J8_vel servo-thread +addf J8_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf J6_switch servo-thread +addf J7_switch servo-thread +addf J8_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel J6_mux.sel J7_mux.sel J8_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# joint 6 +setp J6_pid.FF0 1 +setp J6_pid.Pgain 0 +net j6-enable joint.6.amp-enable-out => J6_pid.enable +net j6-home-sw J6_switch.home-sw => joint.6.home-sw-in +net j6-pid-output J6_pid.output => J6_mux.in1 +net j6-pos-cmd joint.6.motor-pos-cmd => J6_pid.command +net j6-pos-fb J6_mux.out => J6_mux.in0 J6_switch.cur-pos J6_vel.in joint.6.motor-pos-fb +net j6-vel J6_vel.out => J6_accel.in + +# joint 7 +setp J7_pid.FF0 1 +setp J7_pid.Pgain 0 +net j7-enable joint.7.amp-enable-out => J7_pid.enable +net j7-home-sw J7_switch.home-sw => joint.7.home-sw-in +net j7-pid-output J7_pid.output => J7_mux.in1 +net j7-pos-cmd joint.7.motor-pos-cmd => J7_pid.command +net j7-pos-fb J7_mux.out => J7_mux.in0 J7_switch.cur-pos J7_vel.in joint.7.motor-pos-fb +net j7-vel J7_vel.out => J7_accel.in + +# joint 8 +setp J8_pid.FF0 1 +setp J8_pid.Pgain 0 +net j8-enable joint.8.amp-enable-out => J8_pid.enable +net j8-home-sw J8_switch.home-sw => joint.8.home-sw-in +net j8-pid-output J8_pid.output => J8_mux.in1 +net j8-pos-cmd joint.8.motor-pos-cmd => J8_pid.command +net j8-pos-fb J8_mux.out => J8_mux.in0 J8_switch.cur-pos J8_vel.in joint.8.motor-pos-fb +net j8-vel J8_vel.out => J8_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/puma/puma560_uvw.ini b/configs/sim/axis/vismach/puma/puma560_uvw.ini index a6b9f8544e9..1a72a2fc7c7 100644 --- a/configs/sim/axis/vismach/puma/puma560_uvw.ini +++ b/configs/sim/axis/vismach/puma/puma560_uvw.ini @@ -14,7 +14,7 @@ KINEMATICS= genserkins [HAL] HALUI = halui HALCMD = loadusr -W ./puma560gui.py -HALFILE = LIB:basic_sim.tcl +HALFILE = ./puma560_uvw.hal HALFILE = puma560_dh.hal POSTGUI_HALFILE = puma560_postgui.hal diff --git a/configs/sim/axis/vismach/puma/puma_cube.hal b/configs/sim/axis/vismach/puma/puma_cube.hal new file mode 100644 index 00000000000..fb8021d5084 --- /dev/null +++ b/configs/sim/axis/vismach/puma/puma_cube.hal @@ -0,0 +1,146 @@ +# HAL setup for the PUMA cube demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt pumakins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/puma/puma_cube.ini b/configs/sim/axis/vismach/puma/puma_cube.ini index 8397ce3ea7a..5f3a0486d5f 100644 --- a/configs/sim/axis/vismach/puma/puma_cube.ini +++ b/configs/sim/axis/vismach/puma/puma_cube.ini @@ -100,7 +100,7 @@ CYCLE_TIME = 0.010 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./puma_cube.hal HALFILE = puma_dh.hal HALCMD = loadusr -W ./pumagui.py POSTGUI_HALFILE = puma_postgui.hal diff --git a/configs/sim/axis/vismach/scara/scara.hal b/configs/sim/axis/vismach/scara/scara.hal new file mode 100644 index 00000000000..6a205b1c163 --- /dev/null +++ b/configs/sim/axis/vismach/scara/scara.hal @@ -0,0 +1,145 @@ +# HAL setup for the simulated SCARA robot. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt scarakins coordinates=xyzcab +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1.0 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1.0 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/vismach/scara/scara.ini b/configs/sim/axis/vismach/scara/scara.ini index 23323fdc8bf..c537f3e4ce4 100644 --- a/configs/sim/axis/vismach/scara/scara.ini +++ b/configs/sim/axis/vismach/scara/scara.ini @@ -56,7 +56,7 @@ KINEMATICS = scarakins coordinates=xyzcab [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./scara.hal HALCMD = loadusr -W ./scaragui.py POSTGUI_HALFILE = scara_postgui.hal diff --git a/configs/sim/axis/xhc-hb04/README b/configs/sim/axis/xhc-hb04/README index c867328afbc..5b1e8ab55d0 100644 --- a/configs/sim/axis/xhc-hb04/README +++ b/configs/sim/axis/xhc-hb04/README @@ -67,7 +67,7 @@ ATTR{idProduct}=="eb70", ATTR{idVendor}=="10ce", MODE="0666", OWNER="root", GROU This rule uses mode 0666 to provide read and write access to owner,group,world -- e.g., everyone. ---------------------------------- -The sim configurations use a single halfile: LIB:xhc-hb04.tcl. This halfile uses a custom comp file (xhc_hb04_util.comp) and can be added to existing configurations by adding an ini file entry for: +The sim configurations use flat HAL files with explicit pendant connections. For other configurations, LIB:xhc-hb04.tcl provides pendant setup using a custom comp file (xhc_hb04_util.comp) and can be added with an ini file entry for: [HAL]HALFILE = LIB:xhc-hb04.tcl This HALFILE entry should follow other HALFILE entries. @@ -154,29 +154,15 @@ and for the pendant layout. For example, the organization for the xhc-hb04-layout2.ini file is: #INCLUDE inch_base.inc | Conventional items for an inch based sim - #INCLUDE layout2.inc | All button items ([XHC_HB04_BUTTONS],[HALUI]) + #INCLUDE layout2.inc | HALUI MDI commands [EMC] | Machine identifier MACHINE = | [HAL] | HAL items - HALFILE = | - ... | - HALFILE = | - HALFILE = LIB:xhc-hb04.tcl | xhc-hb04 configuration script + HALFILE = ./xhc-hb04-layout2.hal | Simulated machine and pendant connections HALUI = halui | Halui specifier - [XHC_HB04_CONFIG] | All config items used by LIB:xhc-hb04.tcl - layout = | - coords = | - coefs = | - scales = | - jogmode = | - sequence = | - require_pendant = | - inch_or_mm = | - mpg_accels = | - [APPLICATIONS] | Optional auxiliary scripts APP = monitor-xhc-hb04 | Connection monitor script diff --git a/configs/sim/axis/xhc-hb04/layout1.inc b/configs/sim/axis/xhc-hb04/layout1.inc index 1117db1242a..96add74679e 100644 --- a/configs/sim/axis/xhc-hb04/layout1.inc +++ b/configs/sim/axis/xhc-hb04/layout1.inc @@ -1,34 +1,3 @@ -[XHC_HB04_BUTTONS] -# use button names according to layout file LIB:xhc-hb04-layout{n}.cfg -# note: "start_pause" is connected for standard behavior -# controlling halui.pause/halui.resume/halui.run -# these are examples, edit as required: -stop = halui.program.stop -start_pause = std_start_pause -rewind = halui.program.step -safe_z = halui.mdi-command-01 -# in this sim, home-all only works first time, hold down till finished: -home = halui.home-all -x2 = halui.mdi-command-02 -y2 = halui.mdi-command-03 -# probe-input for simulating a probe: -probe_z = motion.probe-input -x0 = halui.mdi-command-04 -y0 = halui.mdi-command-05 -z0 = halui.mdi-command-06 - -goto_zero = halui.mdi-command-00 -# synthesized per-axis buttons for goto-zero button: -goto_zero_x = "" -goto_zero_y = "" -goto_zero_z = "" -goto_zero_a = "" - -step = xhc-hb04.stepsize-up -mode = "" -spindle = "" -reset = halui.estop.activate - [HALUI] # these are examples, edit as required: # a halui hal pin is created for each MDI_COMMAND below diff --git a/configs/sim/axis/xhc-hb04/layout2.inc b/configs/sim/axis/xhc-hb04/layout2.inc index f31fcb16604..3b2ec7ebf65 100644 --- a/configs/sim/axis/xhc-hb04/layout2.inc +++ b/configs/sim/axis/xhc-hb04/layout2.inc @@ -1,49 +1,3 @@ -[XHC_HB04_BUTTONS] -# use button names according to layout file LIB:xhc-hb04-layout{n}.cfg -# note: "start_pause" is connected for standard behavior -# controlling halui.pause/halui.resume/halui.run -# these are examples, edit as required: - -goto_zero = halui.mdi-command-00 -# synthesized per-axis buttons for goto-zero button: -goto_zero_x = "" -goto_zero_y = "" -goto_zero_z = "" -goto_zero_a = "" - -start_pause = std_start_pause -rewind = halui.program.step -# probe-input for simulating a probe: -probe_z = motion.probe-input -macro_3 = halui.mdi-command-03 - -half = halui.spindle.0.stop -# synthesized per-axis buttons for half button: -half_x = "" -half_y = "" -half_z = "" -half_a = "" - -zero = "" -# synthesized per-axis buttons for zero button: -zero_x = halui.mdi-command-12 -zero_y = halui.mdi-command-13 -zero_z = halui.mdi-command-14 -zero_a = halui.mdi-command-15 - -safe_z = halui.mdi-command-10 -# in this sim, home-all only works first time, hold down till finished: -home = halui.home-all -macro_1 = halui.mdi-command-01 -macro_2 = halui.mdi-command-02 -spindle = halui.spindle.0.start -step = xhc-hb04.stepsize-up -mode = "" -macro_6 = halui.mdi-command-06 -macro_7 = halui.mdi-command-07 -stop = halui.program.stop -reset = halui.estop.activate - [HALUI] # these are examples, edit as required: # a halui hal pin is created for each MDI_COMMAND below diff --git a/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.hal b/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.hal new file mode 100644 index 00000000000..8236f118293 --- /dev/null +++ b/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.hal @@ -0,0 +1,194 @@ +# HAL setup for the simulated XYZC machine with an XHC-HB04 layout 1 pendant. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +# user space components +loadusr -W hal_manualtoolchange +loadusr -W xhc-hb04 -s 2 -I $(HALLIB_DIR)/xhc-hb04-layout1.cfg -H + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyzc +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=4 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt xhc_hb04_util names=pendant_util +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread +addf pendant_util servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# pendant +setp axis.c.jog-accel-fraction 0.5 +setp axis.x.jog-accel-fraction 0.05 +setp axis.y.jog-accel-fraction 0.1 +setp halui.feed-override.scale 0.01 +setp halui.spindle.0.override.scale 0.01 +setp joint.0.jog-accel-fraction 0.05 +setp joint.1.jog-accel-fraction 0.1 +setp joint.3.jog-accel-fraction 0.5 +setp pendant_util.coef0 1 +setp pendant_util.coef1 1 +setp pendant_util.coef2 1 +setp pendant_util.coef3 1 +setp pendant_util.k 100 +setp pendant_util.scale0 100 +setp pendant_util.scale1 -100 +setp pendant_util.scale2 100 +setp pendant_util.scale3 100 +setp xhc-hb04.inch-icon TRUE +net pendant-feed-override halui.feed-override.value => xhc-hb04.feed-override +net pendant-feed-override-enable xhc-hb04.jog.enable-feed-override => halui.feed-override.count-enable +net pendant-feed-value motion.current-vel => xhc-hb04.feed-value +net pendant-goto-zero xhc-hb04.button-goto-zero => halui.mdi-command-00 +net pendant-home xhc-hb04.button-home => halui.home-all +net pendant-is-idle halui.program.is-idle => pendant_util.is-idle +net pendant-is-paused halui.program.is-paused => pendant_util.is-paused +net pendant-is-running halui.program.is-running => pendant_util.is-running +net pendant-jog-c xhc-hb04.jog.enable-a => axis.c.jog-enable joint.3.jog-enable +net pendant-jog-prescale xhc-hb04.jog.scale => pendant_util.divide-by-k-in +net pendant-jog-scale pendant_util.divide-by-k-out => axis.c.jog-scale axis.x.jog-scale axis.y.jog-scale axis.z.jog-scale joint.0.jog-scale joint.1.jog-scale joint.2.jog-scale joint.3.jog-scale +net pendant-jog-x xhc-hb04.jog.enable-x => axis.x.jog-enable joint.0.jog-enable +net pendant-jog-y xhc-hb04.jog.enable-y => axis.y.jog-enable joint.1.jog-enable +net pendant-jog-z xhc-hb04.jog.enable-z => axis.z.jog-enable joint.2.jog-enable +net pendant-pos-c halui.axis.c.pos-feedback => xhc-hb04.a.pos-absolute +net pendant-pos-rel-c halui.axis.c.pos-relative => xhc-hb04.a.pos-relative +net pendant-pos-rel-x halui.axis.x.pos-relative => xhc-hb04.x.pos-relative +net pendant-pos-rel-y halui.axis.y.pos-relative => xhc-hb04.y.pos-relative +net pendant-pos-rel-z halui.axis.z.pos-relative => xhc-hb04.z.pos-relative +net pendant-pos-x halui.axis.x.pos-feedback => xhc-hb04.x.pos-absolute +net pendant-pos-y halui.axis.y.pos-feedback => xhc-hb04.y.pos-absolute +net pendant-pos-z halui.axis.z.pos-feedback => xhc-hb04.z.pos-absolute +net pendant-probe-z xhc-hb04.button-probe-z => motion.probe-input +net pendant-program-pause pendant_util.pause => halui.program.pause +net pendant-program-resume pendant_util.resume => halui.program.resume +net pendant-program-run pendant_util.run => halui.mode.auto halui.program.run +net pendant-reset xhc-hb04.button-reset => halui.estop.activate +net pendant-rewind xhc-hb04.button-rewind => halui.program.step +net pendant-safe-z xhc-hb04.button-safe-z => halui.mdi-command-01 +net pendant-spindle-override halui.spindle.0.override.value => xhc-hb04.spindle-override +net pendant-spindle-override-enable xhc-hb04.jog.enable-spindle-override => halui.spindle.0.override.count-enable +net pendant-spindle-rps spindle.0.speed-out-rps-abs => xhc-hb04.spindle-rps +net pendant-start-or-pause xhc-hb04.button-start-pause => pendant_util.start-or-pause +net pendant-step xhc-hb04.button-step => xhc-hb04.stepsize-up +net pendant-stop xhc-hb04.button-stop => halui.program.stop +net pendant-wheel-counts xhc-hb04.jog.counts => halui.feed-override.counts halui.spindle.0.override.counts pendant_util.in0 pendant_util.in1 pendant_util.in2 pendant_util.in3 +net pendant-wheel-counts-c-filtered pendant_util.out3 => axis.c.jog-counts joint.3.jog-counts +net pendant-wheel-counts-x-filtered pendant_util.out0 => axis.x.jog-counts joint.0.jog-counts +net pendant-wheel-counts-y-filtered pendant_util.out1 => axis.y.jog-counts joint.1.jog-counts +net pendant-wheel-counts-z-filtered pendant_util.out2 => axis.z.jog-counts joint.2.jog-counts +net pendant-x0 xhc-hb04.button-x0 => halui.mdi-command-04 +net pendant-x2 xhc-hb04.button-x2 => halui.mdi-command-02 +net pendant-y0 xhc-hb04.button-y0 => halui.mdi-command-05 +net pendant-y2 xhc-hb04.button-y2 => halui.mdi-command-03 +net pendant-z0 xhc-hb04.button-z0 => halui.mdi-command-06 + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini b/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini index f57619ca97a..0af69bdd6bb 100644 --- a/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini +++ b/configs/sim/axis/xhc-hb04/xhc-hb04-layout1.ini @@ -7,37 +7,8 @@ VERSION = 1.1 MACHINE = xhc-hb04 layout1 demo [HAL] -HALFILE = LIB:basic_sim.tcl -HALFILE = LIB:xhc-hb04.tcl +HALFILE = ./xhc-hb04-layout1.hal HALUI = halui -[XHC_HB04_CONFIG] -# specify layout = n for LIB:xhc-hb04-layout{n}.cfg files -layout = 1 -# coords: specify upto 4 letters from set {x y z a b c u v w} -# coords: switch labels are xyza but any unique 4 letters -# from the set {xyxabcuvw) can be used (if the coord exists) -coords = x y z c -# lowpass settings: -# coef: slows rate of change of output, range: 0 < coef < 1 -coefs = 1 1 1 1 -# scale plus or minus, rotaries may require larger scale factor: -scales = 1 -1 1 1 -# jogmode normal(default) or vnormal -jogmode = normal -# sequence 1: 0.001,0.010,0.100,1.000 (mm-based machine) -# sequence 2: 0.001,0.005,0.010,0.020 (inch-based machine) -# sequence 3: 0.001,0.010,0.100 -# sequence 4: 0.001,0.005,0.010,0.020,0.050,0.100 -# sequence 5: 0.001,0.010,0.050,0.100,1.000 -sequence = 2 -# require_pendant = yes|no: create xhc-hb04 hal pins when pendant not -# connected at startup -require_pendant = no -# inch_or_mm = in | mm -inch_or_mm = in -# mpg_accels: provision for reduced acceleration for manual mode jogging -mpg_accels = 1 2 20 600 - [APPLICATIONS] APP = monitor-xhc-hb04 diff --git a/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.hal b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.hal new file mode 100644 index 00000000000..de6000ad939 --- /dev/null +++ b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.hal @@ -0,0 +1,200 @@ +# HAL setup for the simulated XYZC machine with an XHC-HB04 layout 2 pendant. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +# user space components +loadusr -W hal_manualtoolchange +loadusr -W xhc-hb04 -s 2 -I $(HALLIB_DIR)/xhc-hb04-layout2.cfg -H + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyzc +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=4 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt xhc_hb04_util names=pendant_util +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread +addf pendant_util servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# pendant +setp axis.c.jog-accel-fraction 0.5 +setp axis.x.jog-accel-fraction 0.05 +setp axis.y.jog-accel-fraction 0.1 +setp halui.feed-override.scale 0.01 +setp halui.spindle.0.override.scale 0.01 +setp joint.0.jog-accel-fraction 0.05 +setp joint.1.jog-accel-fraction 0.1 +setp joint.3.jog-accel-fraction 0.5 +setp pendant_util.coef0 1 +setp pendant_util.coef1 1 +setp pendant_util.coef2 1 +setp pendant_util.coef3 1 +setp pendant_util.k 100 +setp pendant_util.scale0 100 +setp pendant_util.scale1 -100 +setp pendant_util.scale2 100 +setp pendant_util.scale3 100 +setp xhc-hb04.inch-icon TRUE +net pendant-feed-override halui.feed-override.value => xhc-hb04.feed-override +net pendant-feed-override-enable xhc-hb04.jog.enable-feed-override => halui.feed-override.count-enable +net pendant-feed-value motion.current-vel => xhc-hb04.feed-value +net pendant-goto-zero xhc-hb04.button-goto-zero => halui.mdi-command-00 +net pendant-half xhc-hb04.button-half => halui.spindle.0.stop +net pendant-home xhc-hb04.button-home => halui.home-all +net pendant-is-idle halui.program.is-idle => pendant_util.is-idle +net pendant-is-paused halui.program.is-paused => pendant_util.is-paused +net pendant-is-running halui.program.is-running => pendant_util.is-running +net pendant-jog-c xhc-hb04.jog.enable-a => axis.c.jog-enable joint.3.jog-enable +net pendant-jog-prescale xhc-hb04.jog.scale => pendant_util.divide-by-k-in +net pendant-jog-scale pendant_util.divide-by-k-out => axis.c.jog-scale axis.x.jog-scale axis.y.jog-scale axis.z.jog-scale joint.0.jog-scale joint.1.jog-scale joint.2.jog-scale joint.3.jog-scale +net pendant-jog-x xhc-hb04.jog.enable-x => axis.x.jog-enable joint.0.jog-enable +net pendant-jog-y xhc-hb04.jog.enable-y => axis.y.jog-enable joint.1.jog-enable +net pendant-jog-z xhc-hb04.jog.enable-z => axis.z.jog-enable joint.2.jog-enable +net pendant-macro-1 xhc-hb04.button-macro-1 => halui.mdi-command-01 +net pendant-macro-2 xhc-hb04.button-macro-2 => halui.mdi-command-02 +net pendant-macro-3 xhc-hb04.button-macro-3 => halui.mdi-command-03 +net pendant-macro-6 xhc-hb04.button-macro-6 => halui.mdi-command-06 +net pendant-macro-7 xhc-hb04.button-macro-7 => halui.mdi-command-07 +net pendant-pos-c halui.axis.c.pos-feedback => xhc-hb04.a.pos-absolute +net pendant-pos-rel-c halui.axis.c.pos-relative => xhc-hb04.a.pos-relative +net pendant-pos-rel-x halui.axis.x.pos-relative => xhc-hb04.x.pos-relative +net pendant-pos-rel-y halui.axis.y.pos-relative => xhc-hb04.y.pos-relative +net pendant-pos-rel-z halui.axis.z.pos-relative => xhc-hb04.z.pos-relative +net pendant-pos-x halui.axis.x.pos-feedback => xhc-hb04.x.pos-absolute +net pendant-pos-y halui.axis.y.pos-feedback => xhc-hb04.y.pos-absolute +net pendant-pos-z halui.axis.z.pos-feedback => xhc-hb04.z.pos-absolute +net pendant-probe-z xhc-hb04.button-probe-z => motion.probe-input +net pendant-program-pause pendant_util.pause => halui.program.pause +net pendant-program-resume pendant_util.resume => halui.program.resume +net pendant-program-run pendant_util.run => halui.mode.auto halui.program.run +net pendant-reset xhc-hb04.button-reset => halui.estop.activate +net pendant-rewind xhc-hb04.button-rewind => halui.program.step +net pendant-safe-z xhc-hb04.button-safe-z => halui.mdi-command-10 +net pendant-spindle xhc-hb04.button-spindle => halui.spindle.0.start +net pendant-spindle-override halui.spindle.0.override.value => xhc-hb04.spindle-override +net pendant-spindle-override-enable xhc-hb04.jog.enable-spindle-override => halui.spindle.0.override.count-enable +net pendant-spindle-rps spindle.0.speed-out-rps-abs => xhc-hb04.spindle-rps +net pendant-start-or-pause xhc-hb04.button-start-pause => pendant_util.start-or-pause +net pendant-step xhc-hb04.button-step => xhc-hb04.stepsize-up +net pendant-stop xhc-hb04.button-stop => halui.program.stop +net pendant-wheel-counts xhc-hb04.jog.counts => halui.feed-override.counts halui.spindle.0.override.counts pendant_util.in0 pendant_util.in1 pendant_util.in2 pendant_util.in3 +net pendant-wheel-counts-c-filtered pendant_util.out3 => axis.c.jog-counts joint.3.jog-counts +net pendant-wheel-counts-x-filtered pendant_util.out0 => axis.x.jog-counts joint.0.jog-counts +net pendant-wheel-counts-y-filtered pendant_util.out1 => axis.y.jog-counts joint.1.jog-counts +net pendant-wheel-counts-z-filtered pendant_util.out2 => axis.z.jog-counts joint.2.jog-counts +net pendant-zero-a xhc-hb04.button-zero-a => halui.mdi-command-15 +net pendant-zero-x xhc-hb04.button-zero-x => halui.mdi-command-12 +net pendant-zero-y xhc-hb04.button-zero-y => halui.mdi-command-13 +net pendant-zero-z xhc-hb04.button-zero-z => halui.mdi-command-14 + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.ini b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.ini index eba145fc3fb..3dfca42bd53 100644 --- a/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.ini +++ b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2.ini @@ -7,37 +7,8 @@ VERSION = 1.1 MACHINE = xhc-hb04 layout2 demo [HAL] -HALFILE = LIB:basic_sim.tcl -HALFILE = LIB:xhc-hb04.tcl +HALFILE = ./xhc-hb04-layout2.hal HALUI = halui -[XHC_HB04_CONFIG] -# specify layout = n for LIB:xhc-hb04-layout{n}.cfg files -layout = 2 -# coords: specify upto 4 letters from set {x y z a b c u v w} -# coords: switch labels are xyza but any unique 4 letters -# from the set {xyxabcuvw) can be used (if the coord exists) -coords = x y z c -# lowpass settings: -# coef: slows rate of change of output, range: 0 < coef < 1 -coefs = 1 1 1 1 -# scale plus or minus, rotaries may require larger scale factor: -scales = 1 -1 1 1 -# jogmode normal(default) or vnormal -jogmode = normal -# sequence 1: 0.001,0.010,0.100,1.000 (mm-based machine) -# sequence 2: 0.001,0.005,0.010,0.020 (inch-based machine) -# sequence 3: 0.001,0.010,0.100 -# sequence 4: 0.001,0.005,0.010,0.020,0.050,0.100 -# sequence 5: 0.001,0.010,0.050,0.100,1.000 -sequence = 2 -# require_pendant = yes|no: create xhc-hb04 hal pins when pendant not -# connected at startup -require_pendant = no -# inch_or_mm = in | mm -inch_or_mm = in -# mpg_accels: provision for reduced acceleration for manual mode jogging -mpg_accels = 1 2 20 600 - [APPLICATIONS] APP = monitor-xhc-hb04 diff --git a/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.hal b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.hal new file mode 100644 index 00000000000..da7257db59a --- /dev/null +++ b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.hal @@ -0,0 +1,196 @@ +# HAL setup for the simulated metric XYZC machine with an XHC-HB04 layout 2 pendant. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +# user space components +loadusr -W hal_manualtoolchange +loadusr -W xhc-hb04 -s 1 -I $(HALLIB_DIR)/xhc-hb04-layout2.cfg -H + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=4 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt xhc_hb04_util names=pendant_util +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread +addf pendant_util servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# pendant +setp axis.c.jog-accel-fraction 0.5 +setp axis.x.jog-accel-fraction 0.0984252 +setp axis.y.jog-accel-fraction 0.0984252 +setp axis.z.jog-accel-fraction 0.984252 +setp halui.feed-override.scale 0.01 +setp halui.spindle.0.override.scale 0.01 +setp joint.0.jog-accel-fraction 0.0984252 +setp joint.1.jog-accel-fraction 0.0984252 +setp joint.2.jog-accel-fraction 0.984252 +setp joint.3.jog-accel-fraction 0.5 +setp pendant_util.coef0 1 +setp pendant_util.coef1 1 +setp pendant_util.coef2 1 +setp pendant_util.coef3 1 +setp pendant_util.k 100 +setp pendant_util.scale0 100 +setp pendant_util.scale1 -100 +setp pendant_util.scale2 100 +setp pendant_util.scale3 100 +setp xhc-hb04.inch-icon FALSE +net pendant-feed-override halui.feed-override.value => xhc-hb04.feed-override +net pendant-feed-override-enable xhc-hb04.jog.enable-feed-override => halui.feed-override.count-enable +net pendant-feed-value motion.current-vel => xhc-hb04.feed-value +net pendant-goto-zero xhc-hb04.button-goto-zero => halui.mdi-command-00 +net pendant-half xhc-hb04.button-half => halui.spindle.0.stop +net pendant-home xhc-hb04.button-home => halui.home-all +net pendant-is-idle halui.program.is-idle => pendant_util.is-idle +net pendant-is-paused halui.program.is-paused => pendant_util.is-paused +net pendant-is-running halui.program.is-running => pendant_util.is-running +net pendant-jog-c xhc-hb04.jog.enable-a => axis.c.jog-enable joint.3.jog-enable +net pendant-jog-prescale xhc-hb04.jog.scale => pendant_util.divide-by-k-in +net pendant-jog-scale pendant_util.divide-by-k-out => axis.c.jog-scale axis.x.jog-scale axis.y.jog-scale axis.z.jog-scale joint.0.jog-scale joint.1.jog-scale joint.2.jog-scale joint.3.jog-scale +net pendant-jog-x xhc-hb04.jog.enable-x => axis.x.jog-enable joint.0.jog-enable +net pendant-jog-y xhc-hb04.jog.enable-y => axis.y.jog-enable joint.1.jog-enable +net pendant-jog-z xhc-hb04.jog.enable-z => axis.z.jog-enable joint.2.jog-enable +net pendant-macro-1 xhc-hb04.button-macro-1 => halui.mdi-command-01 +net pendant-macro-2 xhc-hb04.button-macro-2 => halui.mdi-command-02 +net pendant-macro-3 xhc-hb04.button-macro-3 => halui.mdi-command-03 +net pendant-macro-6 xhc-hb04.button-macro-6 => halui.mdi-command-06 +net pendant-macro-7 xhc-hb04.button-macro-7 => halui.mdi-command-07 +net pendant-pos-c halui.axis.c.pos-feedback => xhc-hb04.a.pos-absolute +net pendant-pos-rel-c halui.axis.c.pos-relative => xhc-hb04.a.pos-relative +net pendant-pos-rel-x halui.axis.x.pos-relative => xhc-hb04.x.pos-relative +net pendant-pos-rel-y halui.axis.y.pos-relative => xhc-hb04.y.pos-relative +net pendant-pos-rel-z halui.axis.z.pos-relative => xhc-hb04.z.pos-relative +net pendant-pos-x halui.axis.x.pos-feedback => xhc-hb04.x.pos-absolute +net pendant-pos-y halui.axis.y.pos-feedback => xhc-hb04.y.pos-absolute +net pendant-pos-z halui.axis.z.pos-feedback => xhc-hb04.z.pos-absolute +net pendant-probe-z xhc-hb04.button-probe-z => motion.probe-input +net pendant-program-pause pendant_util.pause => halui.program.pause +net pendant-program-resume pendant_util.resume => halui.program.resume +net pendant-program-run pendant_util.run => halui.mode.auto halui.program.run +net pendant-reset xhc-hb04.button-reset => halui.estop.activate +net pendant-rewind xhc-hb04.button-rewind => halui.program.step +net pendant-safe-z xhc-hb04.button-safe-z => halui.mdi-command-10 +net pendant-spindle xhc-hb04.button-spindle => halui.spindle.0.start +net pendant-spindle-override halui.spindle.0.override.value => xhc-hb04.spindle-override +net pendant-spindle-override-enable xhc-hb04.jog.enable-spindle-override => halui.spindle.0.override.count-enable +net pendant-spindle-rps spindle.0.speed-out-rps-abs => xhc-hb04.spindle-rps +net pendant-start-or-pause xhc-hb04.button-start-pause => pendant_util.start-or-pause +net pendant-step xhc-hb04.button-step => xhc-hb04.stepsize-up +net pendant-stop xhc-hb04.button-stop => halui.program.stop +net pendant-wheel-counts xhc-hb04.jog.counts => halui.feed-override.counts halui.spindle.0.override.counts pendant_util.in0 pendant_util.in1 pendant_util.in2 pendant_util.in3 +net pendant-wheel-counts-c-filtered pendant_util.out3 => axis.c.jog-counts joint.3.jog-counts +net pendant-wheel-counts-x-filtered pendant_util.out0 => axis.x.jog-counts joint.0.jog-counts +net pendant-wheel-counts-y-filtered pendant_util.out1 => axis.y.jog-counts joint.1.jog-counts +net pendant-wheel-counts-z-filtered pendant_util.out2 => axis.z.jog-counts joint.2.jog-counts +net pendant-zero-a xhc-hb04.button-zero-a => halui.mdi-command-15 +net pendant-zero-x xhc-hb04.button-zero-x => halui.mdi-command-12 +net pendant-zero-y xhc-hb04.button-zero-y => halui.mdi-command-13 +net pendant-zero-z xhc-hb04.button-zero-z => halui.mdi-command-14 + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.ini b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.ini index 820f965f002..e98e4638a0d 100644 --- a/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.ini +++ b/configs/sim/axis/xhc-hb04/xhc-hb04-layout2_mm.ini @@ -8,36 +8,7 @@ MACHINE = xhc-hb04 layout2 mm demo [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -HALFILE = LIB:xhc-hb04.tcl - -[XHC_HB04_CONFIG] -# specify layout = n for LIB:xhc-hb04-layout{n}.cfg files -layout = 2 -# coords: specify upto 4 letters from set {x y z a b c u v w} -# coords: switch labels are xyza but any unique 4 letters -# from the set {xyxabcuvw) can be used (if the coord exists) -coords = x y z c -# lowpass settings: -# coef: slows rate of change of output, range: 0 < coef < 1 -coefs = 1 1 1 1 -# scale plus or minus, rotaries may require larger scale factor: -scales = 1 -1 1 1 -# jogmode normal(default) or vnormal -jogmode = normal -# sequence 1: 0.001,0.010,0.100,1.000 (mm-based machine) -# sequence 2: 0.001,0.005,0.010,0.020 (inch-based machine) -# sequence 3: 0.001,0.010,0.100 -# sequence 4: 0.001,0.005,0.010,0.020,0.050,0.100 -# sequence 5: 0.001,0.010,0.050,0.100,1.000 -sequence = 1 -# require_pendant = yes|no: create xhc-hb04 hal pins when pendant noti -# connected at startup -require_pendant = no -# inch_or_mm = in | mm -inch_or_mm = mm -# mpg_accels: provision for reduced acceleration for manual mode jogging -mpg_accels = 50 50 500 600 +HALFILE = ./xhc-hb04-layout2_mm.hal [APPLICATIONS] APP = monitor-xhc-hb04 diff --git a/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt.hal b/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt.hal new file mode 100644 index 00000000000..02021bf148a --- /dev/null +++ b/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt.hal @@ -0,0 +1,123 @@ +# HAL setup for the Gmoccapy XYZAC rotary-tilting machine. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadrt xyzac-trt-kins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=5 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1.0 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared diff --git a/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt.ini b/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt.ini index ad1ea4a3877..c11b53c6601 100644 --- a/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt.ini +++ b/configs/sim/gmoccapy/non_trivial_kinematics/table-rotary-tilting/xyzac-trt.ini @@ -32,7 +32,7 @@ LOG_LEVEL = 0 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -no_use_hal_manualtoolchange +HALFILE = ./xyzac-trt.hal # vismach xyzac-trt-gui items HALCMD = loadusr -W ./xyzac-trt-gui.py diff --git a/configs/sim/gscreen/gscreen_custom/9axis.hal b/configs/sim/gscreen/gscreen_custom/9axis.hal new file mode 100644 index 00000000000..5cef45c8bbf --- /dev/null +++ b/configs/sim/gscreen/gscreen_custom/9axis.hal @@ -0,0 +1,206 @@ +# Core HAL setup for the Gscreen nine-axis simulation. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod unlock_joints_mask=0x10 base_period_nsec=0 servo_period_nsec=1000000 num_joints=9 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid,J6_pid,J7_pid,J8_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux,J6_mux,J7_mux,J8_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel,J6_vel,J6_accel,J7_vel,J7_accel,J8_vel,J8_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch,J6_switch,J7_switch,J8_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J6_pid.do-pid-calcs servo-thread +addf J7_pid.do-pid-calcs servo-thread +addf J8_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J6_mux servo-thread +addf J7_mux servo-thread +addf J8_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J6_vel servo-thread +addf J6_accel servo-thread +addf J7_vel servo-thread +addf J7_accel servo-thread +addf J8_vel servo-thread +addf J8_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf J6_switch servo-thread +addf J7_switch servo-thread +addf J8_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel J6_mux.sel J7_mux.sel J8_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# joint 6 +setp J6_pid.FF0 1 +setp J6_pid.Pgain 0 +setp J6_switch.home-pos 0.1 +setp J6_switch.hysteresis 0.05 +net j6-enable joint.6.amp-enable-out => J6_pid.enable +net j6-home-sw J6_switch.home-sw => joint.6.home-sw-in +net j6-pid-output J6_pid.output => J6_mux.in1 +net j6-pos-cmd joint.6.motor-pos-cmd => J6_pid.command +net j6-pos-fb J6_mux.out => J6_mux.in0 J6_switch.cur-pos J6_vel.in joint.6.motor-pos-fb +net j6-vel J6_vel.out => J6_accel.in + +# joint 7 +setp J7_pid.FF0 1 +setp J7_pid.Pgain 0 +setp J7_switch.home-pos 0.1 +setp J7_switch.hysteresis 0.05 +net j7-enable joint.7.amp-enable-out => J7_pid.enable +net j7-home-sw J7_switch.home-sw => joint.7.home-sw-in +net j7-pid-output J7_pid.output => J7_mux.in1 +net j7-pos-cmd joint.7.motor-pos-cmd => J7_pid.command +net j7-pos-fb J7_mux.out => J7_mux.in0 J7_switch.cur-pos J7_vel.in joint.7.motor-pos-fb +net j7-vel J7_vel.out => J7_accel.in + +# joint 8 +setp J8_pid.FF0 1 +setp J8_pid.Pgain 0 +setp J8_switch.home-pos 0.1 +setp J8_switch.hysteresis 0.05 +net j8-enable joint.8.amp-enable-out => J8_pid.enable +net j8-home-sw J8_switch.home-sw => joint.8.home-sw-in +net j8-pid-output J8_pid.output => J8_mux.in1 +net j8-pos-cmd joint.8.motor-pos-cmd => J8_pid.command +net j8-pos-fb J8_mux.out => J8_mux.in0 J8_switch.cur-pos J8_vel.in joint.8.motor-pos-fb +net j8-vel J8_vel.out => J8_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/gscreen/gscreen_custom/9axis.ini b/configs/sim/gscreen/gscreen_custom/9axis.ini index df7d9e91fd3..6d429af016a 100644 --- a/configs/sim/gscreen/gscreen_custom/9axis.ini +++ b/configs/sim/gscreen/gscreen_custom/9axis.ini @@ -92,7 +92,7 @@ CYCLE_TIME = 0.001 # list of hal config files to run through halcmd # files are executed in the order in which they appear -HALFILE = LIB:basic_sim.tcl +HALFILE = ./9axis.hal HALFILE = locking_indexer.hal # list of halcmd commands to execute diff --git a/configs/sim/gscreen/gscreen_lathe.hal b/configs/sim/gscreen/gscreen_lathe.hal new file mode 100644 index 00000000000..2d9103cb020 --- /dev/null +++ b/configs/sim/gscreen/gscreen_lathe.hal @@ -0,0 +1,89 @@ +# Core HAL setup for the Gscreen lathe simulation. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/gscreen/gscreen_lathe.ini b/configs/sim/gscreen/gscreen_lathe.ini index b219e1e5931..498b7e60ad4 100644 --- a/configs/sim/gscreen/gscreen_lathe.ini +++ b/configs/sim/gscreen/gscreen_lathe.ini @@ -34,7 +34,7 @@ PARAMETER_FILE = sim.var [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 -BASE_PERIOD = 50000 +BASE_PERIOD = 0 SERVO_PERIOD = 1000000 [TASK] @@ -43,7 +43,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui - HALFILE = LIB:basic_sim.tcl + HALFILE = ./gscreen_lathe.hal POSTGUI_HALFILE = lathe_postgui.hal [TRAJ] diff --git a/configs/sim/gscreen/industrial_lathe_wear/industrial_lathe_wear.hal b/configs/sim/gscreen/industrial_lathe_wear/industrial_lathe_wear.hal new file mode 100644 index 00000000000..78eb29e86ff --- /dev/null +++ b/configs/sim/gscreen/industrial_lathe_wear/industrial_lathe_wear.hal @@ -0,0 +1,89 @@ +# Core HAL setup for the Gscreen industrial lathe-wear demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/gscreen/industrial_lathe_wear/industrial_lathe_wear.ini b/configs/sim/gscreen/industrial_lathe_wear/industrial_lathe_wear.ini index a18d281d567..05b6a28a0ac 100644 --- a/configs/sim/gscreen/industrial_lathe_wear/industrial_lathe_wear.ini +++ b/configs/sim/gscreen/industrial_lathe_wear/industrial_lathe_wear.ini @@ -45,7 +45,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./industrial_lathe_wear.hal POSTGUI_HALFILE = lathe_postgui.hal [TRAJ] diff --git a/configs/sim/gscreen/ngcgui/pyngcgui_gscreen.hal b/configs/sim/gscreen/ngcgui/pyngcgui_gscreen.hal new file mode 100644 index 00000000000..9fd6ce66d9d --- /dev/null +++ b/configs/sim/gscreen/ngcgui/pyngcgui_gscreen.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the PyNGCGUI Gscreen demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/gscreen/ngcgui/pyngcgui_gscreen.ini b/configs/sim/gscreen/ngcgui/pyngcgui_gscreen.ini index dd440ecb6d3..996fb3771e6 100644 --- a/configs/sim/gscreen/ngcgui/pyngcgui_gscreen.ini +++ b/configs/sim/gscreen/ngcgui/pyngcgui_gscreen.ini @@ -92,7 +92,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./pyngcgui_gscreen.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/gscreen/ngcgui/pyngcgui_gscreen_popupkeyboard.hal b/configs/sim/gscreen/ngcgui/pyngcgui_gscreen_popupkeyboard.hal new file mode 100644 index 00000000000..aace7b2987d --- /dev/null +++ b/configs/sim/gscreen/ngcgui/pyngcgui_gscreen_popupkeyboard.hal @@ -0,0 +1,109 @@ +# Core HAL setup for PyNGCGUI Gscreen with a popup keyboard. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/gscreen/ngcgui/pyngcgui_gscreen_popupkeyboard.ini b/configs/sim/gscreen/ngcgui/pyngcgui_gscreen_popupkeyboard.ini index fb90d8ac85b..e009e798a2c 100644 --- a/configs/sim/gscreen/ngcgui/pyngcgui_gscreen_popupkeyboard.ini +++ b/configs/sim/gscreen/ngcgui/pyngcgui_gscreen_popupkeyboard.ini @@ -89,7 +89,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./pyngcgui_gscreen_popupkeyboard.hal [TRAJ] COORDINATES = X Y Z diff --git a/configs/sim/qtaxis/non-trivial/scara/scara.hal b/configs/sim/qtaxis/non-trivial/scara/scara.hal new file mode 100644 index 00000000000..af63c01f697 --- /dev/null +++ b/configs/sim/qtaxis/non-trivial/scara/scara.hal @@ -0,0 +1,145 @@ +# HAL setup for the QtAxis SCARA robot simulation. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt scarakins coordinates=xyzcab +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1.0 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1.0 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/qtaxis/non-trivial/scara/scara.ini b/configs/sim/qtaxis/non-trivial/scara/scara.ini index e1a9c853255..f2b1005c0ca 100644 --- a/configs/sim/qtaxis/non-trivial/scara/scara.ini +++ b/configs/sim/qtaxis/non-trivial/scara/scara.ini @@ -120,7 +120,7 @@ KINEMATICS = scarakins coordinates=xyzcab [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./scara.hal [HALUI] # M428:scara kins (kinstype==0 startupDEFAULT) diff --git a/configs/sim/qtdragon_lathe/basic_xz_lathe/lathe.hal b/configs/sim/qtdragon_lathe/basic_xz_lathe/lathe.hal new file mode 100644 index 00000000000..3baa09be736 --- /dev/null +++ b/configs/sim/qtdragon_lathe/basic_xz_lathe/lathe.hal @@ -0,0 +1,89 @@ +# Core HAL setup for the QtDragon XZ lathe simulation. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/qtdragon_lathe/basic_xz_lathe/lathe.ini b/configs/sim/qtdragon_lathe/basic_xz_lathe/lathe.ini index 6d5a04b2c14..2571235e6f4 100644 --- a/configs/sim/qtdragon_lathe/basic_xz_lathe/lathe.ini +++ b/configs/sim/qtdragon_lathe/basic_xz_lathe/lathe.ini @@ -48,7 +48,7 @@ SUBROUTINE_PATH = ../../../../nc_files/macros/lathe [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 - BASE_PERIOD = 50000 + BASE_PERIOD = 0 SERVO_PERIOD = 1000000 [TASK] @@ -59,7 +59,7 @@ CYCLE_TIME = 0.001 HALUI = halui HALBRIDGE = hal_bridge -HALFILE = LIB:basic_sim.tcl +HALFILE = ./lathe.hal POSTGUI_HALFILE = lathe_postgui.hal [TRAJ] diff --git a/configs/sim/qtplasmac/qtplasmac_imperial.hal b/configs/sim/qtplasmac/qtplasmac_imperial.hal new file mode 100644 index 00000000000..7117b1f381a --- /dev/null +++ b/configs/sim/qtplasmac/qtplasmac_imperial.hal @@ -0,0 +1,131 @@ +# HAL setup for the imperial QtPlasmaC simulations. +# Shared by the qtplasmac_l, qtplasmac_p, and qtplasmac_s imperial INI files. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyyz +loadrt motmod servo_period_nsec=1000000 num_joints=4 num_spindles=3 +loadrt plasmac +loadrt pid names=sim-joint.0.pid,sim-joint.1.pid,sim-joint.2.pid,sim-joint.3.pid +loadrt mux2 names=sim-joint.0.mux,sim-joint.1.mux,sim-joint.2.mux,sim-joint.3.mux +loadrt ddt names=sim-joint.0.vel,sim-joint.1.vel,sim-joint.2.vel,sim-joint.3.vel +loadrt sim_home_switch names=sim-joint.0.home-switch,sim-joint.1.home-switch,sim-joint.2.home-switch,sim-joint.3.home-switch +loadrt dbounce names=db_breakaway,db_float,db_ohmic,db_arc-ok +loadrt or2 names=estop_or +loadrt not names=estop_not,estop_not_1 +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf plasmac servo-thread +addf sim-joint.0.pid.do-pid-calcs servo-thread +addf sim-joint.0.mux servo-thread +addf sim-joint.0.vel servo-thread +addf sim-joint.1.pid.do-pid-calcs servo-thread +addf sim-joint.1.mux servo-thread +addf sim-joint.1.vel servo-thread +addf sim-joint.2.pid.do-pid-calcs servo-thread +addf sim-joint.2.mux servo-thread +addf sim-joint.2.vel servo-thread +addf sim-joint.3.pid.do-pid-calcs servo-thread +addf sim-joint.3.mux servo-thread +addf sim-joint.3.vel servo-thread +addf sim-joint.0.home-switch servo-thread +addf sim-joint.1.home-switch servo-thread +addf sim-joint.2.home-switch servo-thread +addf sim-joint.3.home-switch servo-thread +addf db_float servo-thread +addf db_ohmic servo-thread +addf db_breakaway servo-thread +addf db_arc-ok servo-thread +addf estop_or servo-thread +addf estop_not servo-thread +addf estop_not_1 servo-thread +# pin aliases +# param aliases +# signals +# nets +net machine-is-on halui.machine.is-on => plasmac.machine-is-on +net plasmac:adaptive-feed plasmac.adaptive-feed => motion.adaptive-feed +net plasmac:arc-ok db_arc-ok.out => plasmac.arc-ok-in +net plasmac:axis-position joint.3.pos-fb => plasmac.axis-z-position +net plasmac:axis-x-position axis.x.pos-cmd => plasmac.axis-x-position +net plasmac:axis-y-position axis.y.pos-cmd => plasmac.axis-y-position +net plasmac:breakaway-switch-out db_breakaway.out => plasmac.breakaway +net plasmac:current-velocity motion.current-vel => plasmac.current-velocity +net plasmac:cutting-start spindle.0.on => plasmac.cutting-start +net plasmac:cutting-stop plasmac.cutting-stop => halui.spindle.0.stop +net plasmac:feed-hold plasmac.feed-hold => motion.feed-hold +net plasmac:feed-override halui.feed-override.value => plasmac.feed-override +net plasmac:feed-reduction motion.analog-out-03 => plasmac.feed-reduction +net plasmac:feed-upm motion.feed-upm => plasmac.feed-upm +net plasmac:float-switch-out db_float.out => plasmac.float-switch +net plasmac:homed motion.is-all-homed => plasmac.homed +net plasmac:ignore-arc-ok-0 motion.digital-out-01 => plasmac.ignore-arc-ok-0 +net plasmac:jog-inhibit plasmac.jog-inhibit => motion.jog-inhibit motion.jog-stop +net plasmac:motion-type motion.motion-type => plasmac.motion-type +net plasmac:offset-scale plasmac.offset-scale => axis.x.eoffset-scale axis.y.eoffset-scale axis.z.eoffset-scale +net plasmac:offsets-active motion.eoffset-active => plasmac.offsets-active +net plasmac:ohmic-probe-out db_ohmic.out => plasmac.ohmic-probe +net plasmac:probe-out plasmac.probe-out => motion.probe-input +net plasmac:program-is-idle halui.program.is-idle => plasmac.program-is-idle +net plasmac:program-is-paused halui.program.is-paused => plasmac.program-is-paused +net plasmac:program-is-running halui.program.is-running => plasmac.program-is-running +net plasmac:program-pause plasmac.program-pause => halui.program.pause +net plasmac:program-resume plasmac.program-resume => halui.program.resume +net plasmac:program-run plasmac.program-run => halui.program.run +net plasmac:program-stop plasmac.program-stop => halui.program.stop +net plasmac:scribe-start spindle.1.on => plasmac.scribe-start +net plasmac:spotting-start spindle.2.on => plasmac.spotting-start +net plasmac:thc-disable motion.digital-out-02 => plasmac.thc-disable +net plasmac:torch-off motion.digital-out-03 => plasmac.torch-off +net plasmac:torch-on plasmac.torch-on +net plasmac:units-per-mm halui.machine.units-per-mm => plasmac.units-per-mm +net plasmac:x-offset-counts plasmac.x-offset-counts => axis.x.eoffset-counts +net plasmac:x-offset-current axis.x.eoffset => plasmac.x-offset-current +net plasmac:xy-offset-enable plasmac.xy-offset-enable => axis.x.eoffset-enable axis.y.eoffset-enable +net plasmac:y-offset-counts plasmac.y-offset-counts => axis.y.eoffset-counts +net plasmac:y-offset-current axis.y.eoffset => plasmac.y-offset-current +net plasmac:z-offset-counts plasmac.z-offset-counts => axis.z.eoffset-counts +net plasmac:z-offset-current axis.z.eoffset => plasmac.z-offset-current +net plasmac:z-offset-enable plasmac.z-offset-enable => axis.z.eoffset-enable +net sim:enabled motion.motion-enabled => sim-joint.0.mux.sel sim-joint.1.mux.sel sim-joint.2.mux.sel sim-joint.3.mux.sel +net sim:estop-out estop_not.out => iocontrol.0.emc-enable-in +net sim:estop-raw estop_or.out => estop_not.in +net sim:joint0.enable joint.0.amp-enable-out => sim-joint.0.pid.enable +net sim:joint0.homesw sim-joint.0.home-switch.home-sw => joint.0.home-sw-in +net sim:joint0.on-pos sim-joint.0.pid.output => sim-joint.0.mux.in1 +net sim:joint0.pos-cmd joint.0.motor-pos-cmd => sim-joint.0.pid.command +net sim:joint0.pos-fb sim-joint.0.mux.out => joint.0.motor-pos-fb sim-joint.0.home-switch.cur-pos sim-joint.0.mux.in0 sim-joint.0.vel.in +net sim:joint1.enable joint.1.amp-enable-out => sim-joint.1.pid.enable +net sim:joint1.homesw sim-joint.1.home-switch.home-sw => joint.1.home-sw-in +net sim:joint1.on-pos sim-joint.1.pid.output => sim-joint.1.mux.in1 +net sim:joint1.pos-cmd joint.1.motor-pos-cmd => sim-joint.1.pid.command +net sim:joint1.pos-fb sim-joint.1.mux.out => joint.1.motor-pos-fb sim-joint.1.home-switch.cur-pos sim-joint.1.mux.in0 sim-joint.1.vel.in +net sim:joint2.enable joint.2.amp-enable-out => sim-joint.2.pid.enable +net sim:joint2.homesw sim-joint.2.home-switch.home-sw => joint.2.home-sw-in +net sim:joint2.on-pos sim-joint.2.pid.output => sim-joint.2.mux.in1 +net sim:joint2.pos-cmd joint.2.motor-pos-cmd => sim-joint.2.pid.command +net sim:joint2.pos-fb sim-joint.2.mux.out => joint.2.motor-pos-fb sim-joint.2.home-switch.cur-pos sim-joint.2.mux.in0 sim-joint.2.vel.in +net sim:joint3.enable joint.3.amp-enable-out => sim-joint.3.pid.enable +net sim:joint3.homesw sim-joint.3.home-switch.home-sw => joint.3.home-sw-in +net sim:joint3.on-pos sim-joint.3.pid.output => sim-joint.3.mux.in1 +net sim:joint3.pos-cmd joint.3.motor-pos-cmd => sim-joint.3.pid.command +net sim:joint3.pos-fb sim-joint.3.mux.out => joint.3.motor-pos-fb sim-joint.3.home-switch.cur-pos sim-joint.3.mux.in0 sim-joint.3.vel.in +net sim:tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed +net sim:tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +# joint PID settings +setp sim-joint.0.pid.FF0 1 +setp sim-joint.0.pid.Pgain 0 +setp sim-joint.1.pid.FF0 1 +setp sim-joint.1.pid.Pgain 0 +setp sim-joint.2.pid.FF0 1 +setp sim-joint.2.pid.Pgain 0 +setp sim-joint.3.pid.FF0 1 +setp sim-joint.3.pid.Pgain 0 diff --git a/configs/sim/qtplasmac/qtplasmac_imperial_ini.inc b/configs/sim/qtplasmac/qtplasmac_imperial_ini.inc index 23f990a8d0e..08b37f527a0 100644 --- a/configs/sim/qtplasmac/qtplasmac_imperial_ini.inc +++ b/configs/sim/qtplasmac/qtplasmac_imperial_ini.inc @@ -12,11 +12,7 @@ SUBROUTINE_PATH = ./:../../nc_files USER_M_PATH = ./:../../nc_files/examples/plasmac/m_files:../../nc_files/plasmac/m_files [HAL] -TWOPASS = ON -HALFILE = sim_no_stepgen.tcl -#HALFILE = sim_stepgen.tcl -HALFILE = qtplasmac_comp.hal -HALFILE = custom.hal +HALFILE = ./qtplasmac_imperial.hal POSTGUI_HALFILE = custom_postgui.hal POSTGUI_HALFILE = sim_postgui.hal HALUI = halui diff --git a/configs/sim/qtplasmac/qtplasmac_metric.hal b/configs/sim/qtplasmac/qtplasmac_metric.hal new file mode 100644 index 00000000000..b0c665839cc --- /dev/null +++ b/configs/sim/qtplasmac/qtplasmac_metric.hal @@ -0,0 +1,131 @@ +# HAL setup for the metric QtPlasmaC simulations. +# Shared by the qtplasmac_l, qtplasmac_p, and qtplasmac_s metric INI files. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyyz +loadrt motmod servo_period_nsec=1000000 num_joints=4 num_spindles=3 +loadrt plasmac +loadrt pid names=sim-joint.0.pid,sim-joint.1.pid,sim-joint.2.pid,sim-joint.3.pid +loadrt mux2 names=sim-joint.0.mux,sim-joint.1.mux,sim-joint.2.mux,sim-joint.3.mux +loadrt ddt names=sim-joint.0.vel,sim-joint.1.vel,sim-joint.2.vel,sim-joint.3.vel +loadrt sim_home_switch names=sim-joint.0.home-switch,sim-joint.1.home-switch,sim-joint.2.home-switch,sim-joint.3.home-switch +loadrt dbounce names=db_breakaway,db_float,db_ohmic,db_arc-ok +loadrt or2 names=estop_or +loadrt not names=estop_not,estop_not_1 +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf plasmac servo-thread +addf sim-joint.0.pid.do-pid-calcs servo-thread +addf sim-joint.0.mux servo-thread +addf sim-joint.0.vel servo-thread +addf sim-joint.1.pid.do-pid-calcs servo-thread +addf sim-joint.1.mux servo-thread +addf sim-joint.1.vel servo-thread +addf sim-joint.2.pid.do-pid-calcs servo-thread +addf sim-joint.2.mux servo-thread +addf sim-joint.2.vel servo-thread +addf sim-joint.3.pid.do-pid-calcs servo-thread +addf sim-joint.3.mux servo-thread +addf sim-joint.3.vel servo-thread +addf sim-joint.0.home-switch servo-thread +addf sim-joint.1.home-switch servo-thread +addf sim-joint.2.home-switch servo-thread +addf sim-joint.3.home-switch servo-thread +addf db_float servo-thread +addf db_ohmic servo-thread +addf db_breakaway servo-thread +addf db_arc-ok servo-thread +addf estop_or servo-thread +addf estop_not servo-thread +addf estop_not_1 servo-thread +# pin aliases +# param aliases +# signals +# nets +net machine-is-on halui.machine.is-on => plasmac.machine-is-on +net plasmac:adaptive-feed plasmac.adaptive-feed => motion.adaptive-feed +net plasmac:arc-ok db_arc-ok.out => plasmac.arc-ok-in +net plasmac:axis-position joint.3.pos-fb => plasmac.axis-z-position +net plasmac:axis-x-position axis.x.pos-cmd => plasmac.axis-x-position +net plasmac:axis-y-position axis.y.pos-cmd => plasmac.axis-y-position +net plasmac:breakaway-switch-out db_breakaway.out => plasmac.breakaway +net plasmac:current-velocity motion.current-vel => plasmac.current-velocity +net plasmac:cutting-start spindle.0.on => plasmac.cutting-start +net plasmac:cutting-stop plasmac.cutting-stop => halui.spindle.0.stop +net plasmac:feed-hold plasmac.feed-hold => motion.feed-hold +net plasmac:feed-override halui.feed-override.value => plasmac.feed-override +net plasmac:feed-reduction motion.analog-out-03 => plasmac.feed-reduction +net plasmac:feed-upm motion.feed-upm => plasmac.feed-upm +net plasmac:float-switch-out db_float.out => plasmac.float-switch +net plasmac:homed motion.is-all-homed => plasmac.homed +net plasmac:ignore-arc-ok-0 motion.digital-out-01 => plasmac.ignore-arc-ok-0 +net plasmac:jog-inhibit plasmac.jog-inhibit => motion.jog-inhibit motion.jog-stop +net plasmac:motion-type motion.motion-type => plasmac.motion-type +net plasmac:offset-scale plasmac.offset-scale => axis.x.eoffset-scale axis.y.eoffset-scale axis.z.eoffset-scale +net plasmac:offsets-active motion.eoffset-active => plasmac.offsets-active +net plasmac:ohmic-probe-out db_ohmic.out => plasmac.ohmic-probe +net plasmac:probe-out plasmac.probe-out => motion.probe-input +net plasmac:program-is-idle halui.program.is-idle => plasmac.program-is-idle +net plasmac:program-is-paused halui.program.is-paused => plasmac.program-is-paused +net plasmac:program-is-running halui.program.is-running => plasmac.program-is-running +net plasmac:program-pause plasmac.program-pause => halui.program.pause +net plasmac:program-resume plasmac.program-resume => halui.program.resume +net plasmac:program-run plasmac.program-run => halui.program.run +net plasmac:program-stop plasmac.program-stop => halui.program.stop +net plasmac:scribe-start spindle.1.on => plasmac.scribe-start +net plasmac:spotting-start spindle.2.on => plasmac.spotting-start +net plasmac:thc-disable motion.digital-out-02 => plasmac.thc-disable +net plasmac:torch-off motion.digital-out-03 => plasmac.torch-off +net plasmac:torch-on plasmac.torch-on +net plasmac:units-per-mm halui.machine.units-per-mm => plasmac.units-per-mm +net plasmac:x-offset-counts plasmac.x-offset-counts => axis.x.eoffset-counts +net plasmac:x-offset-current axis.x.eoffset => plasmac.x-offset-current +net plasmac:xy-offset-enable plasmac.xy-offset-enable => axis.x.eoffset-enable axis.y.eoffset-enable +net plasmac:y-offset-counts plasmac.y-offset-counts => axis.y.eoffset-counts +net plasmac:y-offset-current axis.y.eoffset => plasmac.y-offset-current +net plasmac:z-offset-counts plasmac.z-offset-counts => axis.z.eoffset-counts +net plasmac:z-offset-current axis.z.eoffset => plasmac.z-offset-current +net plasmac:z-offset-enable plasmac.z-offset-enable => axis.z.eoffset-enable +net sim:enabled motion.motion-enabled => sim-joint.0.mux.sel sim-joint.1.mux.sel sim-joint.2.mux.sel sim-joint.3.mux.sel +net sim:estop-out estop_not.out => iocontrol.0.emc-enable-in +net sim:estop-raw estop_or.out => estop_not.in +net sim:joint0.enable joint.0.amp-enable-out => sim-joint.0.pid.enable +net sim:joint0.homesw sim-joint.0.home-switch.home-sw => joint.0.home-sw-in +net sim:joint0.on-pos sim-joint.0.pid.output => sim-joint.0.mux.in1 +net sim:joint0.pos-cmd joint.0.motor-pos-cmd => sim-joint.0.pid.command +net sim:joint0.pos-fb sim-joint.0.mux.out => joint.0.motor-pos-fb sim-joint.0.home-switch.cur-pos sim-joint.0.mux.in0 sim-joint.0.vel.in +net sim:joint1.enable joint.1.amp-enable-out => sim-joint.1.pid.enable +net sim:joint1.homesw sim-joint.1.home-switch.home-sw => joint.1.home-sw-in +net sim:joint1.on-pos sim-joint.1.pid.output => sim-joint.1.mux.in1 +net sim:joint1.pos-cmd joint.1.motor-pos-cmd => sim-joint.1.pid.command +net sim:joint1.pos-fb sim-joint.1.mux.out => joint.1.motor-pos-fb sim-joint.1.home-switch.cur-pos sim-joint.1.mux.in0 sim-joint.1.vel.in +net sim:joint2.enable joint.2.amp-enable-out => sim-joint.2.pid.enable +net sim:joint2.homesw sim-joint.2.home-switch.home-sw => joint.2.home-sw-in +net sim:joint2.on-pos sim-joint.2.pid.output => sim-joint.2.mux.in1 +net sim:joint2.pos-cmd joint.2.motor-pos-cmd => sim-joint.2.pid.command +net sim:joint2.pos-fb sim-joint.2.mux.out => joint.2.motor-pos-fb sim-joint.2.home-switch.cur-pos sim-joint.2.mux.in0 sim-joint.2.vel.in +net sim:joint3.enable joint.3.amp-enable-out => sim-joint.3.pid.enable +net sim:joint3.homesw sim-joint.3.home-switch.home-sw => joint.3.home-sw-in +net sim:joint3.on-pos sim-joint.3.pid.output => sim-joint.3.mux.in1 +net sim:joint3.pos-cmd joint.3.motor-pos-cmd => sim-joint.3.pid.command +net sim:joint3.pos-fb sim-joint.3.mux.out => joint.3.motor-pos-fb sim-joint.3.home-switch.cur-pos sim-joint.3.mux.in0 sim-joint.3.vel.in +net sim:tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed +net sim:tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +# joint PID settings +setp sim-joint.0.pid.FF0 1 +setp sim-joint.0.pid.Pgain 0 +setp sim-joint.1.pid.FF0 1 +setp sim-joint.1.pid.Pgain 0 +setp sim-joint.2.pid.FF0 1 +setp sim-joint.2.pid.Pgain 0 +setp sim-joint.3.pid.FF0 1 +setp sim-joint.3.pid.Pgain 0 diff --git a/configs/sim/qtplasmac/qtplasmac_metric_ini.inc b/configs/sim/qtplasmac/qtplasmac_metric_ini.inc index 12e6c3fb39e..5dcf535f9d9 100644 --- a/configs/sim/qtplasmac/qtplasmac_metric_ini.inc +++ b/configs/sim/qtplasmac/qtplasmac_metric_ini.inc @@ -12,11 +12,7 @@ SUBROUTINE_PATH = ./:../../nc_files USER_M_PATH = ./:../../nc_files/examples/plasmac/m_files:../../nc_files/plasmac/m_files [HAL] -TWOPASS = ON -HALFILE = sim_no_stepgen.tcl -#HALFILE = sim_stepgen.tcl -HALFILE = qtplasmac_comp.hal -HALFILE = custom.hal +HALFILE = ./qtplasmac_metric.hal POSTGUI_HALFILE = custom_postgui.hal POSTGUI_HALFILE = sim_postgui.hal HALUI = halui diff --git a/configs/sim/qtvcp_screens/industrial_lathe_wear/industrial_lathe_wear.hal b/configs/sim/qtvcp_screens/industrial_lathe_wear/industrial_lathe_wear.hal new file mode 100644 index 00000000000..7f42305a556 --- /dev/null +++ b/configs/sim/qtvcp_screens/industrial_lathe_wear/industrial_lathe_wear.hal @@ -0,0 +1,82 @@ +# Core HAL setup for the QtVCP industrial lathe-wear demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared diff --git a/configs/sim/qtvcp_screens/industrial_lathe_wear/industrial_lathe_wear.ini b/configs/sim/qtvcp_screens/industrial_lathe_wear/industrial_lathe_wear.ini index 12effa9efe5..82e2a11984f 100644 --- a/configs/sim/qtvcp_screens/industrial_lathe_wear/industrial_lathe_wear.ini +++ b/configs/sim/qtvcp_screens/industrial_lathe_wear/industrial_lathe_wear.ini @@ -65,7 +65,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -no_use_hal_manualtoolchange +HALFILE = ./industrial_lathe_wear.hal POSTGUI_HALFILE = qtvcp_postgui.hal [TRAJ] diff --git a/configs/sim/qtvcp_screens/non-trivial/scara/scara.hal b/configs/sim/qtvcp_screens/non-trivial/scara/scara.hal new file mode 100644 index 00000000000..856c3d0fbba --- /dev/null +++ b/configs/sim/qtvcp_screens/non-trivial/scara/scara.hal @@ -0,0 +1,145 @@ +# HAL setup for the QtVCP SCARA robot simulation. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt scarakins coordinates=xyzcab +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=6 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# joint 3 +setp J3_pid.FF0 1.0 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1.0 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1.0 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/qtvcp_screens/non-trivial/scara/scara.ini b/configs/sim/qtvcp_screens/non-trivial/scara/scara.ini index 9856cf54e46..dffee77c9df 100644 --- a/configs/sim/qtvcp_screens/non-trivial/scara/scara.ini +++ b/configs/sim/qtvcp_screens/non-trivial/scara/scara.ini @@ -121,7 +121,7 @@ KINEMATICS = scarakins coordinates=xyzcab [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./scara.hal [HALUI] # M428:scara kins (kinstype==0 startupDEFAULT) diff --git a/configs/sim/qtvcp_screens/qtaxis_lathe/qtaxis_lathe.hal b/configs/sim/qtvcp_screens/qtaxis_lathe/qtaxis_lathe.hal new file mode 100644 index 00000000000..117b157ad6f --- /dev/null +++ b/configs/sim/qtvcp_screens/qtaxis_lathe/qtaxis_lathe.hal @@ -0,0 +1,100 @@ +# Core HAL setup for the QtAxis lathe simulation. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared diff --git a/configs/sim/qtvcp_screens/qtaxis_lathe/qtaxis_lathe.ini b/configs/sim/qtvcp_screens/qtaxis_lathe/qtaxis_lathe.ini index 0876cac83cc..f8d36e84be2 100644 --- a/configs/sim/qtvcp_screens/qtaxis_lathe/qtaxis_lathe.ini +++ b/configs/sim/qtvcp_screens/qtaxis_lathe/qtaxis_lathe.ini @@ -142,7 +142,7 @@ CYCLE_TIME = 0.001 # Part program interpreter section -------------------------------------------- [HAL] -HALFILE = LIB:basic_sim.tcl -no_use_hal_manualtoolchange +HALFILE = ./qtaxis_lathe.hal POSTGUI_HALFILE = qtvcp_postgui.hal diff --git a/configs/sim/qtvcp_screens/qtdefault_9axis.hal b/configs/sim/qtvcp_screens/qtdefault_9axis.hal new file mode 100644 index 00000000000..904393ae718 --- /dev/null +++ b/configs/sim/qtvcp_screens/qtdefault_9axis.hal @@ -0,0 +1,199 @@ +# Core HAL setup for the QtVCP nine-axis simulation. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadrt trivkins +loadrt motmod unlock_joints_mask=0x10 base_period_nsec=0 servo_period_nsec=1000000 num_joints=9 +loadrt pid names=J0_pid,J1_pid,J2_pid,J3_pid,J4_pid,J5_pid,J6_pid,J7_pid,J8_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux,J3_mux,J4_mux,J5_mux,J6_mux,J7_mux,J8_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel,J3_vel,J3_accel,J4_vel,J4_accel,J5_vel,J5_accel,J6_vel,J6_accel,J7_vel,J7_accel,J8_vel,J8_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch,J3_switch,J4_switch,J5_switch,J6_switch,J7_switch,J8_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J3_pid.do-pid-calcs servo-thread +addf J4_pid.do-pid-calcs servo-thread +addf J5_pid.do-pid-calcs servo-thread +addf J6_pid.do-pid-calcs servo-thread +addf J7_pid.do-pid-calcs servo-thread +addf J8_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J3_mux servo-thread +addf J4_mux servo-thread +addf J5_mux servo-thread +addf J6_mux servo-thread +addf J7_mux servo-thread +addf J8_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J3_vel servo-thread +addf J3_accel servo-thread +addf J4_vel servo-thread +addf J4_accel servo-thread +addf J5_vel servo-thread +addf J5_accel servo-thread +addf J6_vel servo-thread +addf J6_accel servo-thread +addf J7_vel servo-thread +addf J7_accel servo-thread +addf J8_vel servo-thread +addf J8_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf J3_switch servo-thread +addf J4_switch servo-thread +addf J5_switch servo-thread +addf J6_switch servo-thread +addf J7_switch servo-thread +addf J8_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel J3_mux.sel J4_mux.sel J5_mux.sel J6_mux.sel J7_mux.sel J8_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# joint 3 +setp J3_pid.FF0 1 +setp J3_pid.Pgain 0 +net j3-enable joint.3.amp-enable-out => J3_pid.enable +net j3-home-sw J3_switch.home-sw => joint.3.home-sw-in +net j3-pid-output J3_pid.output => J3_mux.in1 +net j3-pos-cmd joint.3.motor-pos-cmd => J3_pid.command +net j3-pos-fb J3_mux.out => J3_mux.in0 J3_switch.cur-pos J3_vel.in joint.3.motor-pos-fb +net j3-vel J3_vel.out => J3_accel.in + +# joint 4 +setp J4_pid.FF0 1 +setp J4_pid.Pgain 0 +net j4-enable joint.4.amp-enable-out => J4_pid.enable +net j4-home-sw J4_switch.home-sw => joint.4.home-sw-in +net j4-pid-output J4_pid.output => J4_mux.in1 +net j4-pos-cmd joint.4.motor-pos-cmd => J4_pid.command +net j4-pos-fb J4_mux.out => J4_mux.in0 J4_switch.cur-pos J4_vel.in joint.4.motor-pos-fb +net j4-vel J4_vel.out => J4_accel.in + +# joint 5 +setp J5_pid.FF0 1 +setp J5_pid.Pgain 0 +net j5-enable joint.5.amp-enable-out => J5_pid.enable +net j5-home-sw J5_switch.home-sw => joint.5.home-sw-in +net j5-pid-output J5_pid.output => J5_mux.in1 +net j5-pos-cmd joint.5.motor-pos-cmd => J5_pid.command +net j5-pos-fb J5_mux.out => J5_mux.in0 J5_switch.cur-pos J5_vel.in joint.5.motor-pos-fb +net j5-vel J5_vel.out => J5_accel.in + +# joint 6 +setp J6_pid.FF0 1 +setp J6_pid.Pgain 0 +setp J6_switch.home-pos 0.1 +setp J6_switch.hysteresis 0.05 +net j6-enable joint.6.amp-enable-out => J6_pid.enable +net j6-home-sw J6_switch.home-sw => joint.6.home-sw-in +net j6-pid-output J6_pid.output => J6_mux.in1 +net j6-pos-cmd joint.6.motor-pos-cmd => J6_pid.command +net j6-pos-fb J6_mux.out => J6_mux.in0 J6_switch.cur-pos J6_vel.in joint.6.motor-pos-fb +net j6-vel J6_vel.out => J6_accel.in + +# joint 7 +setp J7_pid.FF0 1 +setp J7_pid.Pgain 0 +setp J7_switch.home-pos 0.1 +setp J7_switch.hysteresis 0.05 +net j7-enable joint.7.amp-enable-out => J7_pid.enable +net j7-home-sw J7_switch.home-sw => joint.7.home-sw-in +net j7-pid-output J7_pid.output => J7_mux.in1 +net j7-pos-cmd joint.7.motor-pos-cmd => J7_pid.command +net j7-pos-fb J7_mux.out => J7_mux.in0 J7_switch.cur-pos J7_vel.in joint.7.motor-pos-fb +net j7-vel J7_vel.out => J7_accel.in + +# joint 8 +setp J8_pid.FF0 1 +setp J8_pid.Pgain 0 +setp J8_switch.home-pos 0.1 +setp J8_switch.hysteresis 0.05 +net j8-enable joint.8.amp-enable-out => J8_pid.enable +net j8-home-sw J8_switch.home-sw => joint.8.home-sw-in +net j8-pid-output J8_pid.output => J8_mux.in1 +net j8-pos-cmd joint.8.motor-pos-cmd => J8_pid.command +net j8-pos-fb J8_mux.out => J8_mux.in0 J8_switch.cur-pos J8_vel.in joint.8.motor-pos-fb +net j8-vel J8_vel.out => J8_accel.in + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change-loopback iocontrol.0.tool-change => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared diff --git a/configs/sim/qtvcp_screens/qtdefault_9axis.ini b/configs/sim/qtvcp_screens/qtdefault_9axis.ini index dad0c31c2e6..b327559c214 100644 --- a/configs/sim/qtvcp_screens/qtdefault_9axis.ini +++ b/configs/sim/qtvcp_screens/qtdefault_9axis.ini @@ -57,7 +57,7 @@ TOOL_CHANGE_POSITION = 0 0 2 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -no_use_hal_manualtoolchange +HALFILE = ./qtdefault_9axis.hal HALFILE = locking_indexer.hal [TRAJ] diff --git a/configs/sim/tklinuxcnc/trivkins/xz.hal b/configs/sim/tklinuxcnc/trivkins/xz.hal new file mode 100644 index 00000000000..479e54ea8ab --- /dev/null +++ b/configs/sim/tklinuxcnc/trivkins/xz.hal @@ -0,0 +1,89 @@ +# HAL setup for the TkLinuxCNC XZ identity-kinematics test. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/tklinuxcnc/trivkins/xz.ini b/configs/sim/tklinuxcnc/trivkins/xz.ini index 27bc8ccbd63..76b0f140882 100644 --- a/configs/sim/tklinuxcnc/trivkins/xz.ini +++ b/configs/sim/tklinuxcnc/trivkins/xz.ini @@ -10,3 +10,6 @@ DEBUG = 0 # trivkins with no kinstype defaults to KINEMATICS_IDENTITY KINEMATICS = trivkins coordinates=xz JOINTS = 2 + +[HAL] +HALFILE = ./xz.hal diff --git a/configs/sim/tklinuxcnc/trivkins/xz_both.hal b/configs/sim/tklinuxcnc/trivkins/xz_both.hal new file mode 100644 index 00000000000..e2ebdcfc361 --- /dev/null +++ b/configs/sim/tklinuxcnc/trivkins/xz_both.hal @@ -0,0 +1,89 @@ +# HAL setup for the TkLinuxCNC XZ joint/axis kinematics test. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xz kinstype=BOTH +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=2 +loadrt pid names=J0_pid,J1_pid +loadrt mux2 names=J0_mux,J1_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel +loadrt sim_home_switch names=J0_switch,J1_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/tklinuxcnc/trivkins/xz_both.ini b/configs/sim/tklinuxcnc/trivkins/xz_both.ini index 13ca0e698df..fd48f92b7fa 100644 --- a/configs/sim/tklinuxcnc/trivkins/xz_both.ini +++ b/configs/sim/tklinuxcnc/trivkins/xz_both.ini @@ -9,3 +9,6 @@ DEBUG = 0 # Note: coordinates must agree with [TRAJ]COORDINATES KINEMATICS = trivkins coordinates=xz kinstype=BOTH JOINTS = 2 + +[HAL] +HALFILE = ./xz_both.hal diff --git a/configs/sim/tklinuxcnc/trivkins/xzbase.inc b/configs/sim/tklinuxcnc/trivkins/xzbase.inc index b78b08f35f5..30bcf76ca70 100644 --- a/configs/sim/tklinuxcnc/trivkins/xzbase.inc +++ b/configs/sim/tklinuxcnc/trivkins/xzbase.inc @@ -1,5 +1,4 @@ [HAL] -HALFILE = LIB:basic_sim.tcl HALUI = halui [TRAJ] @@ -40,7 +39,7 @@ PARAMETER_FILE = xz.var [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 - BASE_PERIOD = 50000 + BASE_PERIOD = 0 SERVO_PERIOD = 1000000 [TASK] diff --git a/configs/sim/touchy/ngcgui/pyngcgui_touchy.hal b/configs/sim/touchy/ngcgui/pyngcgui_touchy.hal new file mode 100644 index 00000000000..25650e53be9 --- /dev/null +++ b/configs/sim/touchy/ngcgui/pyngcgui_touchy.hal @@ -0,0 +1,109 @@ +# Core HAL setup for the PyNGCGUI Touchy demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +setp J1_switch.hysteresis 0.05 +setp J1_switch.home-pos 0.10 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/touchy/ngcgui/pyngcgui_touchy.ini b/configs/sim/touchy/ngcgui/pyngcgui_touchy.ini index 1297e290e42..5dc5198ed1d 100644 --- a/configs/sim/touchy/ngcgui/pyngcgui_touchy.ini +++ b/configs/sim/touchy/ngcgui/pyngcgui_touchy.ini @@ -53,7 +53,7 @@ TASK = milltask CYCLE_TIME = 0.001 [HAL] -HALFILE = LIB:basic_sim.tcl +HALFILE = ./pyngcgui_touchy.hal HALUI = halui [TRAJ] diff --git a/configs/sim/touchy/ngcgui/pyngcgui_touchy_lathe.hal b/configs/sim/touchy/ngcgui/pyngcgui_touchy_lathe.hal new file mode 100644 index 00000000000..ad59f305ae8 --- /dev/null +++ b/configs/sim/touchy/ngcgui/pyngcgui_touchy_lathe.hal @@ -0,0 +1,104 @@ +# Core HAL setup for the PyNGCGUI Touchy lathe demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins coordinates=xyz +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +# realtime thread/function links +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1.0 +setp J0_pid.Pgain 0 +setp J0_switch.hysteresis 0.05 +setp J0_switch.home-pos 0.10 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-pos-cmd joint.0.motor-pos-cmd => J0_pid.command +net j0-pos-fb J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in joint.0.motor-pos-fb +net j0-vel J0_vel.out => J0_accel.in + +# joint 1 +setp J1_pid.FF0 1.0 +setp J1_pid.Pgain 0 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-pos-cmd joint.1.motor-pos-cmd => J1_pid.command +net j1-pos-fb J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in joint.1.motor-pos-fb +net j1-vel J1_vel.out => J1_accel.in + +# joint 2 +setp J2_pid.FF0 1.0 +setp J2_pid.Pgain 0 +setp J2_switch.hysteresis 0.05 +setp J2_switch.home-pos 0.10 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-pos-cmd joint.2.motor-pos-cmd => J2_pid.command +net j2-pos-fb J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in joint.2.motor-pos-fb +net j2-vel J2_vel.out => J2_accel.in + +# spindle +setp sim_spindle.scale 0.01666667 +setp limit_speed.maxv 5000.0 +setp spindle_mass.gain .07 +setp near_speed.scale 1.1 +setp near_speed.difference 10 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number diff --git a/configs/sim/touchy/ngcgui/pyngcgui_touchy_lathe.ini b/configs/sim/touchy/ngcgui/pyngcgui_touchy_lathe.ini index 90918ec728c..e51112971e1 100644 --- a/configs/sim/touchy/ngcgui/pyngcgui_touchy_lathe.ini +++ b/configs/sim/touchy/ngcgui/pyngcgui_touchy_lathe.ini @@ -56,7 +56,7 @@ USER_M_PATH = ../../nc_files/ngcgui_lib/mfiles [EMCMOT] EMCMOT = motmod COMM_TIMEOUT = 1.0 -BASE_PERIOD = 50000 +BASE_PERIOD = 0 SERVO_PERIOD = 1000000 [TASK] @@ -65,7 +65,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl +HALFILE = ./pyngcgui_touchy_lathe.hal [TRAJ] COORDINATES = X Z diff --git a/configs/sim/touchy/ngcgui/pyngcgui_touchy_moveoff.hal b/configs/sim/touchy/ngcgui/pyngcgui_touchy_moveoff.hal new file mode 100644 index 00000000000..d82ea391968 --- /dev/null +++ b/configs/sim/touchy/ngcgui/pyngcgui_touchy_moveoff.hal @@ -0,0 +1,131 @@ +# HAL setup for the PyNGCGUI Touchy moveoff demonstration. +# +# loadrt loads components, addf schedules their realtime functions, +# setp sets parameters and writable pins, and net connects pins. +# HAL basics: https://linuxcnc.org/docs/devel/html/en/hal/basic-hal.html + +loadusr -W hal_manualtoolchange + +# components +#preloaded module: loadrt tpmod +#preloaded module: loadrt homemod +loadrt trivkins +loadrt motmod base_period_nsec=0 servo_period_nsec=1000000 num_joints=3 +loadrt pid names=J0_pid,J1_pid,J2_pid +loadrt mux2 names=J0_mux,J1_mux,J2_mux +loadrt ddt names=J0_vel,J0_accel,J1_vel,J1_accel,J2_vel,J2_accel +loadrt hypot names=hyp_xy,hyp_xyz +loadrt sim_home_switch names=J0_switch,J1_switch,J2_switch +loadrt sim_spindle names=sim_spindle +loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt near names=near_speed +loadrt scale names=rpm_rps +loadrt moveoff personality=3 names=mv +# realtime thread/function links +addf mv.read-inputs servo-thread +addf motion-command-handler servo-thread +addf motion-controller servo-thread +addf mv.write-outputs servo-thread +addf J0_pid.do-pid-calcs servo-thread +addf J1_pid.do-pid-calcs servo-thread +addf J2_pid.do-pid-calcs servo-thread +addf J0_mux servo-thread +addf J1_mux servo-thread +addf J2_mux servo-thread +addf J0_vel servo-thread +addf J0_accel servo-thread +addf J1_vel servo-thread +addf J1_accel servo-thread +addf J2_vel servo-thread +addf J2_accel servo-thread +addf hyp_xy servo-thread +addf hyp_xyz servo-thread +addf J0_switch servo-thread +addf J1_switch servo-thread +addf J2_switch servo-thread +addf limit_speed servo-thread +addf spindle_mass servo-thread +addf rpm_rps servo-thread +addf near_speed servo-thread +addf sim_spindle servo-thread + +# motion and estop +net estop-loopback iocontrol.0.user-enable-out => iocontrol.0.emc-enable-in +net motion-enabled motion.motion-enabled => J0_mux.sel J1_mux.sel J2_mux.sel + +# joint 0 +setp J0_pid.FF0 1 +setp J0_pid.Pgain 0 +setp J0_switch.home-pos 0.1 +setp J0_switch.hysteresis 0.05 +net j0-enable joint.0.amp-enable-out => J0_pid.enable +net j0-home-sw J0_switch.home-sw => joint.0.home-sw-in +net j0-pid-output J0_pid.output => J0_mux.in1 +net j0-vel J0_vel.out => J0_accel.in hyp_xy.in0 hyp_xyz.in0 + +# joint 1 +setp J1_pid.FF0 1 +setp J1_pid.Pgain 0 +setp J1_switch.home-pos 0.1 +setp J1_switch.hysteresis 0.05 +net j1-enable joint.1.amp-enable-out => J1_pid.enable +net j1-home-sw J1_switch.home-sw => joint.1.home-sw-in +net j1-pid-output J1_pid.output => J1_mux.in1 +net j1-vel J1_vel.out => J1_accel.in hyp_xy.in1 hyp_xyz.in1 + +# joint 2 +setp J2_pid.FF0 1 +setp J2_pid.Pgain 0 +setp J2_switch.home-pos 0.1 +setp J2_switch.hysteresis 0.05 +net j2-enable joint.2.amp-enable-out => J2_pid.enable +net j2-home-sw J2_switch.home-sw => joint.2.home-sw-in +net j2-pid-output J2_pid.output => J2_mux.in1 +net j2-vel J2_vel.out => J2_accel.in hyp_xyz.in2 + +# spindle +setp near_speed.difference 10 +setp near_speed.scale 1.1 +setp sim_spindle.scale 0.01666667 +setp spindle_mass.gain 0.07 +setp limit_speed.maxv 5000 +setp rpm_rps.gain 0.0167 +net spindle-at-speed near_speed.out => spindle.0.at-speed +net spindle-index-enable sim_spindle.index-enable <=> spindle.0.index-enable +net spindle-orient spindle.0.orient => spindle.0.is-oriented +net spindle-pos sim_spindle.position-fb => spindle.0.revs +net spindle-rpm-filtered spindle_mass.out => near_speed.in2 rpm_rps.in +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in +net spindle-speed-cmd spindle.0.speed-out => limit_speed.in near_speed.in1 +net spindle-speed-limited limit_speed.out => sim_spindle.velocity-cmd spindle_mass.in + +# tool change +net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change +net tool-changed hal_manualtoolchange.changed => iocontrol.0.tool-changed +net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared +net tool-prepare-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number + +net hu:fb-0 J0_mux.out => J0_mux.in0 J0_switch.cur-pos J0_vel.in mv.fb-0 +net hu:fb-1 J1_mux.out => J1_mux.in0 J1_switch.cur-pos J1_vel.in mv.fb-1 +net hu:fb-2 J2_mux.out => J2_mux.in0 J2_switch.cur-pos J2_vel.in mv.fb-2 +net hu:minus-0 mv.fb-minusoffset-0 => joint.0.motor-pos-fb +net hu:minus-1 mv.fb-minusoffset-1 => joint.1.motor-pos-fb +net hu:minus-2 mv.fb-minusoffset-2 => joint.2.motor-pos-fb +net hu:plus-0 mv.pos-plusoffset-0 => J0_pid.command +net hu:plus-1 mv.pos-plusoffset-1 => J1_pid.command +net hu:plus-2 mv.pos-plusoffset-2 => J2_pid.command +net hu:pos-0 joint.0.motor-pos-cmd => mv.pos-0 +net hu:pos-1 joint.1.motor-pos-cmd => mv.pos-1 +net hu:pos-2 joint.2.motor-pos-cmd => mv.pos-2 + +# moveoff settings +setp mv.offset-max-0 40 +setp mv.offset-max-1 40 +setp mv.offset-max-2 4 +setp mv.offset-min-0 -40 +setp mv.offset-min-1 -40 +setp mv.offset-min-2 -4 +setp mv.offset-vel-0 4 +setp mv.offset-vel-1 4 +setp mv.offset-vel-2 4 diff --git a/configs/sim/touchy/ngcgui/pyngcgui_touchy_moveoff.ini b/configs/sim/touchy/ngcgui/pyngcgui_touchy_moveoff.ini index 500bf37ed1c..25a73b2d111 100644 --- a/configs/sim/touchy/ngcgui/pyngcgui_touchy_moveoff.ini +++ b/configs/sim/touchy/ngcgui/pyngcgui_touchy_moveoff.ini @@ -55,8 +55,7 @@ CYCLE_TIME = 0.001 [HAL] HALUI = halui -HALFILE = LIB:basic_sim.tcl -HALFILE = LIB:hookup_moveoff.tcl +HALFILE = ./pyngcgui_touchy_moveoff.hal [TRAJ] COORDINATES = X Y Z