Skip to content

Add jerk-limited motion planning#1731

Open
MitchBradley wants to merge 8 commits into
mainfrom
Jerk
Open

Add jerk-limited motion planning#1731
MitchBradley wants to merge 8 commits into
mainfrom
Jerk

Conversation

@MitchBradley

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings May 13, 2026 19:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds per-axis jerk configuration and starts integrating jerk-limited ramp shaping into FluidNC’s planner/stepper motion pipeline.

Changes:

  • Adds _jerk axis configuration and YAML handler support.
  • Adds jerk limiting calculations alongside acceleration/rate axis limits.
  • Extends planner blocks and stepper segment prep to use jerk-aware acceleration state.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
FluidNC/src/Stepper.cpp Adds current acceleration state and jerk-shaped accel/decel segment logic.
FluidNC/src/Planner.h Extends planner blocks with max acceleration and jerk fields.
FluidNC/src/Planner.cpp Computes jerk limits and effective acceleration for lookahead.
FluidNC/src/NutsBolts.h Declares jerk axis-limit helper.
FluidNC/src/NutsBolts.cpp Implements per-axis jerk limiting and unit conversion.
FluidNC/src/Machine/Axis.h Adds default per-axis jerk setting.
FluidNC/src/Machine/Axis.cpp Exposes jerk as jerk_mm_per_sec3 config item.
Comments suppressed due to low confidence (2)

FluidNC/src/Stepper.cpp:647

  • The deceleration path has the same integration error as acceleration: it updates current_acceleration before applying it over the whole timestep, so jerk-up/down segments use a constant acceleration instead of the linear jerk integral. That over-decelerates segments and can force an abrupt correction to exit_speed near the end of the block.
                        if (prep.current_speed > jerk_rampdown) {
                            prep.current_acceleration = MIN(prep.current_acceleration + accel_var, pl_block->max_acceleration);
                        } else {
                            prep.current_acceleration = MAX(prep.current_acceleration - accel_var, accel_var);
                        }
                        speed_var = prep.current_acceleration * time_var;

FluidNC/src/Stepper.cpp:645

  • This clamp likewise prevents deceleration from tapering below one segment's accel_var, so the deceleration ramp cannot smoothly return acceleration to zero at the target exit speed. That undermines the jerk limit and can leave the final segment relying on the hard current_speed = exit_speed correction.
                            prep.current_acceleration = MAX(prep.current_acceleration - accel_var, accel_var);

Comment thread FluidNC/src/Stepper.cpp
Comment thread FluidNC/src/Machine/Axis.h Outdated
Comment thread FluidNC/src/Planner.cpp Outdated
Comment thread FluidNC/src/Stepper.cpp Outdated
Comment thread FluidNC/src/Stepper.cpp
@MitchBradley

Copy link
Copy Markdown
Collaborator Author

The documentation, suitable for a FluidNC Wiki page, is at https://gist.github.com/MitchBradley/efc5772e52ce9e65a72f7250087fcd53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants