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

走行体のアームを操作するクラス。 [詳解]

#include "Lifter.h"

Lifter 連携図
Collaboration graph

公開メンバ関数

 Lifter (Controller &controller_)
 
void liftUp (std::uint8_t angle, std::int8_t pwm=20)
 
void liftDown (std::uint8_t angle, std::int8_t pwm=20)
 
std::int8_t getCurrentAngle ()
 
void defaultSet (std::int8_t pwm=20)
 

フレンド

class etrobocon2018_test::LifterTest
 

詳解

走行体のアームを操作するクラス。

Lifter.h20 行目に定義があります。

構築子と解体子

Lifter::Lifter ( Controller controller_)
inlineexplicit

コンストラクタ

引数
controller_ev3apiを持つControllerクラス。

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

26 : controller(controller_) { reset(); }

関数詳解

void Lifter::defaultSet ( std::int8_t  pwm = 20)

アームを初期位置にもどす。

引数
pwmアームを動かすPWM値

Lifter.cpp57 行目に定義があります。

58 {
59  std::int8_t sign;
60  if(getCurrentAngle() < 0) {
61  sign = 1;
62  } else {
63  sign = -1;
64  }
65 
66  while(1) {
67  if((sign == 1 && getCurrentAngle() >= 0) || (sign == -1 && getCurrentAngle() <= 0)) {
68  break;
69  }
70  controller.liftMotor.setPWM(sign * limitPwm(pwm));
71  controller.tslpTsk(4);
72  }
73  controller.liftMotor.setPWM(0);
74 }
void setPWM(int pwm)
Definition: Motor.cpp:31
void tslpTsk(int16_t time)
Definition: Controller.cpp:74
Motor liftMotor
Definition: Controller.h:44
std::int8_t getCurrentAngle()
Definition: Lifter.cpp:16

呼び出し関係図:

std::int8_t Lifter::getCurrentAngle ( )

現在の角度取得。

戻り値
現在の角度取得。

Lifter.cpp16 行目に定義があります。

17 {
18  std::int32_t current_angle = controller.liftMotor.getCount();
19  return current_angle - default_count;
20 }
Motor liftMotor
Definition: Controller.h:44
int32_t getCount(void) const
Definition: Motor.h:67

呼び出し関係図:

被呼び出し関係図:

void Lifter::liftDown ( std::uint8_t  angle,
std::int8_t  pwm = 20 
)

アームを下げる。

引数
angle変化する角度。
pwmアームを動かすPWM値

Lifter.cpp45 行目に定義があります。

46 {
47  while(1) {
48  if(getCurrentAngle() < -angle) {
49  break;
50  }
51  controller.liftMotor.setPWM(-limitPwm(pwm));
52  controller.tslpTsk(4);
53  }
54  controller.liftMotor.setPWM(0);
55 }
void setPWM(int pwm)
Definition: Motor.cpp:31
void tslpTsk(int16_t time)
Definition: Controller.cpp:74
Motor liftMotor
Definition: Controller.h:44
std::int8_t getCurrentAngle()
Definition: Lifter.cpp:16

呼び出し関係図:

被呼び出し関係図:

void Lifter::liftUp ( std::uint8_t  angle,
std::int8_t  pwm = 20 
)

アームを上げる。

引数
angle変化する角度。
pwmアームを動かすPWM値

Lifter.cpp33 行目に定義があります。

34 {
35  while(1) {
36  if(getCurrentAngle() > angle) {
37  break;
38  }
39  controller.liftMotor.setPWM(limitPwm(pwm));
40  controller.tslpTsk(4);
41  }
42  controller.liftMotor.setPWM(0);
43 }
void setPWM(int pwm)
Definition: Motor.cpp:31
void tslpTsk(int16_t time)
Definition: Controller.cpp:74
Motor liftMotor
Definition: Controller.h:44
std::int8_t getCurrentAngle()
Definition: Lifter.cpp:16

呼び出し関係図:

被呼び出し関係図:

フレンドと関連関数の詳解

friend class etrobocon2018_test::LifterTest
friend

Lifter.h21 行目に定義があります。


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