From 5f6a459aab9a781dc143d8a6eb214408ead6906d Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Sun, 19 May 2019 19:28:56 +0300 Subject: PID - fabs() enabled small integral values. empty waste indication. --- Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c') diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c index 4454565c1..265c751c6 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_init.c @@ -106,18 +106,18 @@ uint32_t MotorPidRequestMessage(HardwarePidControl* request) #ifdef TEST_LONGER_PID_THREAD MotorsControl[Motor_i].pvinputfilterfactormode = 10; //test longer control #endif - for (i = 0;i < MotorsControl[Motor_i].pvinputfilterfactormode; i++) + for (i = 0;i < (int)MotorsControl[Motor_i].pvinputfilterfactormode; i++) { MotorSamples[Motor_i][i] = 0; //reset the samples value for control beginning MotorSpeedSamples[Motor_i][i] = 0; } NormalizedErrorCoEfficient[Motor_i] = (2*PI*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].armlength); temp = 1<<(DancersCfg[ThreadMotorIdToDancerId[Motor_i]].resolutionbits); - temp=(10*(temp-1)*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm); + temp=(NORMAL_COEF_DIVIDER*(temp-1)*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm); NormalizedErrorCoEfficient[Motor_i] = NormalizedErrorCoEfficient[Motor_i] / temp; // uint32_t MotorSamples[MAX_THREAD_MOTORS_NUM][MAX_CONTROL_SAMPLES]; temp = 1<<(DancersCfg[ThreadMotorIdToDancerId[Motor_i]].resolutionbits); - temp = (temp*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm*2); + temp = (temp*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].maximalmovementmm*3/2); DancerStopActivityLimit[Motor_i] = temp/(2*PI*DancersCfg[ThreadMotorIdToDancerId[Motor_i]].armlength); return OK; } -- cgit v1.3.1