ETrobocon2017 - 片山研究所モデルベース開発推進事業部
Distance.cpp
[詳解]
1 
7 #include "Distance.h"
8 
9 int32_t Distance::getDistanceTotal(int32_t countL, int32_t countR){
10  leftMotorDegTotal = countL;
11  rightMotorDegTotal = countR;
12  return (leftMotorDegTotal + rightMotorDegTotal) / 2;
13 }
14 
15 int32_t Distance::getDistanceCurrent(int32_t countL, int32_t countR){
16  int32_t leftMotorDeg = countL - leftMotorDegOld;
17  int32_t rightMotorDeg = countR - rightMotorDegOld;
18 
19  return (leftMotorDeg + rightMotorDeg) / 2;
20 }
21 
22 void Distance::resetDistance(int32_t countL, int32_t countR){
23  getDistanceTotal(countL, countR);
24  leftMotorDegOld = leftMotorDegTotal;
25  rightMotorDegOld = rightMotorDegTotal;
26 }
void resetDistance(int32_t countL, int32_t countR)
Definition: Distance.cpp:22
std::int32_t getDistanceCurrent(std::int32_t countL, std::int32_t countR)
Definition: Distance.cpp:15
タイヤの進んだ距離(回転角)に関するクラス
std::int32_t getDistanceTotal(std::int32_t countL, std::int32_t countR)
Definition: Distance.cpp:9