From e8848a763daf8f266834fab448fd88715d9d5b18 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Sat, 17 Mar 2018 17:09:35 +0100 Subject: Change PID controller to use frame numbers as time, and time only as controlled parameter --- BuddhaTest/src/BuddhaTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'BuddhaTest') 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 pid{0.0f,0.0f,1e-8f}; + Helpers::PIDController 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(pidOutput)); //std::cout << iterationsPerFrame << " " << pidOutput << std::endl; -- cgit v1.2.3