etrobocon2018 feat.KatLab  770af34cce41ae9c30c41303275e1add2daae0c3 (with uncommitted changes)
 全て クラス 名前空間 ファイル 関数 変数 列挙型 列挙値 フレンド マクロ定義 ページ
公開メンバ関数 | 公開変数類 | 全メンバ一覧
MotorAngle クラス

#include <MotorAngle.h>

MotorAngle 連携図
Collaboration graph

公開メンバ関数

 MotorAngle ()
 右モータ角度の過去値 [詳解]
 
void update (std::int32_t left_motor, std::int32_t right_motor)
 左右モータ角度の過去値を現在値へ更新する [詳解]
 
void reset ()
 左右モータ角度の過去値を0にリセットする [詳解]
 
float absoluteAngleMean (std::int32_t left_motor, std::int32_t right_motor)
 左右モータの絶対角度の平均値を計算する [詳解]
 
float relativeAngleMean (std::int32_t current_left_motor, std::int32_t current_right_motor)
 左右モータの相対角度の平均値を計算する [詳解]
 
float angularDifference (std::int32_t left_motor, std::int32_t right_motor)
 左右モータ角度の差を計算する(右手系/反時計回りが正) [詳解]
 
std::int32_t absoluteValueOfAngle (std::int32_t motor)
 モータ角度の絶対値を計算する [詳解]
 
 MotorAngle (std::int32_t degree)
 
void update (std::int32_t update_degree)
 

公開変数類

std::int32_t current_angle
 
std::int32_t old_angle
 
std::int32_t rotation_angle
 
float moving_distance
 
float wheel_across
 

詳解

MotorAngle.h10 行目に定義があります。

構築子と解体子

MotorAngle::MotorAngle ( )
inline

右モータ角度の過去値

MotorAngle.h16 行目に定義があります。

16 : pre_left_motor(0), pre_right_motor(0) {}
MotorAngle::MotorAngle ( std::int32_t  degree)
inline

SelfLocalization.h29 行目に定義があります。

30  {
31  rotation_angle = 0;
32  wheel_across = 9.8;
33  moving_distance = 0;
34  old_angle = current_angle = degree;
35  }
std::int32_t rotation_angle
float wheel_across
float moving_distance
std::int32_t old_angle
std::int32_t current_angle

関数詳解

float MotorAngle::absoluteAngleMean ( std::int32_t  left_motor,
std::int32_t  right_motor 
)

左右モータの絶対角度の平均値を計算する

左モータと右モータの絶対角度の平均値を計算する

[MotorAngle::absoluteAngleMean]

引数
left_motor左モータ角度の現在値
right_motor右モータ角度の現在値
戻り値
左右モータの絶対角度の平均値

MotorAngle.cpp39 行目に定義があります。

40 {
41  return (left_motor + right_motor) / 2.0f;
42 }

被呼び出し関係図:

std::int32_t MotorAngle::absoluteValueOfAngle ( std::int32_t  motor)

モータ角度の絶対値を計算する

[MotorAngle::absoluteValueOfAngle]

引数
モータ角度
戻り値
モータ角度の絶対値

MotorAngle.cpp83 行目に定義があります。

84 {
85  return (motor > 0) ? motor : -motor;
86 }

被呼び出し関係図:

float MotorAngle::angularDifference ( std::int32_t  left_motor,
std::int32_t  right_motor 
)

左右モータ角度の差を計算する(右手系/反時計回りが正)

左右モータの回転角の差を計算する(右手系/反時計回りが正)

[MotorAngle::angularDifference]

引数
left_motor左モータ角度の現在値
right_motor右モータ角度の現在値
戻り値
左右モータの絶対角度の差

MotorAngle.cpp72 行目に定義があります。

73 {
74  return static_cast<float>(right_motor - left_motor);
75 }

被呼び出し関係図:

float MotorAngle::relativeAngleMean ( std::int32_t  current_left_motor,
std::int32_t  current_right_motor 
)

左右モータの相対角度の平均値を計算する

左モータと右モータの相対角度の平均値を計算する

[MotorAngle::relativeAngleMean]

引数
current_left_motor左モータ角度の現在値
current_right_motor右モータ角度の現在値
戻り値
左右モータの相対角度の平均値

MotorAngle.cpp51 行目に定義があります。

53 {
54  // 左モータの相対角度を求める
55  float left_motor = current_left_motor - pre_left_motor;
56  // 右モータの相対角度を求める
57  float right_motor = current_right_motor - pre_right_motor;
58 
59  // 左右モータの過去値を現在値に更新
60  update(current_left_motor, current_right_motor);
61 
62  return (left_motor + right_motor) / 2.0f;
63 }
void update(std::int32_t left_motor, std::int32_t right_motor)
左右モータ角度の過去値を現在値へ更新する
Definition: MotorAngle.cpp:14

呼び出し関係図:

被呼び出し関係図:

void MotorAngle::reset ( void  )

左右モータ角度の過去値を0にリセットする

左モータと右モータの角度の過去値を0にリセットする

[MotorAngle::reset]

MotorAngle.cpp26 行目に定義があります。

27 {
28  pre_left_motor = 0;
29  pre_right_motor = 0;
30 }

被呼び出し関係図:

void MotorAngle::update ( std::int32_t  left_motor,
std::int32_t  right_motor 
)

左右モータ角度の過去値を現在値へ更新する

MotorAngleメンバ変数のpre_left_motorとpre_right_motorの値を現在値に更新する

[MotorAngle::update]

引数
left_motor左モータ角度の現在値
right_motor右モータ角度の現在値

MotorAngle.cpp14 行目に定義があります。

15 {
16  // 左モータ角度の過去値を更新
17  pre_left_motor = left_motor;
18  // 右モータ角度の過去値を更新
19  pre_right_motor = right_motor;
20 }

被呼び出し関係図:

void MotorAngle::update ( std::int32_t  update_degree)
inline

SelfLocalization.h36 行目に定義があります。

37  {
39  current_angle = update_degree;
41  moving_distance = wheel_across * M_PI * (rotation_angle / 360.0);
42  }
std::int32_t rotation_angle
float wheel_across
float moving_distance
std::int32_t old_angle
std::int32_t current_angle

メンバ詳解

std::int32_t MotorAngle::current_angle

SelfLocalization.h24 行目に定義があります。

float MotorAngle::moving_distance

SelfLocalization.h27 行目に定義があります。

std::int32_t MotorAngle::old_angle

SelfLocalization.h25 行目に定義があります。

std::int32_t MotorAngle::rotation_angle

SelfLocalization.h26 行目に定義があります。

float MotorAngle::wheel_across

SelfLocalization.h28 行目に定義があります。


このクラス詳解は次のファイルから抽出されました: