From 46b0f5c0f6c5887dc8f0652801728b1a89c11816 Mon Sep 17 00:00:00 2001 From: Kevin Harrington Date: Tue, 25 Sep 2018 19:41:16 -0400 Subject: [PATCH] Update PidServer.cpp --- src/coms/PidServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coms/PidServer.cpp b/src/coms/PidServer.cpp index f139c09..91fc899 100644 --- a/src/coms/PidServer.cpp +++ b/src/coms/PidServer.cpp @@ -37,7 +37,7 @@ void PidServer::event(float * packet){ // The if statement below always returns false and therefore we never // enter the clause. Is this code needed? If not, let's get rid of it. float timeOfMotion = 0; - if(velocityTarget>0) + if(std::abs(velocityTarget)>0) timeOfMotion=(std::abs(setpoint-position)/velocityTarget)*1000;// convert from Tics per second to miliseconds // When polling for the current positon, we are passing down setpoints over and over. If the setpoint is already set we want to skip // Bound function is checking the incoming value agains the previouslt set value