| 名称 | MIRS1301 モーター制御ボードライブラリ詳細設計書 |
|---|---|
| 番号 | MIRS1301-SOFT-0014 |
最終更新日:2013.02.18
| 版数 | 最終更新日 | 作成 | 承認 | 改訂記事 |
|---|---|---|---|---|
| A01 | 2013.02.18 | 高原一真 | 青木先生 | 初版 |
本ドキュメントは、MIRS1301のモーター制御ボードライブラリの詳細設計書である。
| 修飾子 | 名称 | 概要 |
|---|---|---|
| typedef struct Motor_ | Motor | モーター制御ボード構造体 |
| 修飾子 | 名称 | 概要 |
|---|---|---|
| typedef struct {...} | MotorState | モーター情報構造体 |
| 型 | メンバ名 | 説明 |
| struct timeval | .updateTime | データの取得時刻 |
| uint32_t | .systemClock | PICのシステムクロック |
| int32_t | .totalPulse | 総パルス数 |
| int16_t | .pulseRate | 秒間パルス数 |
| double | .angle | 総回転角 |
| double | .angularVelocity | 角速度 |
| double | .distance | 走行距離 |
| double | .velocity | 走行速度 |
| double | .duty | Duty比 |
| 修飾子 | 名称 | 概要 |
|---|---|---|
| typedef struct {...} | MotorPID | モーターPID制御情報構造体 |
| 型 | メンバ名 | 説 |
| uint8_t | .period | |
| uint16_t | .gainD | 比例ゲイン |
| uint16_t | .timeI | 積分時間 |
| uint16_t | .timeD | 微分時間 |
| int16_t | .reference | 目標秒間パルス数 |
| int32_t | errorP | 目標との偏差 |
| int32_t | errorI | 積分項 |
| int32_t | errorD | 微分項 |
| 修飾子・型 | 名称 | 概要 |
|---|---|---|
| #define | MOTOR_TIRE_RADIUS | タイヤの半径 |
| #define | MOTOR_PULSE_PER_ROUND | タイヤ一回分のパルス数 |
| #define | MOTOR_PID_PERIOD | PID制御周期のデフォルト値 |
| #define | MOTOR_PID_GAIN_P | 比例ゲインのデフォルト値 |
| #define | MOTOR_PID_TIME_I | 積分時間のデフォルト値 |
| #define | MOTOR_PID_TIME_D | 微分時間のデフォルト値 |
| const MotorPID | MOTOR_PID_INITIALIZER | PID制御データの初期化用 |
| 修飾子・戻値 | 名称・引数 | 概要 |
|---|---|---|
| MotorBoard* | motorOpen(I2CBus* bus, uint8_t address) | モーター制御ボードとの通信を開始する |
| void | motorClose(Motor* motor) | モーター制御ボードとの通信を終了する |
| int | motorResetSoftware(Motor* motor) | ソフトウェアリセット |
| int | motorResetHardware(Motor* motor) | ハードウェアリセット |
| int | motorSetTireRadius(Motor* motor, double radius) | 半径の設定 |
| int | motorSetPulsePerRound(Motor* motor, double ppr) | モーター1回分のパルス数の設定 |
| int | motorSetAngle(Motor* motor, double angle) | 総回転角[rad] |
| int | motorSetDistance(Motor* motor, double distance) | 走行距離[m] |
| int | motorSetDuty(Motor* motor, double duty) | デューティー比 (-1.00 ~ 1.00) の直接指定 |
| int | motorSetAngularVelocity(Motor* motor, double angularVelocity) | 目標角速度[rad/sec]の指定 |
| int | motorSetVelocity(Motor* motor, double velocity) | 目標速度[m/sec]の指定 |
| int | motorSetPID(Motor* motor, MotorPID pid) | PIDパラメータの指定 |
| int | motorGetState(Motor* motor, MotorState* state) | モーター本体情報 |
| int | motorGetPID(Motor* motor, MotorPID* pid) | PID制御情報 |
| int | motorSetAxis(Motor* motor, Axis axis) | モーターの設置位置の設定 |
| Axis | motorGetAxis(Motor* motor) | モーターの設定位置の取得 |
ダウンロード先: MIRS1301 ソフトウェア詳細設計書