Closed SquaredPotato closed 1 year ago
Sorry for taking so long to get back to you on this - for some reason GH didn't notify me of this issue / comment.
Regarding your question: Given that the ANGLE PID operates on top of the VELOCITY PID, you should definitely tune the PID parameters for the velocity PID first. As you can see from the values I've gotten, it's likely to be an I-controller predominantly, which would then make the angle PID predominantly a P-controller. Therefore, when starting out with values during tuning of those controllers, I would start with the velocity I value first, then work on it's P value (which I have very little of). Once you're happy with the velocity PID control, then work on the angle PID values, starting with the p value first and so on.
Hope that helps!
Another answer to your question:
The haptics functionality that this example demonstrates short-circuits both the angle and velocity PID controllers by setting the motor control mode to be MotionControlType::TORQUE
- so if you're trying to just get haptics working, you only need to tune the values provided to the BldcHaptics
config structure which configures a predominantly PD
controller. The angle_pid
and velocity_pid
controllers contained within the BldcMotor
object are not used at all by the code in this repo.
@SquaredPotato I'm closing this as resolved since it's been a few months. Feel free to reopen if you feel like I've not answered your questions or to make a new issue with other questions if you have any!
Answers checklist.
General issue report
Hello,
I'm using a BLDC motor similar to one found on scottbez's smartknob (https://www.sparkfun.com/products/20441), and I'm having a great deal of trouble trying to get it to be stable and precise.
Now the BLDC motor class on it's own takes 3 PID controllers as input, with the example using 2 of them, and some other rather specific hard to find parameters that describe the motor.
Is there a recommended order to find the parameters? Should I for example tune the angle or velocity PID first?
btw, this library looks really nice, thanks for all the effort you're putting into this.