Skip to content

Commit 17a129f

Browse files
author
Luca Toniolo
committed
fix default jerk to 10k if user did not write anything
1 parent a371b9f commit 17a129f

7 files changed

Lines changed: 8 additions & 45 deletions

File tree

configs/sim/axis/axis_9axis_scurve.ini

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,6 @@ PLANNER_TYPE = 1
7777
# ini.traj_max_jerk (allows tuning on-the-fly)
7878
MAX_LINEAR_JERK = 10000.0
7979

80-
# DEFAULT_LINEAR_JERK: Default jerk for programmed feed moves
81-
# Units: machine-units/second^3
82-
# Should be <= MAX_LINEAR_JERK
83-
# Default: 0.0
84-
#
85-
# NOTE: This parameter can be changed at RUNTIME via HAL pin:
86-
# ini.traj_default_jerk
87-
DEFAULT_LINEAR_JERK = 10000.0
88-
8980
# --------------------------------------------------------
9081
# Standard TRAJ parameters (still required with S-curve)
9182
# --------------------------------------------------------

configs/sim/axis/axis_mm_scurve.ini

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,6 @@ PLANNER_TYPE = 1
7777
# ini.traj_max_jerk (allows tuning on-the-fly)
7878
MAX_LINEAR_JERK = 10000.0
7979

80-
# DEFAULT_LINEAR_JERK: Default jerk for programmed feed moves
81-
# Units: machine-units/second^3
82-
# Should be <= MAX_LINEAR_JERK
83-
# Default: 0.0
84-
#
85-
# NOTE: This parameter can be changed at RUNTIME via HAL pin:
86-
# ini.traj_default_jerk
87-
DEFAULT_LINEAR_JERK = 10000.0
88-
8980
# --------------------------------------------------------
9081
# Standard TRAJ parameters (still required with S-curve)
9182
# --------------------------------------------------------

docs/src/config/core-components.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ S-curve trajectory planning pins (sampled continuously, can be changed at runtim
373373

374374
* 'ini.traj_planner_type' - (s32, in) [TRAJ]PLANNER_TYPE
375375
* 'ini.traj_max_jerk' - (float, in) [TRAJ]MAX_LINEAR_JERK
376-
* 'ini.traj_default_jerk' - (float, in) [TRAJ]DEFAULT_LINEAR_JERK
377376

378377
Per-axis jerk limit pins (where _L_ is x, y, z, a, b, c, u, v, or w):
379378

docs/src/config/ini-config.adoc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -862,11 +862,9 @@ Finally, no amount of tweaking will speed up a tool path with lots of small, tig
862862
* `MAX_LINEAR_ACCELERATION = 20.0` - (((MAX ACCELERATION))) The maximum acceleration for any axis or coordinated axis move, in 'machine units' per second per second.
863863
* `PLANNER_TYPE = 0` - (((PLANNER TYPE))) Selects the trajectory planner type: 0 = trapezoidal (default), 1 = S-curve with jerk limiting.
864864
S-curve planning is only active when `PLANNER_TYPE = 1` AND `MAX_LINEAR_JERK > 0`.
865-
* `MAX_LINEAR_JERK = 0.0` - (((MAX JERK))) The maximum jerk (rate of change of acceleration) for coordinated moves, in 'machine units' per second cubed.
866-
When set to 0 (default), jerk limiting is disabled.
867-
When greater than 0 and `PLANNER_TYPE = 1`, enables S-curve trajectory planning.
868-
* `DEFAULT_LINEAR_JERK = 0.0` - The default jerk value for coordinated moves, in 'machine units' per second cubed.
869-
When set to 0, `MAX_LINEAR_JERK` is used.
865+
* `MAX_LINEAR_JERK = 10000.0` - (((MAX JERK))) The maximum jerk (rate of change of acceleration) for coordinated moves, in 'machine units' per second cubed.
866+
Default is 10000.0.
867+
When `PLANNER_TYPE = 1`, this enables S-curve trajectory planning.
870868
* `POSITION_FILE =` _position.txt_ - If set to a non-empty value, the joint positions are stored between runs in this file.
871869
This allows the machine to start with the same coordinates it had on shutdown.
872870
This assumes there was no movement of the machine while powered off.

src/emc/ini/inihal.cc

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ int ini_hal_init(int numjoints)
177177
MAKE_FLOAT_PIN(traj_max_velocity,HAL_IN);
178178
MAKE_FLOAT_PIN(traj_default_acceleration,HAL_IN);
179179
MAKE_FLOAT_PIN(traj_max_acceleration,HAL_IN);
180-
MAKE_FLOAT_PIN(traj_default_jerk,HAL_IN);
181180
MAKE_FLOAT_PIN(traj_max_jerk,HAL_IN);
182181
MAKE_S32_PIN(traj_planner_type,HAL_IN);
183182

@@ -198,7 +197,6 @@ int ini_hal_init_pins(int numjoints)
198197
INIT_PIN(traj_max_velocity);
199198
INIT_PIN(traj_default_acceleration);
200199
INIT_PIN(traj_max_acceleration);
201-
INIT_PIN(traj_default_jerk);
202200
INIT_PIN(traj_max_jerk);
203201
INIT_PIN(traj_planner_type);
204202

@@ -292,8 +290,8 @@ int check_ini_hal_items(int numjoints)
292290
rcs_print("check_ini_hal_items:bad return value from emcTrajSetMaxJerk\n");
293291
}
294292
}
295-
// Re-apply default_jerk with new max limit (in case it was set before max_jerk)
296-
if (0 != emcTrajSetJerk(NEW(traj_default_jerk))) {
293+
// Also update the current jerk to the new max value
294+
if (0 != emcTrajSetJerk(NEW(traj_max_jerk))) {
297295
if (emc_debug & EMC_DEBUG_CONFIG) {
298296
rcs_print("check_ini_hal_items:bad return value from emcTrajSetJerk\n");
299297
}
@@ -315,16 +313,6 @@ int check_ini_hal_items(int numjoints)
315313
}
316314
}
317315

318-
if (CHANGED(traj_default_jerk)) {
319-
if (debug) SHOW_CHANGE(traj_default_jerk)
320-
UPDATE(traj_default_jerk);
321-
if (0 != emcTrajSetJerk(NEW(traj_default_jerk))) {
322-
if (emc_debug & EMC_DEBUG_CONFIG) {
323-
rcs_print("check_ini_hal_items:bad return value from emcTrajSetJerk\n");
324-
}
325-
}
326-
}
327-
328316
if ( CHANGED(traj_arc_blend_enable)
329317
|| CHANGED(traj_arc_blend_fallback_enable)
330318
|| CHANGED(traj_arc_blend_optimization_depth)

src/emc/ini/inihal.hh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ int ini_hal_init_pins(int numjoints);
5252
FIELD(hal_float_t,traj_max_velocity) \
5353
FIELD(hal_float_t,traj_default_acceleration) \
5454
FIELD(hal_float_t,traj_max_acceleration) \
55-
FIELD(hal_float_t,traj_default_jerk) \
5655
FIELD(hal_float_t,traj_max_jerk) \
5756
FIELD(hal_s32_t,traj_planner_type) \
5857
\

src/emc/ini/initraj.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ static int loadTraj(EmcIniFile *trajInifile)
203203
}
204204
old_inihal_data.traj_max_acceleration = acc;
205205

206-
// has to set MAX_* before DEFAULT_*
207-
jerk = 0;
206+
// Set max jerk (default to 10000 if not specified in INI)
207+
jerk = 10000.0;
208208
trajInifile->Find(&jerk, "MAX_LINEAR_JERK", "TRAJ");
209209
if (0 != emcTrajSetMaxJerk(jerk)) {
210210
if (emc_debug & EMC_DEBUG_CONFIG) {
@@ -213,16 +213,13 @@ static int loadTraj(EmcIniFile *trajInifile)
213213
return -1;
214214
}
215215
old_inihal_data.traj_max_jerk = jerk;
216-
217-
jerk = 0;
218-
trajInifile->Find(&jerk, "DEFAULT_LINEAR_JERK", "TRAJ");
216+
// Also set current jerk to max_jerk
219217
if (0 != emcTrajSetJerk(jerk)) {
220218
if (emc_debug & EMC_DEBUG_CONFIG) {
221219
rcs_print("bad return value from emcTrajSetJerk\n");
222220
}
223221
return -1;
224222
}
225-
old_inihal_data.traj_default_jerk = jerk;
226223
planner_type = 0; // Default: 0 = trapezoidal, 1 = S-curve
227224
trajInifile->Find(&planner_type, "PLANNER_TYPE", "TRAJ");
228225
// Only 0 and 1 are supported, set to 0 if invalid

0 commit comments

Comments
 (0)