Skip to content

Conversation

@askuric
Copy link
Member

@askuric askuric commented Dec 23, 2025

So this is a PR that does two things:

  1. Does a big refactor of the FOCMotor code with the aim to simplify the BLDC, Stepper and HybridStepper motor codes
  2. Implements a more flexible autotuning from the Current PI Autotuning #426

Refactor

  • All the common functionalities moved to the FOCMotor class
    • Sensor alignement
    • Current sese alignment
    • Motion control
    • Torque control
    • Calibration ...
  • Only the truly different parts left in the BLDCMotor, StepperMotor, ...
    • Setting the phase voltages
    • init,enable,disable

Autotuning

  • Baiscally the code is more or less the same as in Current PI Autotuning #426
  • But it is more flexible and allows to be called from the Commander - ex MFC100 for the bandwith of 100Hz
  • It can be also called in the setup. - ex motor.tuneCurrentController(100)
  • It will either use the motor parameters
    • from the constructor or
    • if the current sense is available and no params are provided it will calll motor.characteriseMotor

@askuric askuric mentioned this pull request Jan 7, 2026
@runger1101001
Copy link
Member

This seems like a good refactoring to me...

One thing to maybe talk about is to make the PID and LPF classes exchangeable instead of hard-coded, and then instead of combining fixed and variable sample times into one class, to make separate classes and therefore also open the possibility to have alternative implementations.

@askuric
Copy link
Member Author

askuric commented Jan 9, 2026

I like the idea. Do you have an idea on how to do it though?
linkLPF mothod or something like that?

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.

4 participants