From 784d330f80690d3d3f1de765e433e06e58e22175 Mon Sep 17 00:00:00 2001 From: Luca Toniolo <10792599+grandixximo@users.noreply.github.com> Date: Fri, 25 Sep 2026 18:26:05 +0800 Subject: [PATCH 1/2] sim_encoder: fix negative counts when speed hits the thread rate cap The frequency generator add value is freq * 2^31/maxf, and make_pulses() uses bit 31 of addval as the direction bit. The old freq clamp at +/-maxf allowed addval to reach exactly +2^31, setting bit 31, so a commanded speed at or above the cap was misread as negative rotation: the simulated counts ran backwards and encoder.N.velocity went negative (e.g. at >= 12500 rpm with ppr 12 and a 100000 ns base thread). With a spindle-at-speed interlock this makes a program dwell forever. Clamp the add value magnitude to less than 2^31 instead, so the outputs now keep turning in the commanded direction at the maximum rate. Also add a 'saturated' output pin that is true while the cap is engaged, and print a one-shot warning naming the maximum supported speed. --- docs/src/man/man9/sim_encoder.9.adoc | 7 ++++ src/hal/components/sim_encoder.c | 50 ++++++++++++++++++++++------ 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/docs/src/man/man9/sim_encoder.9.adoc b/docs/src/man/man9/sim_encoder.9.adoc index 8a4ce856813..c57fdb54f61 100644 --- a/docs/src/man/man9/sim_encoder.9.adoc +++ b/docs/src/man/man9/sim_encoder.9.adoc @@ -57,6 +57,13 @@ The *sim-encoder.N.* format is shown in the following descriptions. The desired speed of the encoder, in user units per per second. This is divided by *scale*, and the result is used as the encoder speed in revolutions per second. +**sim-encoder.**_N_**.saturated** bit out:: + True while the commanded *speed* exceeds the maximum the pulse + generator can produce, which is one quadrature count per execution of + *make-pulses*. The outputs then keep toggling at that maximum rate + instead of following the command. The maximum speed in user units is + the *make-pulses* thread frequency divided by 4 times *ppr*, + multiplied by *scale*. == PARAMETERS diff --git a/src/hal/components/sim_encoder.c b/src/hal/components/sim_encoder.c index fc9802b9c13..4017480acf8 100644 --- a/src/hal/components/sim_encoder.c +++ b/src/hal/components/sim_encoder.c @@ -97,8 +97,10 @@ typedef struct { hal_real_t scale; /* pin: pulses per revolution */ hal_real_t speed; /* pin: speed in revs/second */ hal_sint_t rawcounts; /* pin: raw counts */ + hal_bool_t saturated; /* pin: speed capped at thread rate limit */ double old_scale; /* internal, used to detect changes */ double scale_mult; /* internal, reciprocal of scale */ + char clamp_warned; /* internal, one-shot frequency cap warning */ } sim_enc_t; /* ptr to array of sim_enc_t structs in shared memory, 1 per channel */ @@ -231,9 +233,10 @@ void rtapi_app_exit(void) to frequency to an accumulator. When the accumulator overflows (or underflows), it is time to increment (or decrement) the state of the output pins. - The add value is limited to +/-2^30, and overflows are detected - at bit 30, not bit 31. This means that with add_val at it's max - (or min) value, and overflow (or underflow) occurs on every cycle. + The add value is limited to a magnitude of less than 2^31, and + overflows are detected at bit 31. This means that with add_val at + it's max (or min) value, and overflow (or underflow) occurs on every + cycle. */ static void make_pulses(void *arg, long period) @@ -349,14 +352,34 @@ static void update_speed(void *arg, long period) rev_sec = hal_get_real(sim_enc->speed) * sim_enc->scale_mult; /* convert speed command (revs per sec) to counts/sec */ freq = rev_sec * (hal_get_uint(sim_enc->ppr)) * 4.0; - /* limit the commanded frequency */ - if (freq > maxf) { - freq = maxf; - } else if (freq < -maxf) { - freq = -maxf; + /* calculate new addval, limiting its magnitude to less than 2^31. + make_pulses() uses bit 31 of addval as the direction bit, so an + addval of +2^31 (freq = +maxf, the old freq clamp value) would + be misread as negative and the generated counts would run + backwards (negative velocity at high commanded speed) */ + double aval = freq * freqscale; + int clamped = 0; + if (aval > 2147483647.0) { + aval = 2147483647.0; + clamped = 1; + } else if (aval < -2147483648.0) { + aval = -2147483648.0; + clamped = 1; } - /* calculate new addval */ - sim_enc->addval = freq * freqscale; + if (clamped && !sim_enc->clamp_warned) { + double maxspeed = maxf * 0.25 / hal_get_uint(sim_enc->ppr) + * hal_get_real(sim_enc->scale); + if (freq < 0.0) { + maxspeed = -maxspeed; + } + sim_enc->clamp_warned = 1; + rtapi_print_msg(RTAPI_MSG_WARN, + "SIM_ENCODER: WARNING: channel %d speed %.3f exceeds maximum %.3f for ppr %lu at %ld ns thread period, output capped\n", + n, hal_get_real(sim_enc->speed), maxspeed, + (unsigned long)hal_get_uint(sim_enc->ppr), periodns); + } + hal_set_bool(sim_enc->saturated, clamped); + sim_enc->addval = aval; sim_enc++; } /* done */ @@ -416,9 +439,16 @@ static int export_sim_enc(sim_enc_t * addr, char *prefix) if (retval != 0) { return retval; } + /* export pin for speed cap indication */ + retval = hal_pin_new_bool(comp_id, HAL_OUT, &(addr->saturated), 0, + "%s.saturated", prefix); + if (retval != 0) { + return retval; + } /* init internal vars */ addr->old_scale = 0.0; addr->scale_mult = 1.0; + addr->clamp_warned = 0; /* init the state variables */ addr->accum = 0; addr->addval = 0; From 80bab253a0fd85159b4f1b0b58b77798758d82b7 Mon Sep 17 00:00:00 2001 From: Luca Toniolo <10792599+grandixximo@users.noreply.github.com> Date: Tue, 1 Dec 2026 13:25:04 +1100 Subject: [PATCH 2/2] configs: drive the spindle sims with sim_spindle The gmoccapy mill and lathe sims and lathe_multispindle simulated the spindle with sim_encoder pulses counted by the encoder component in the base thread. That count rate caps at 12500 rpm with the stock settings; above it speed-in went wrong, at-speed never came and G33 never started. sim_spindle gives position and index directly with no speed cap, as basic_sim.tcl already does for most sims. lathe_multispindle also put spindle 1's index-enable on encoder 0; each spindle now has its own. The scara spindle_sim.hal is removed: no INI loads it and it still used the old motion.spindle-* pins. Tested headless on the three configs: G33 at 1000 and 20000 rpm completes with the right speed-in; on master the 20000 rpm pass never starts. --- configs/sim/axis/lathe_multispindle/lathe.hal | 139 +++++------------- .../gmoccapy/lathe_configs/spindle_sim.hal | 71 +++------ .../scara/spindle_sim.hal | 69 --------- configs/sim/gmoccapy/spindle_sim.hal | 71 +++------ 4 files changed, 79 insertions(+), 271 deletions(-) delete mode 100644 configs/sim/gmoccapy/non_trivial_kinematics/scara/spindle_sim.hal diff --git a/configs/sim/axis/lathe_multispindle/lathe.hal b/configs/sim/axis/lathe_multispindle/lathe.hal index 1d9ea534687..37c730eee14 100644 --- a/configs/sim/axis/lathe_multispindle/lathe.hal +++ b/configs/sim/axis/lathe_multispindle/lathe.hal @@ -1,109 +1,44 @@ -# counting the spindle encoder in software -loadrt encoder names=encoder_0,encoder_1 -# simulate the encoder -loadrt sim_encoder names=sim_encoder_0,sim_encoder_1 -loadrt limit2 names=limit_speed - -addf limit_speed servo-thread - -####################################################### -# Beginning of threading related stuff -####################################################### - -# spindle speed control -net spindle.0.cmd spindle.0.speed-out => sim_encoder_0.speed -net spindle.1.cmd spindle.1.speed-out => sim_encoder_1.speed - -# simulate spindle mass -setp limit_speed.maxv 500.0 # rpm/second - -# spindle encoder 0 -# connect encoder signals to encoder counter -net spindle-phase-A sim_encoder_0.phase-A => encoder_0.phase-A -net spindle-phase-B sim_encoder_0.phase-B => encoder_0.phase-B -net spindle-phase-Z sim_encoder_0.phase-Z => encoder_0.phase-Z - -# assume 120 ppr = 480 counts/rev for the spindle -setp sim_encoder_0.ppr 120 -# iocontrol output is in rpm, but sim-encoder speed is rps -setp sim_encoder_0.scale 60 -# scale encoder output to read in revolutions -# (that way thread pitches can be straightforward, -# a 20 tpi thread would multiply the encoder output -# by 1/20, etc) -setp encoder_0.position-scale 480 - -# encoder reset control -# hook up motion controller's sync output -net spindle-index-enable spindle.0.index-enable <=> encoder_0.index-enable - -# report our revolution count to the motion controller -net spindle.0.pos encoder_0.position => spindle.0.revs - -# spindle encoder 1 -# connect encoder signals to encoder counter -net spindle-phase-A1 sim_encoder_1.phase-A => encoder_1.phase-A -net spindle-phase-B1 sim_encoder_1.phase-B => encoder_1.phase-B -net spindle-phase-Z1 sim_encoder_1.phase-Z => encoder_1.phase-Z - -# assume 120 ppr = 480 counts/rev for the spindle -setp sim_encoder_1.ppr 120 -# iocontrol output is in rpm, but sim-encoder speed is rps -setp sim_encoder_1.scale 60 -# scale encoder output to read in revolutions -# (that way thread pitches can be straightforward, -# a 20 tpi thread would multiply the encoder output -# by 1/20, etc) -setp encoder_1.position-scale 480 - -# encoder reset control -# hook up motion controller's sync output -net spindle-index-enable spindle.1.index-enable <=> encoder_0.index-enable - -# report our revolution count to the motion controller -net spindle.1.pos encoder_1.position => spindle.1.revs - -# for spindle velocity estimate -loadrt lowpass names=lowpass_velocity.0,lowpass_velocity.1 -loadrt scale names=scale_to_rpm.0,scale_to_rpm.1 -net spindle-rps-raw.0 encoder_0.velocity lowpass_velocity.0.in -net spindle-rps-filtered.0 lowpass_velocity.0.out scale_to_rpm.0.in spindle.0.speed-in -net spindle-rpm-filtered.0 scale_to_rpm.0.out -setp scale_to_rpm.0.gain 60 -setp lowpass_velocity.0.gain .07 -addf lowpass_velocity.0 servo-thread -addf scale_to_rpm.0 servo-thread - -net spindle-rps-raw.1 encoder_1.velocity lowpass_velocity.1.in -net spindle-rps-filtered.1 lowpass_velocity.1.out scale_to_rpm.1.in spindle.1.speed-in -net spindle-rpm-filtered.1 scale_to_rpm.1.out -setp scale_to_rpm.1.gain 60 -setp lowpass_velocity.1.gain .07 -addf lowpass_velocity.1 servo-thread -addf scale_to_rpm.1 servo-thread - -# for at-speed detection +# simulated spindles with index pulse, for spindle-synced moves (G33, G76, G95) +loadrt sim_spindle names=sim_spindle.0,sim_spindle.1 +loadrt lowpass names=spindle_mass.0,spindle_mass.1 +loadrt scale names=rpm_rps.0,rpm_rps.1 loadrt near names=near_speed.0,near_speed.1 -addf near_speed.0 servo-thread + +# speed-out is in rpm, sim_spindle wants rps +setp sim_spindle.0.scale 0.01666667 +setp sim_spindle.1.scale 0.01666667 + +# spindle 0 +net spindle.0.cmd spindle.0.speed-out => sim_spindle.0.velocity-cmd spindle_mass.0.in near_speed.0.in1 +net spindle-index-enable.0 spindle.0.index-enable <=> sim_spindle.0.index-enable +net spindle.0.pos sim_spindle.0.position-fb => spindle.0.revs +setp spindle_mass.0.gain .07 +setp rpm_rps.0.gain .01666667 +net spindle-rpm-filtered.0 spindle_mass.0.out => rpm_rps.0.in near_speed.0.in2 +net spindle-rps-filtered.0 rpm_rps.0.out => spindle.0.speed-in setp near_speed.0.scale 1.1 setp near_speed.0.difference 10 -net spindle.0.cmd => near_speed.0.in1 -net spindle-rpm-filtered.0 => near_speed.0.in2 net spindle-at-speed.0 near_speed.0.out spindle.0.at-speed -net spindle.0-fwd <= spindle.0.forward - -addf near_speed.1 servo-thread +net spindle.0-fwd <= spindle.0.forward + +# spindle 1 +net spindle.1.cmd spindle.1.speed-out => sim_spindle.1.velocity-cmd spindle_mass.1.in near_speed.1.in1 +net spindle-index-enable.1 spindle.1.index-enable <=> sim_spindle.1.index-enable +net spindle.1.pos sim_spindle.1.position-fb => spindle.1.revs +setp spindle_mass.1.gain .07 +setp rpm_rps.1.gain .01666667 +net spindle-rpm-filtered.1 spindle_mass.1.out => rpm_rps.1.in near_speed.1.in2 +net spindle-rps-filtered.1 rpm_rps.1.out => spindle.1.speed-in setp near_speed.1.scale 1.1 setp near_speed.1.difference 10 -net spindle.1.cmd => near_speed.1.in1 -net spindle-rpm-filtered.1 => near_speed.1.in2 net spindle-at-speed.1 near_speed.1.out spindle.1.at-speed - -net spindle.1-fwd <= spindle.1.forward - -addf encoder.capture-position servo-thread -addf sim-encoder.update-speed servo-thread - -addf sim-encoder.make-pulses base-thread -addf encoder.update-counters base-thread - +net spindle.1-fwd <= spindle.1.forward + +addf spindle_mass.0 servo-thread +addf spindle_mass.1 servo-thread +addf rpm_rps.0 servo-thread +addf rpm_rps.1 servo-thread +addf near_speed.0 servo-thread +addf near_speed.1 servo-thread +addf sim_spindle.0 servo-thread +addf sim_spindle.1 servo-thread diff --git a/configs/sim/gmoccapy/lathe_configs/spindle_sim.hal b/configs/sim/gmoccapy/lathe_configs/spindle_sim.hal index 7b97c3df0ad..f8257d71113 100644 --- a/configs/sim/gmoccapy/lathe_configs/spindle_sim.hal +++ b/configs/sim/gmoccapy/lathe_configs/spindle_sim.hal @@ -1,69 +1,40 @@ -# counting the spindle encoder in software -loadrt encoder names=encoder_0 -# simulate the encoder -loadrt sim_encoder names=sim_encoder_0 +# simulated spindle with index pulse, for spindle-synced moves (G33, G76, G95) +loadrt sim_spindle names=sim_spindle loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt scale names=rpm_rps +loadrt near names=near_speed -addf limit_speed servo-thread - -####################################################### -# Beginning of threading related stuff -####################################################### - -# spindle speed control -net spindle-speed-cmd spindle.0.speed-out => limit_speed.in -net spindle-speed-limited limit_speed.out => sim_encoder_0.speed - -# simulate spindle mass +# spindle speed control, ramped to simulate the spindle mass +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 setp limit_speed.maxv 3000.0 # rpm/second -# spindle encoder -# connect encoder signals to encoder counter -net spindle-phase-A sim_encoder_0.phase-A => encoder_0.phase-A -net spindle-phase-B sim_encoder_0.phase-B => encoder_0.phase-B -net spindle-phase-Z sim_encoder_0.phase-Z => encoder_0.phase-Z - -# assume 120 ppr = 480 counts/rev for the spindle -setp sim_encoder_0.ppr 12 -# iocontrol output is in rpm, but sim-encoder speed is rps -setp sim_encoder_0.scale 60 -# scale encoder output to read in revolutions -# (that way thread pitches can be straightforward, -# a 20 tpi thread would multiply the encoder output -# by 1/20, etc) -setp encoder_0.position-scale 48 +# speed-out is in rpm, sim_spindle wants rps +setp sim_spindle.scale 0.01666667 # encoder reset control # hook up motion controller's sync output -net spindle-index-enable spindle.0.index-enable <=> encoder_0.index-enable +net spindle-index-enable spindle.0.index-enable <=> sim_spindle.index-enable # report our revolution count to the motion controller -net spindle-pos encoder_0.position => spindle.0.revs +net spindle-pos sim_spindle.position-fb => spindle.0.revs # for spindle velocity estimate -loadrt lowpass names=lowpass_velocity -loadrt scale names=scale_to_rpm -net spindle-rps-raw encoder_0.velocity lowpass_velocity.in -net spindle-rps-filtered lowpass_velocity.out scale_to_rpm.in spindle.0.speed-in -net spindle-rpm-filtered scale_to_rpm.out -setp scale_to_rpm.gain 60 -setp lowpass_velocity.gain .07 -addf lowpass_velocity servo-thread -addf scale_to_rpm servo-thread +setp spindle_mass.gain .07 +setp rpm_rps.gain .01666667 +net spindle-rpm-filtered spindle_mass.out => rpm_rps.in near_speed.in2 +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in # for at-speed detection -loadrt near names=near_speed -addf near_speed servo-thread setp near_speed.scale 1.1 setp near_speed.difference 10 -net spindle-speed-cmd => near_speed.in1 -net spindle-rpm-filtered => near_speed.in2 net spindle-at-speed near_speed.out spindle.0.at-speed net spindle-fwd <= spindle.0.forward -addf encoder.capture-position servo-thread -addf sim-encoder.update-speed servo-thread - -addf sim-encoder.make-pulses base-thread -addf encoder.update-counters base-thread +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 diff --git a/configs/sim/gmoccapy/non_trivial_kinematics/scara/spindle_sim.hal b/configs/sim/gmoccapy/non_trivial_kinematics/scara/spindle_sim.hal deleted file mode 100644 index 7398669b3ba..00000000000 --- a/configs/sim/gmoccapy/non_trivial_kinematics/scara/spindle_sim.hal +++ /dev/null @@ -1,69 +0,0 @@ -# counting the spindle encoder in software -loadrt encoder names=encoder_0 -# simulate the encoder -loadrt sim_encoder names=sim_encoder_0 -loadrt limit2 names=limit_speed - -addf limit_speed servo-thread - -####################################################### -# Beginning of threading related stuff -####################################################### - -# spindle speed control -net spindle-speed-cmd motion.spindle-speed-out => limit_speed.in -net spindle-speed-limited limit_speed.out => sim_encoder_0.speed - -# simulate spindle mass -setp limit_speed.maxv 3000.0 # rpm/second - -# spindle encoder -# connect encoder signals to encoder counter -net spindle-phase-A sim_encoder_0.phase-A => encoder_0.phase-A -net spindle-phase-B sim_encoder_0.phase-B => encoder_0.phase-B -net spindle-phase-Z sim_encoder_0.phase-Z => encoder_0.phase-Z - -# assume 120 ppr = 480 counts/rev for the spindle -setp sim_encoder_0.ppr 12 -# iocontrol output is in rpm, but sim-encoder speed is rps -setp sim_encoder_0.scale 60 -# scale encoder output to read in revolutions -# (that way thread pitches can be straightforward, -# a 20 tpi thread would multiply the encoder output -# by 1/20, etc) -setp encoder_0.position-scale 48 - -# encoder reset control -# hook up motion controller's sync output -net spindle-index-enable motion.spindle-index-enable <=> encoder_0.index-enable - -# report our revolution count to the motion controller -net spindle-pos encoder_0.position => motion.spindle-revs - -# for spindle velocity estimate -loadrt lowpass names=lowpass_velocity -loadrt scale names=scale_to_rpm -net spindle-rps-raw encoder_0.velocity lowpass_velocity.in -net spindle-rps-filtered lowpass_velocity.out scale_to_rpm.in motion.spindle-speed-in -net spindle-rpm-filtered scale_to_rpm.out -setp scale_to_rpm.gain 60 -setp lowpass_velocity.gain .07 -addf lowpass_velocity servo-thread -addf scale_to_rpm servo-thread - -# for at-speed detection -loadrt near names=near_speed -addf near_speed servo-thread -setp near_speed.scale 1.1 -setp near_speed.difference 10 -net spindle-speed-cmd => near_speed.in1 -net spindle-rpm-filtered => near_speed.in2 -net spindle-at-speed near_speed.out motion.spindle-at-speed - -net spindle-fwd <= motion.spindle-forward - -addf encoder.capture-position servo-thread -addf sim-encoder.update-speed servo-thread - -addf sim-encoder.make-pulses servo-thread -addf encoder.update-counters servo-thread diff --git a/configs/sim/gmoccapy/spindle_sim.hal b/configs/sim/gmoccapy/spindle_sim.hal index 7b97c3df0ad..f8257d71113 100644 --- a/configs/sim/gmoccapy/spindle_sim.hal +++ b/configs/sim/gmoccapy/spindle_sim.hal @@ -1,69 +1,40 @@ -# counting the spindle encoder in software -loadrt encoder names=encoder_0 -# simulate the encoder -loadrt sim_encoder names=sim_encoder_0 +# simulated spindle with index pulse, for spindle-synced moves (G33, G76, G95) +loadrt sim_spindle names=sim_spindle loadrt limit2 names=limit_speed +loadrt lowpass names=spindle_mass +loadrt scale names=rpm_rps +loadrt near names=near_speed -addf limit_speed servo-thread - -####################################################### -# Beginning of threading related stuff -####################################################### - -# spindle speed control -net spindle-speed-cmd spindle.0.speed-out => limit_speed.in -net spindle-speed-limited limit_speed.out => sim_encoder_0.speed - -# simulate spindle mass +# spindle speed control, ramped to simulate the spindle mass +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 setp limit_speed.maxv 3000.0 # rpm/second -# spindle encoder -# connect encoder signals to encoder counter -net spindle-phase-A sim_encoder_0.phase-A => encoder_0.phase-A -net spindle-phase-B sim_encoder_0.phase-B => encoder_0.phase-B -net spindle-phase-Z sim_encoder_0.phase-Z => encoder_0.phase-Z - -# assume 120 ppr = 480 counts/rev for the spindle -setp sim_encoder_0.ppr 12 -# iocontrol output is in rpm, but sim-encoder speed is rps -setp sim_encoder_0.scale 60 -# scale encoder output to read in revolutions -# (that way thread pitches can be straightforward, -# a 20 tpi thread would multiply the encoder output -# by 1/20, etc) -setp encoder_0.position-scale 48 +# speed-out is in rpm, sim_spindle wants rps +setp sim_spindle.scale 0.01666667 # encoder reset control # hook up motion controller's sync output -net spindle-index-enable spindle.0.index-enable <=> encoder_0.index-enable +net spindle-index-enable spindle.0.index-enable <=> sim_spindle.index-enable # report our revolution count to the motion controller -net spindle-pos encoder_0.position => spindle.0.revs +net spindle-pos sim_spindle.position-fb => spindle.0.revs # for spindle velocity estimate -loadrt lowpass names=lowpass_velocity -loadrt scale names=scale_to_rpm -net spindle-rps-raw encoder_0.velocity lowpass_velocity.in -net spindle-rps-filtered lowpass_velocity.out scale_to_rpm.in spindle.0.speed-in -net spindle-rpm-filtered scale_to_rpm.out -setp scale_to_rpm.gain 60 -setp lowpass_velocity.gain .07 -addf lowpass_velocity servo-thread -addf scale_to_rpm servo-thread +setp spindle_mass.gain .07 +setp rpm_rps.gain .01666667 +net spindle-rpm-filtered spindle_mass.out => rpm_rps.in near_speed.in2 +net spindle-rps-filtered rpm_rps.out => spindle.0.speed-in # for at-speed detection -loadrt near names=near_speed -addf near_speed servo-thread setp near_speed.scale 1.1 setp near_speed.difference 10 -net spindle-speed-cmd => near_speed.in1 -net spindle-rpm-filtered => near_speed.in2 net spindle-at-speed near_speed.out spindle.0.at-speed net spindle-fwd <= spindle.0.forward -addf encoder.capture-position servo-thread -addf sim-encoder.update-speed servo-thread - -addf sim-encoder.make-pulses base-thread -addf encoder.update-counters base-thread +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