9 int32_t Distance::getDistanceTotal(int32_t countL, int32_t countR)
11 leftMotorDegTotal = countL;
12 rightMotorDegTotal = countR;
13 return (leftMotorDegTotal + rightMotorDegTotal) / 2;
16 int32_t Distance::getDistanceCurrent(int32_t countL, int32_t countR)
18 int32_t leftMotorDeg = countL - leftMotorDegOld;
19 int32_t rightMotorDeg = countR - rightMotorDegOld;
21 return (leftMotorDeg + rightMotorDeg) / 2;
24 void Distance::resetDistance(int32_t countL, int32_t countR)
26 getDistanceTotal(countL, countR);
27 leftMotorDegOld = leftMotorDegTotal;
28 rightMotorDegOld = rightMotorDegTotal;