Skip to content

Commit b256104

Browse files
committed
update: MotorController でモーターの角位置を int32_t 型で取得しているため、関数の引数として用いるモーターの角位置の変数を double ではなく int32_t 型を使用するように変更
1 parent cb7c283 commit b256104

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

modules/calculators/Mileage.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66

77
#include "Mileage.h"
88

9-
double Mileage::calculateWheelMileage(int angle)
9+
// MotorController でモーターの角位置を int32_t 型で取得しているため、double ではなく int32_t
10+
// 型を使用する
11+
double Mileage::calculateWheelMileage(int32_t angle)
1012
{
1113
// タイヤの累計走行距離 = 2 * π * タイヤの半径 * (タイヤの回転角度 / 360[deg])
1214
return 2.0 * M_PI * RADIUS * static_cast<double>(angle) / 360.0;
1315
}
1416

15-
double Mileage::calculateMileage(int rightAngle, int leftAngle)
17+
double Mileage::calculateMileage(int32_t rightAngle, int32_t leftAngle)
1618
{
1719
// 右タイヤの累計走行距離を計算
1820
double rightWheelMileage = calculateWheelMileage(rightAngle);

modules/calculators/Mileage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Mileage {
1717
** @param angle タイヤの回転角度[deg]
1818
** @return タイヤの累計走行距離[mm]
1919
**/
20-
static double calculateWheelMileage(int angle);
20+
static double calculateWheelMileage(int32_t angle);
2121

2222
/**
2323
** @brief 走行体全体の累計走行距離を計算する

0 commit comments

Comments
 (0)