21 template <
template <
typename>
class Writer>
26 using WriterType = Writer<Message::Motor>;
38 MotorBy(WriterType&& writer,
bool direction)
41 , direction(direction)
49 power =
Constrain(p, (int16_t)-255, (int16_t)255);
50 writer.setMessage({
static_cast<int16_t
>(power * (direction ? 1 : -1)) });
通信経由モーター制御クラス
Definition Motor.hpp:23
void show() const
出力値をシリアル出力
Definition Motor.hpp:61
MotorBy(WriterType &&writer, bool direction)
コンストラクタ
Definition Motor.hpp:38
void stop()
停止
Definition Motor.hpp:55
void move(int16_t p)
出力値を取得
Definition Motor.hpp:47
void MaybeInvokeUpdate(HasMemberFunctionUpdate &rhs)
T に T::update 関数が存在する場合呼び出す。それ以外の場合何もしない。
Definition HasMemberFunction.hpp:111
void Show(Args &&... args)
区切り文字ありで出力する
Definition Show.hpp:339
constexpr A Constrain(const A &amt, const B &low, const C &high)
値を指定された範囲内に収める (std::clamp)
Definition Math.hpp:68
Definition Typedef.hpp:94
送信クラスであるか判定
Definition ReaderWriterTraits.hpp:25