|
SPIKE-RT C API Reference [Japanese]
An RTOS-based software platform for LEGO® Education SPIKE™.
|
#include <Motor.h>
公開型 | |
| enum class | EDirection { CLOCKWISE = PUP_DIRECTION_CLOCKWISE , COUNTERCLOCKWISE = PUP_DIRECTION_COUNTERCLOCKWISE } |
公開メンバ関数 | |
| Motor (EPort port, EDirection direction=EDirection::CLOCKWISE, bool reset_count=true) | |
| void | resetCount () const |
| int32_t | getCount () const |
| int32_t | getSpeed () const |
| void | setSpeed (int speed) const |
| int32_t | getPower () const |
| void | setPower (int power) const |
| void | stop () const |
| void | brake () const |
| void | hold () const |
| bool | isStalled () const |
| int32_t | setDutyLimit (int duty_limit) const |
| void | restoreDutyLimit (int old_value) const |
| bool | hasError () |
SPIKE モータクラス
|
inline |
コンストラクタ
| port | PUPポートID |
| direction | モータの回転方向 |
| reset_count | カウントをリセットするか pup_motor_setup()を複数回呼ぶとハングするため、コンストラクタで一回だけ呼ぶことでエラーを回避する |
|
inline |
ブレーキをかけてモータを止める
|
inline |
エンコーダの値を取得する
|
inline |
モータのパワー値を取得する
|
inline |
モータの回転速度を取得する
|
inline |
インスタンス生成が正常にできたかどうかを確認するための共通メソッド
|
inline |
モータを止めて角度を維持する
|
inline |
モータがストールしているか調べる
|
inline |
エンコーダをリセットする
|
inline |
モータのデューティ値を元に戻す
| old_value | pup_motor_set_duty_limitの戻り値 |
|
inline |
モータのデューティ値を下げる
| duty_limit | 新しいデューティ値(0-100) |
|
inline |
モータのパワー値を設定する
| power | モータのパワー値(-100 ~ +100) |
|
inline |
モータの回転速度を設定する
| speed | モータの回転速度 [°/秒] |
|
inline |
モータを止める