mike-matera / fastpid Goto Github PK
View Code? Open in Web Editor NEWA fast, integer based PID controller suitable for Arduino.
License: GNU Lesser General Public License v2.1
A fast, integer based PID controller suitable for Arduino.
License: GNU Lesser General Public License v2.1
Should the step() be called in a blink without delay type of conditional statement ensuring 10hz is achieved or is 200ms delay at end of loop sufficient?
Hi!
Forgive my ignorance, but when I use the Arduino library manager (v1.8.13) I can only install FastPID up to v1.3.1.
You released v1.3.2 back in 2019.
How are your changes propagated to Arduino library manager?
In the step()
function in the end there is:
// Remove the integer scaling factor.
int16_t rval = out >> PARAM_SHIFT;
out variable type here is: int64_t out
When applying shift to the negative integer, the sign bit gets shifted also and may mess up the result.
So when the limits are set to allow also for negative values, what happens? Or are only postitive values allowed, and I missed that? Seems to be no check done for that in the code to allow only positive values.
Hello!
Thanks for your excellent library, I'm using it to control a boost regulator, and I'd like to make a feature request - The PWM to the FET needs to be constrained between 30 and 180, and doing so without your library being "aware" causes it to seemingly rise above 180 internally. This means when the feedback drops below the setpoint, the output takes a long time to drop back down from whatever it is internally to less than 180. Similarly to the upper end, the library takes a long time to begin increasing the output, since it has to go from 0-30 before anything appears to happen.
With a built-in constrain function, the values would be clamped internally so this wouldn't be a problem.
Thanks
-Elijah
I'm not sure if this is an issue for your target application, but oftentimes a parameter value of 1 is just too big. older industrial pids (whose internals are all integer math) will often divide the parameter by a fixed value (and tell the user what that is). So it might be /10 for P and D, /100 for I. The user then enters a P of 50 if they want 5. This allows the user to have an effective P value of as low as 0.1, which can be helpful for aggressive processes.
Help with the FastPID library. When the feedback changes, the output changes between 0 and 1.
I have ported this to C.
I desire to add a MIT License on my forked repository: https://github.com/SRA-VJTI/FastPID
Since your License file is missing the copyright names and year, technically I can re license.
Can you please let me know if it is possible
Hi
I wonder how to use FastPID for cooling, i.e. you want the output to increase when the input increases? One way of doing it would be to use negative Kp,Ki and Kd. But the FastPID do not accept values below 0. By modifying the library I have done tests with negative values and works as intended, but I assume the check for negative values are there for a reason?
/Henrik
I don't know if this is of interest to anyone, but I've ported this to straight C so that I can use it with avr-gcc rather than Arduino. You can find the fork at https://github.com/larsks/FastPID. Since there's nothing AVR-specific in the code, I've also added some simple unit tests that compile on the host.
I have not yet ported the example code: because the standard avr-libc environment has neither millis()/micros()
nor any serial support I'll have to add in some additional code to make the examples work as intended.
The new unit tests are run by travis for pull requests and commits.
Hi, newbie here.
How do i use the bool setOutputRange(int16_t min, int16_t max); command to set the range i cant figure it out. Thankyou :)
In line 53 of FastPID.h the variable _p is defined as uint32_t.
In line 88 of FastPID.cpp "P = int32_t(_p) * int32_t(err);" is used as signed int.
This is should not be an issue but maybe the definition should be fixed.
You enabled setting the max and min output - can you also clamp the integer term to a settable limit, not just the limit of the int32? This will enable better motor tuning.
Thanks!
Saul
I'd like your thoughts on avoiding the use of floats altogether.
Patched FastPID so the library uses fixed-point integers instead of float.
You define a scale factor SCALE in FastPID.h.
Kp, Ki, Kd and hz are then fixed-point integers, witch scaling factor SCALE.
Use case is a small arm processor without FPU.
What is your opinion?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.