robot

Dependencies:   FastPWM3 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BREMSStructs.h Source File

BREMSStructs.h

00001 #ifndef __BREMS_STRUCTS_H
00002 #define __BREMS_STRUCTS_H
00003 
00004 #include "mbed.h"
00005 
00006 #include "FastPWM.h"
00007 #include "PwmIn.h"
00008 #include "PositionSensor.h"
00009 #include "BufferedLogger.h"
00010 #include "PreferenceWriter.h"
00011 #include "Filter.h"
00012 #include "LedBlinker.h"
00013 
00014 typedef struct {
00015     FastPWM *a, *b, *c;
00016     DigitalOut *en;
00017     PwmIn *throttle_in;
00018     PositionSensorEncoder *pos;
00019     Serial *pc;
00020     PreferenceWriter *pref;
00021     BufferedLogger *logger;
00022     LedBlinker *blink;
00023     bool cmd_busy;
00024 } IOStruct;
00025 
00026 typedef struct {
00027     float adval1, adval2, adval3;
00028     float vbus;
00029     float p_mech, last_p_mech, w;
00030     float ad1_supp_offset, ad2_supp_offset;
00031 } ReadDataStruct;
00032 
00033 typedef struct {
00034     float ia, ib, alpha, beta, d, q, vd, vq, valpha, vbeta, p;
00035     float vd_decouple, vq_decouple;
00036 } FOCStruct;
00037 
00038 typedef struct {
00039     float d_integral, q_integral;
00040     float last_d, last_q;
00041     float d_ref, q_ref;
00042     float d_filtered, q_filtered;
00043     float user_cmd;
00044     float torque_percent;
00045     float w_integral;
00046     MedianFilter *throttle_filter, *velocity_filter;
00047     bool enabled;
00048 } ControlStruct;
00049     
00050 #endif