Skip to content

[FeatureRequest]: Automatic Closed-Loop Tuning Algorithm for Easier Initial Setup #1232

@robbiesilverhand

Description

@robbiesilverhand

Is your feature request related to a problem? Please describe.

I would like to request a new automatic closed-loop tuning algorithm for RepRapFirmware.

The current closed-loop setup works, but finding good initial parameters can take a lot of time, especially during the first setup of a new machine or axis. In practice, the rough tuning phase is often the most time-consuming part, because the user has to manually adjust the parameters, test the motion, check the response, and repeat the process many times.

It would be very helpful if RepRapFirmware could provide an automatic or semi-automatic tuning routine for closed-loop axes.

The goal would not necessarily be perfect final tuning, but a reliable automatic method to find usable starting values for the main closed-loop parameters. The user could then fine-tune them manually if needed.

Suggested behaviour:

The user starts a closed-loop tuning command for a selected axis.
RepRapFirmware performs a controlled test movement or excitation sequence.
The firmware measures the response from the encoder feedback.
The firmware estimates suitable initial parameters for the closed-loop controller.
The resulting parameters are reported to the user and optionally applied automatically.

This would save a lot of setup time and make closed-loop configuration easier for users who are not control-system experts.

Possible advantages:

Much faster initial closed-loop setup
Easier configuration for new users
More repeatable tuning results
Less trial and error
Better accessibility of closed-loop features in RepRapFirmware
Reduced risk of unstable settings during manual tuning

It would also be useful if the tuning routine could detect problematic conditions, for example:

Encoder direction reversed
Too much backlash or mechanical play
Excessive following error
Motor response too weak or too aggressive
Unstable oscillation during tuning
Axis not moving as expected

Describe the solution you propose.

A semi-automatic approach would already be very useful. For example, the firmware could run the test, calculate recommended values, and print them to the console without immediately saving them.

Example concept:

M569.10 F:60 A2000 X ; run closed-loop auto tuning for X axis with a maximum of 60mm/s Feedrate and 2000mm/s³ Acceleration

Output example:

Closed-loop tuning result for X axis:
Recommended P: ...
Recommended I: ...
Recommended D: ...
Recommended V: ...
Recommended A: ...
Recommended following error limit: ...
Warning: slight oscillation detected, reduce P if needed.

I think this feature would make closed-loop support in RepRapFirmware much easier to use, especially for machines where the rough initial tuning currently takes a lot of manual testing.

Thank you for considering this feature request.

Describe alternatives you've considered

Instead of adding a new firmware command directly, this could be implemented as a Duet Web Control / plugin feature. The plugin could guide the user through the tuning process, run the required test movements, read the encoder feedback, and calculate suitable starting values for the closed-loop parameters.

The main goal would be to reduce the time needed for the rough initial setup of closed-loop axes. The result does not need to be perfect final tuning, but it should provide safe and usable starting parameters that the user can fine-tune manually afterwards.

A plugin could also make the process easier to use by showing warnings such as reversed encoder direction, unstable oscillation, excessive following error, backlash, or weak motor response.

This would make closed-loop setup much more accessible, especially for users who are not control-system experts.

Thank you for considering this feature request.

Provide any additional context or information.

Ex. Photos, mockups, etc.

Metadata

Metadata

Assignees

Labels

enhancementAdditional functionality, performance or other feature request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions