diff options
author | Andreas Grois <andi@grois.info> | 2018-03-17 17:09:35 +0100 |
---|---|---|
committer | Andreas Grois <andi@grois.info> | 2018-03-17 17:09:35 +0100 |
commit | e8848a763daf8f266834fab448fd88715d9d5b18 (patch) | |
tree | 561c6ce858028d6d8b0cf780f1dbb671a6fe81ce | |
parent | c93afe46650cca3d133dfb49642db2fac2edee0d (diff) |
Change PID controller to use frame numbers as time, and time only as controlled parameter
-rw-r--r-- | BuddhaTest/src/BuddhaTest.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/BuddhaTest/src/BuddhaTest.cpp b/BuddhaTest/src/BuddhaTest.cpp index daf7fa5..2e82f0c 100644 --- a/BuddhaTest/src/BuddhaTest.cpp +++ b/BuddhaTest/src/BuddhaTest.cpp @@ -150,7 +150,7 @@ int main(int argc, char * argv[]) uint32_t iterationsPerFrame = 1;
- Helpers::PIDController<float, std::chrono::high_resolution_clock::time_point::rep> pid{0.0f,0.0f,1e-8f};
+ Helpers::PIDController<float, std::chrono::high_resolution_clock::time_point::rep> pid{0.0f,0.0f,1e-4f};
const uint32_t targetFrameDuration{1000000/settings.targetFrameRate};
/* Loop until the user closes the window */
@@ -194,7 +194,7 @@ int main(int argc, char * argv[]) if(frameDuration > 0)
{
const auto error{targetFrameDuration - frameDuration};
- const auto pidOutput{pid.Update((frameDuration),float(error))};
+ const auto pidOutput{pid.Update(1,float(error))};
iterationsPerFrame = std::max(1,static_cast<int>(pidOutput));
//std::cout << iterationsPerFrame << " " << pidOutput << std::endl;
|