Skip to content

Commit f9251fa

Browse files
author
Luca Toniolo
committed
setting max to 0 will set planner to 0, having max_jerk to 0 should not be allowed
1 parent 77e4a41 commit f9251fa

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

src/emc/ini/inihal.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,28 @@ int check_ini_hal_items(int numjoints)
296296
rcs_print("check_ini_hal_items:bad return value from emcTrajSetJerk\n");
297297
}
298298
}
299+
// Force planner type 0 if max_jerk < 1 (S-curve needs valid jerk)
300+
if (NEW(traj_max_jerk) < 1.0) {
301+
if (0 != emcTrajPlannerType(0)) {
302+
if (emc_debug & EMC_DEBUG_CONFIG) {
303+
rcs_print("check_ini_hal_items:bad return value from emcTrajPlannerType\n");
304+
}
305+
}
306+
}
299307
}
300308

301309
if (CHANGED(traj_planner_type)) {
302310
if (debug) SHOW_CHANGE_INT(traj_planner_type)
303311
UPDATE(traj_planner_type);
304312
// Only 0 and 1 are supported, set to 0 if invalid
313+
// Also force planner type 0 if max_jerk < 1 (S-curve needs valid jerk)
305314
int planner_type = NEW(traj_planner_type);
306315
if (planner_type != 0 && planner_type != 1) {
307316
planner_type = 0;
308317
}
318+
if (planner_type == 1 && NEW(traj_max_jerk) < 1.0) {
319+
planner_type = 0;
320+
}
309321
if (0 != emcTrajPlannerType(planner_type)) {
310322
if (emc_debug & EMC_DEBUG_CONFIG) {
311323
rcs_print("check_ini_hal_items:bad return value from emcTrajPlannerType\n");

src/emc/ini/initraj.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,13 @@ static int loadTraj(EmcIniFile *trajInifile)
223223
planner_type = 0; // Default: 0 = trapezoidal, 1 = S-curve
224224
trajInifile->Find(&planner_type, "PLANNER_TYPE", "TRAJ");
225225
// Only 0 and 1 are supported, set to 0 if invalid
226+
// Also force planner type 0 if max_jerk < 1 (S-curve needs valid jerk)
226227
if (planner_type != 0 && planner_type != 1) {
227228
planner_type = 0;
228229
}
230+
if (planner_type == 1 && jerk < 1.0) {
231+
planner_type = 0;
232+
}
229233
if (0 != emcTrajPlannerType(planner_type)) {
230234
if (emc_debug & EMC_DEBUG_CONFIG) {
231235
rcs_print("bad return value from emcTrajPlannerType\n");

0 commit comments

Comments
 (0)