00001 #ifndef DCMOTOR_H
00002 #define DCMOTOR_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef __GNUC__
00037 #ifndef __attribute__
00038 #define __attribute__(x)
00039 #endif
00040 #endif
00041
00042 static char __attribute__((unused)) dcmotor_h[] = "$Id: dcmotor2.h,v 1.2 2000/10/27 20:34:42 terrylr Exp $";
00043
00044 typedef struct
00045 {
00046
00047 double Ra;
00048 double La;
00049 double Kb;
00050 double Jm;
00051 double Bm;
00052
00053
00054
00055 double a,b,c;
00056 double fourac_minus_b_squared;
00057 double sa_real,sb_real, sa_img, sb_img;
00058 double sa_time_factor, sb_time_factor;
00059
00060 int order;
00061 double wo,dwo;
00062 double last_ea;
00063 double A;
00064 double B;
00065 double delta_thm;
00066
00067
00068
00069 double ia;
00070 double dia;
00071 double wm;
00072 double dwm;
00073 double thm;
00074 double dthm;
00075 double lastTime;
00076
00077
00078 int configured;
00079 double cycleTime;
00080 double offset;
00081 double revsPerUnit;
00082
00083 } DC_MOTOR_STRUCT;
00084
00085
00086 #ifdef __cplusplus
00087 extern "C" {
00088 #endif
00089
00090 extern int dcmotorInit(DC_MOTOR_STRUCT * dcmotor);
00091 extern int dcmotorResetState(DC_MOTOR_STRUCT * dcmotor);
00092 extern int dcmotorSetCycleTime(DC_MOTOR_STRUCT * dcmotor, double seconds);
00093 extern double dcmotorGetCycleTime(DC_MOTOR_STRUCT * dcmotor);
00094 extern int dcmotorSetParameters(DC_MOTOR_STRUCT * dcmotor, DC_MOTOR_STRUCT params);
00095 extern DC_MOTOR_STRUCT dcmotorGetParameters(DC_MOTOR_STRUCT * dcmotor);
00096 extern int dcmotorSetOffset(DC_MOTOR_STRUCT * dcmotor, double _offset);
00097 extern double dcmotorGetOffset(DC_MOTOR_STRUCT * dcmotor);
00098 extern int dcmotorSetRevsPerUnit(DC_MOTOR_STRUCT * dcmotor, double _revsPerUnit);
00099 extern double dcmotorGetRevsPerUnit(DC_MOTOR_STRUCT * dcmotor);
00100 extern double dcmotorGetOutput(DC_MOTOR_STRUCT * dcmotor);
00101 extern double dcmotorRunCycle(volatile DC_MOTOR_STRUCT * dcmotor, volatile double ea);
00102 extern int dcmotorIniLoad(DC_MOTOR_STRUCT * dcmotor, const char * filename, const char *section);
00103
00104 #ifdef __cplusplus
00105 }
00106 #endif
00107
00108 #endif