-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Voltage limiting missing for some cases (in motion control velocity, angle) #240
Comments
Hey @greymfm, Regarding the torque control using voltage, limiting was intentionally left out in the library versions so far. However this has changed recently and the next release will have this limiting as well. So when you're in voltage mode, you'll not be able to set the target higher than voltage_limit. |
In this case the output is already constrained by the PID_velocity.limit. PID_velocity.limit is initialised to be equal to either current_limit or the voltage_limit in BLDCMotor.init(). So as long as you set the motor.voltage_limit before calling motor.init(), the effect is actually the same. I agree that your suggestion is somehow "cleaner", and probably more correct. But it also means more MCU cycles will be used in each iteration, so I am not really sure we should change it. I think actually we should leave it as it is for now, and re-think the entire initialisation process for a V3 or V4 release in the future. At the moment the initialisation is quite sensitive to the order you do things, and it's easy to get things wrong resulting in very confusing bugs for the user. So I think we should attack this topic as part of a more general improvement and leave it for now. |
:-) looks like Antun and my comments crossed! |
Thanks for explanations - Then actually my problem was that we switch between velocity and torque control at runtime (each time with different phase_resistance paramters but without calling foc.init) and that did not update the PID_velocity.limits... I have done the PID_velocity.limits update in my own code now and that works. Let's regard this as closed. |
Yeah, you guys are right. We would need to make a simpler method to change limits both in voltage_limit and in PID_velocity object. @runger1101001 you're right. There are some messy parts of the init that would require some refactoring :D BTW, here is a community thread having a similar theme: https://community.simplefoc.com/t/setting-current-limits-in-main-loop/1972/3 |
voltage limiting is missing (for both velocity motion control and angle motion control) for the case if no phase_resistance is given:
Arduino-FOC/src/BLDCMotor.cpp
Line 416 in e9ac395
The corrected (and tested code) looks like this:
The text was updated successfully, but these errors were encountered: