motorCtrl.h

Go to the documentation of this file.
00001 #ifndef MOTOR_CTRL_H
00002 #define MOTOR_CTRL_H
00003 
00015 #include "robotParams.h"
00016 
00017 
00023 typedef struct {
00024   unsigned char id;             
00025   int gain_p;                   
00026   int gain_i;                   
00027   int i_value;                  
00028   int r_per_v;        
00029   int ke_per_v;     
00030 } motorInfo_t;
00031 
00032 
00038 enum MotorMode {
00039   MTR_MODE_FREE,                
00040   MTR_MODE_CW_BREAK = +1,       
00041   MTR_MODE_CCW_BREAK = -1,      
00042 };
00043 
00044 
00051 #ifndef MTR_POWER
00052 #define MTR_POWER 12.0          
00053 #endif
00054 #ifndef MTR_OHM
00055 #define MTR_OHM 3.9             
00056 #endif
00057 #ifndef MTR_RPM_PER_V
00058 #define MTR_RPM_PER_V 675       
00059 #endif
00060 #ifndef MTR_MAX_mA
00061 #define MTR_MAX_mA 836          
00062 #endif
00063 
00064 #ifndef MTR_TORQUE_CONST
00065 #define MTR_TORQUE_CONST 14.1   
00066 #endif
00067 
00068 /*
00069   制御パラメータ
00070 */
00071 #ifndef MTR_GAIN_P
00072 #define MTR_GAIN_P 40           
00073 #endif
00074 #ifndef MTR_GAIN_I
00075 #define MTR_GAIN_I 4            
00076 #endif
00077 
00083 #ifndef MTR_I_BIT_WIDTH
00084 #define MTR_I_BIT_WIDTH 11      
00085 #endif
00086 #ifndef I_VALUE_MAX
00087 #define I_VALUE_MAX 850         
00088 #endif
00089 
00090 
00091 #include "cpp_extern_macro.h"
00092 BEGIN_C_DECLS;
00093 
00094 extern void set_mode(const unsigned char id, const int mode);
00095 extern void set_pwm(const unsigned char id, const int duty);
00096 
00097 extern void initMotor(void);
00098 extern void initMotorInfo(const unsigned char id, motorInfo_t *mtr);
00099 extern void setMotorFree(motorInfo_t *mtr);
00100 extern int setMotorRevolution(const int ref_cnt, const int cnt_diff,
00101                               motorInfo_t *mtr);
00102 
00103 END_C_DECLS;
00104 #endif /* !MOTOR_CTRL_H */
00105 

Generated on Mon Apr 13 22:52:01 2009 by  doxygen 1.5.7.1