All,
I have been perplexed for some time regarding the setpoint of the PID for a self balancing bot.
I see from the FRank code and others the setpoint is 174.X to 180.
I will attached that part of the code.
My Question is, where does the setpoint value come from? My understanding is the value the PID attempts to reach as the bot leans (pitches).
Here is the typical code.
Complete code attached
//PID
#if MANUAL_TUNING
double kp , ki, kd;
double prevKp, prevKi, prevKd;
#endif
double originalSetpoint = 174.29;
double setpoint = originalSetpoint;
double movingAngleOffset = 0.3;
double input, output;
int moveState=0; //0 = balance; 1 = back; 2 = forth
#if MANUAL_TUNING
PID pid(&input, &output, &setpoint, 0, 0, 0, DIRECT);
#else
PID pid(&input, &output, &setpoint, 70, 240, 1.9, DIRECT);
#endif
Help appreciated.