Chassis v2.1.1
Chassisはロボコンでの足回り制御を行うためのC++ライブラリである。
Loading...
Searching...
No Matches
Pwm.h
Go to the documentation of this file.
1#ifndef CHASSIS_PWM_H_
2#define CHASSIS_PWM_H_
7
8namespace rct {
9
12
14struct Pwm {
18 Pwm(const float power = 0.0) noexcept {
19 set(power);
20 }
23 void set(const float power) noexcept {
24 pwm_[0] = power * (power > 0);
25 pwm_[1] = -power * (-power > 0);
26 }
31 const float& operator[](const int n) const& {
32 return pwm_[n];
33 }
37 float operator=(const float power) noexcept {
38 set(power);
39 return power;
40 }
41 private:
42 float pwm_[2];
43};
44
46
47} // namespace rct
48
49#endif // CHASSIS_PWM_H_
robot control library
Definition Chassis.h:16
N輪オムニの制御を行うクラス。
Definition Omni.h:25
モータ出力 -> PWM出力へ変換を行う。
Definition Pwm.h:14
Pwm(const float power=0.0) noexcept
コンストラクタ。モータ出力をセットする。
Definition Pwm.h:18
void set(const float power) noexcept
モータ出力をセットする。
Definition Pwm.h:23
float operator=(const float power) noexcept
モータ出力をセットする。
Definition Pwm.h:37
const float & operator[](const int n) const &
PWM出力を取得する。
Definition Pwm.h:31