11 Pid(0.2, 0.5, 0.0, 30.0), forward(0), preAngleL(0), preAngleR(0){
12 for(
int i=0; i<25; i++)speed_value[i] = 0;
23 speed_value[ speedCount ] = speed_value_thistime;
27 if( speedCount >= 25 ) speedCount = 0;
28 forward += (pid_value - pid_value_old) / 10;
29 pid_value_old = pid_value;
36 float distance4msFloat = 0.0;
39 float distance4msL = ((2 * 3.14 * 81) / 360.0) * (float)(curAngleL - preAngleL);
40 float distance4msR = ((2 * 3.14 * 81) / 360.0) * (float)(curAngleR - preAngleR);
41 distance4msFloat = (distance4msL + distance4msR) / 2.0;
44 preAngleL = curAngleL;
45 preAngleR = curAngleR;
47 distance4ms = (int)distance4msFloat;
void calculate(double light_value)
std::int8_t calcDistance4ms(std::int32_t curAngleL, std::int32_t curAngleR)
std::int32_t calculateSpeedForPid(std::int32_t curAngleL, std::int32_t curAngleR)
std::int16_t speed_value_all
double limitOutput(double pid_value)
std::int16_t getSpeed100ms()