Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/emc/motion/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,21 +1398,17 @@ static void get_pos_cmds(long period)
joint->pos_cmd = cubicInterpolate(&(joint->cubic), 0, &(joint->vel_cmd), &(joint->acc_cmd), &(joint->jerk_cmd));
}

/* Use accurate jerk values from TP output (for Cartesian machines only)
* For standard XYZ machines, joint[0-2] correspond to X, Y, Z axes
* TP outputs: current_jerk (path jerk) and current_dir (direction unit vector)
* Per-axis jerk = path_jerk * direction_component
/* Use accurate jerk values from TP output for identity kinematics only.
* For KINEMATICS_BOTH (non-trivial joint mapping), joint indices don't
* necessarily correspond to XYZ axes, so keep cubic interpolator values.
*/
if (emcmotStatus->planner_type == 1) {
// S-curve mode: use accurate jerk values
if (emcmotStatus->planner_type == 1
&& emcmotConfig->kinType == KINEMATICS_IDENTITY) {
double path_jerk = emcmotStatus->current_jerk;
PmCartesian dir = emcmotStatus->current_dir;

// For the first 3 joints (assuming X, Y, Z), use accurate jerk
if (NO_OF_KINS_JOINTS >= 1) joints[0].jerk_cmd = path_jerk * dir.x;
if (NO_OF_KINS_JOINTS >= 2) joints[1].jerk_cmd = path_jerk * dir.y;
if (NO_OF_KINS_JOINTS >= 3) joints[2].jerk_cmd = path_jerk * dir.z;
// Rotary axes (A, B, C) keep the cubic interpolator values for now
}

/* report motion status */
Expand Down
Loading