#include "robotParams.h"
#include "cpp_extern_macro.h"


Go to the source code of this file.
Classes | |
| struct | motorInfo_t |
| モータ制御用の構造体 More... | |
Defines | |
| #define | MTR_POWER 12.0 |
| モータ仕様 | |
| #define | MTR_OHM 3.9 |
| #define | MTR_RPM_PER_V 675 |
| #define | MTR_MAX_mA 836 |
| #define | MTR_TORQUE_CONST 14.1 |
| #define | MTR_GAIN_P 40 |
| #define | MTR_GAIN_I 4 |
| #define | MTR_I_BIT_WIDTH 11 |
| モータ制御の固定小数点演算用パラメータ | |
| #define | I_VALUE_MAX 850 |
Enumerations | |
| enum | MotorMode { MTR_MODE_FREE, MTR_MODE_CW_BREAK = +1, MTR_MODE_CCW_BREAK = -1 } |
| モータの制御モード More... | |
Functions | |
| void | set_mode (const unsigned char id, const int mode) |
| 指定モータの制御モードを設定 | |
| void | set_pwm (const unsigned char id, const int duty) |
| 指定モータ の PWM 出力を設定 | |
| void | initMotor (void) |
| モータデバイスの初期化 | |
| void | initMotorInfo (const unsigned char id, motorInfo_t *mtr) |
| モータ制御パラメータの初期化 | |
| void | setMotorFree (motorInfo_t *mtr) |
| モータをサーボフリー状態にする | |
| int | setMotorRevolution (const int ref_cnt, const int cnt_diff, motorInfo_t *mtr) |
| モータの目標回転速度を設定する | |
Variables | |
| BEGIN_C_DECLS | |
| END_C_DECLS | |
モータの回転制御を行う(SH7045F依存)
Definition in file motorCtrl.h.
| #define MTR_POWER 12.0 |
モータ仕様
Maxon のカタログより (222049) 公称電圧 [V]
Definition at line 52 of file motorCtrl.h.
Referenced by initMotorInfo().
| #define MTR_OHM 3.9 |
| #define MTR_RPM_PER_V 675 |
| #define MTR_MAX_mA 836 |
最大連続電流 [mA]
Definition at line 61 of file motorCtrl.h.
| #define MTR_TORQUE_CONST 14.1 |
トルク定数 [mNm/A]
Definition at line 65 of file motorCtrl.h.
| #define MTR_GAIN_P 40 |
| #define MTR_GAIN_I 4 |
| #define MTR_I_BIT_WIDTH 11 |
モータ制御の固定小数点演算用パラメータ
出力すべき PWM 比を固定小数点数にて計算するときに用いるパラメータ。 電流の最大値を示すビット位置
Definition at line 84 of file motorCtrl.h.
Referenced by initMotorInfo().
| #define I_VALUE_MAX 850 |
I項の値の最大値
Definition at line 87 of file motorCtrl.h.
| enum MotorMode |
モータの制御モード
モータの制御モードを示す
| MTR_MODE_FREE | サーボフリー |
| MTR_MODE_CW_BREAK | CW と Break による制御 |
| MTR_MODE_CCW_BREAK | CCW と Break による制御 |
Definition at line 38 of file motorCtrl.h.
| void set_mode | ( | const unsigned char | id, | |
| const int | mode | |||
| ) |
指定モータの制御モードを設定
モータの制御モード(MotorMode)を指定する。
| id | [i] モータデバイスID | |
| mode | [i] 制御モード |
Definition at line 39 of file runDeviceSimulate.cpp.
References MTR_MODE_CCW_BREAK, and MTR_MODE_CW_BREAK.
Referenced by initMotor(), setMotorFree(), and setMotorRevolution().
| void set_pwm | ( | const unsigned char | id, | |
| const int | duty | |||
| ) |
指定モータ の PWM 出力を設定
id で指定されるモータデバイスからの PWM出力を duty に設定する。duty は [0, 255] の範囲で指定し、duty == 255 のときは常に H 出力。duty == 0 の時に常に L 出力となる。
| id | [i] モータデバイスID | |
| duty | [i] 出力する PWM 比。(デューティ比) = duty / 255.0; となる。 |
Definition at line 52 of file runDeviceSimulate.cpp.
Referenced by initMotor(), and setMotorRevolution().
| void initMotor | ( | void | ) |
モータデバイスの初期化
モータ制御に用いる出力端子を初期化する。
Definition at line 70 of file runDeviceSimulate.cpp.
References MTR_MODE_FREE, set_mode(), and set_pwm().
| void initMotorInfo | ( | const unsigned char | id, | |
| motorInfo_t * | mtr | |||
| ) |
モータ制御パラメータの初期化
モータ制御用の構造体のメンバ変数を初期化する。
| id | [i] モータデバイスID | |
| mtr | [o] モータ制御用の構造体 |
Definition at line 77 of file runDeviceSimulate.cpp.
References ENC_PULSE, motorInfo_t::gain_i, motorInfo_t::gain_p, motorInfo_t::i_value, motorInfo_t::id, motorInfo_t::ke_per_v, MTR_GAIN_I, MTR_GAIN_P, MTR_I_BIT_WIDTH, MTR_OHM, MTR_POWER, MTR_RPM_PER_V, and motorInfo_t::r_per_v.
| void setMotorFree | ( | motorInfo_t * | mtr | ) |
モータをサーボフリー状態にする
この関数は、外部レイヤーからモータの制御モードを直接サーボフリーにするために存在している。
| mtr | [o] モータ制御用の構造体 |
Definition at line 82 of file runDeviceSimulate.cpp.
References motorInfo_t::id, MTR_MODE_FREE, and set_mode().
| int setMotorRevolution | ( | const int | ref_cnt, | |
| const int | cnt_diff, | |||
| motorInfo_t * | mtr | |||
| ) |
モータの目標回転速度を設定する
モータの目標回転速度を、制御周期あたりのエンコーダの回転数にて指定する。結果として、指定された目標回転速度を実現する PWM比と回転方向をモータデバイスに対して設定する。
| ref_cnt | [i] エンコーダにおける目標回転数 | |
| cnt_diff | [i] エンコーダの回転数 | |
| mtr | [i/o] モータ制御用の構造体 |
| 設定した | PWM比 [-255, 255] |
Definition at line 87 of file runDeviceSimulate.cpp.
References motorInfo_t::id, MTR_MODE_CCW_BREAK, MTR_MODE_CW_BREAK, set_mode(), set_pwm(), WHL_DIAMETER_RIGHT, and WHL_GEAR_RATIO.
1.5.7.1