Motor control for robots. More compact, less object-oriented revision.

Dependencies:   FastPWM3 mbed-dev-f303

Fork of Hobbyking_Cheetah_V1 by Ben Katz

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers structs.h Source File

structs.h

00001 #ifndef STRUCTS_H
00002 #define STRUCTS_H
00003 
00004 //#include "CANnucleo.h"
00005 #include "mbed.h"
00006 #include "FastPWM.h"
00007 
00008 
00009 typedef struct{
00010     DigitalOut *enable;
00011     DigitalOut *led;
00012     FastPWM *pwm_u, *pwm_v, *pwm_w;
00013     } GPIOStruct;
00014     
00015 typedef struct{
00016     
00017     }COMStruct;
00018     
00019 typedef struct{
00020     int adc1_raw, adc2_raw, adc3_raw;
00021     float i_a, i_b, i_c;
00022     float v_bus;
00023     float theta_mech, theta_elec;
00024     float dtheta_mech, dtheta_elec, dtheta_elec_filt;
00025     float i_d, i_q, i_q_filt;
00026     float v_d, v_q;
00027     float dtc_u, dtc_v, dtc_w;
00028     float v_u, v_v, v_w;
00029     float d_int, q_int;
00030     int adc1_offset, adc2_offset;
00031     float i_d_ref, i_q_ref;
00032     int loop_count;
00033     int timeout;
00034     int mode;
00035     int ovp_flag;
00036     float p_des, v_des, kp, kd, t_ff;
00037     float cogging[128];
00038     } ControllerStruct;
00039 
00040 typedef struct{
00041     float theta_m, theta_est;
00042     float thetadot_m, thetadot_est;
00043     float i_d_m, i_d_est;
00044     float i_q_m, i_q_est;
00045     float i_d_dot, i_q_dot;
00046     float e_d, e_q;
00047     float e_d_int, e_q_int;
00048     } ObserverStruct;
00049     
00050 #endif