Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of initExoVars by
initExoVars.h
00001 00002 00003 #ifndef INIT_H 00004 #define INIT_H 00005 00006 #include "mbed.h" 00007 #include "Encoder.h" 00008 #include "HipControl.h" 00009 #include "knee.h" 00010 #include "FSM.h" 00011 #include "MM_gait.h" 00012 #include "Brad_poly_gait.h" 00013 #define PI (3.141592653589793) 00014 #define my_delete(x) {delete x; x = NULL;} 00015 00016 //#define SAMPLE_TIME .01 00017 #define SAMPLE_TIME .001 00018 #define TO_RAD(x) (x * 0.01745329252) // *pi/180 00019 00020 00021 /******************************** 00022 * Initializing various I/O pins! 00023 ********************************/ 00024 extern DigitalOut mbedLED1; 00025 extern DigitalOut mbedLED2; 00026 extern DigitalOut mbedLED3; 00027 extern DigitalOut motorLED; 00028 00029 extern SPI dataBedSPI; // mosi, miso, sclk 00030 extern DigitalOut DB_cs; 00031 extern SPI IMUspi; 00032 extern DigitalOut IMUcs; 00033 extern Serial pc; 00034 00035 // Setup stuff 00036 // absolutes 00037 //extern SPI encoder_L; 00038 //extern DigitalOut encoder_cs_L; 00039 //extern SPI encoder_R; 00040 //extern DigitalOut encoder_cs_R; 00041 extern Encoder encoder_L; 00042 extern Encoder encoder_R; 00043 00044 // Incremental Indexes (only for homing!) 00045 extern InterruptIn encIdx_R; 00046 extern InterruptIn encIdx_L; 00047 00048 // Right Leg 00049 extern PwmOut pwmpin_R; 00050 extern DigitalOut dirpin_R; 00051 00052 //Left Leg 00053 //extern PwmOut pwmpin_L; 00054 //extern DigitalOut dirpin_L; 00055 extern HipControl hip_L; 00056 extern HipControl hip_R; 00057 extern Knee knee_L; 00058 extern Knee knee_R; 00059 00060 extern FSM fsm; 00061 00062 extern struct MMgait_t mm_gait_params; 00063 extern struct Brad_poly_gait_t gait_params; 00064 //extern MMSwing swing; 00065 //extern MMStance stance; 00066 extern BradPolySwing swing; 00067 extern BradPolyStance stance; 00068 extern MMFSStance fsStance; 00069 extern MMFSSwing fsSwing; 00070 extern MMFTG ftgSwing; 00071 extern MMFTG ftgStance; 00072 extern GaitGenerator mm_gait; 00073 extern LinearBlend blend_left; 00074 extern LinearBlend blend_right; 00075 00076 00077 /******************************* 00078 * END OF I/O Initialization 00079 *******************************/ 00080 00081 /******************************* 00082 * GLOBAL VARS 00083 *******************************/ 00084 00085 // Global Timers! 00086 extern Timer sysClk; // system clock (primarily for datalogging) 00087 extern Timer tState; // time in FSM state 00088 extern Timer t_HCl; // time when high current begins 00089 extern Timer t_HCr; 00090 extern Timer t_BetweenStepCommand; 00091 00092 const unsigned int enc_ticks=pow(2.,14.)-1; //the number of ticks that the encoder has, 2^14 for our encoder, -1 for 0 state 00093 const float enc2deg = 360./enc_ticks; // converts encoder reading from 0-16383 (14 bit) to 0-360deg (360 / 16383); 00094 const float control_lim_high=90; //soft stop on the controller 00095 const float control_lim_low=-55;//soft stop on the controller 00096 extern float TimeSinceLastStep; 00097 00098 //Control Variables 00099 // Control variables 00100 // Gain Scheduling! 00101 extern float Kp_Swing; 00102 extern float Kp_Stance; 00103 extern const float Kp_DoubleStance;//.01; 00104 extern const float Kp_Standing;//.01; //0.0025 00105 extern const float Kp_StandUp; 00106 extern const float Kp_SitDown ; 00107 extern const float Kp_Seated; 00108 00109 extern float Kd_Stance; 00110 extern float Kd_Swing; 00111 00112 extern const float Kp; 00113 extern float Kd; 00114 extern const float sat; 00115 extern const float Kp_mag; 00116 extern const float Kp_freq; 00117 extern const float Kp_offset; 00118 extern float stand_adjust; 00119 00120 extern float zero_enc_offset_L;//=EncOffset_L; 00121 extern float zero_enc_offset_R;//=EncOffset_R; 00122 //extern float bob_dole; 00123 00124 extern float zero_ang_L; 00125 extern float zero_ang_R; 00126 00127 extern void initializeExoIOs(); 00128 void readCalib(); 00129 00130 #endif
Generated on Fri Aug 5 2022 05:14:16 by
1.7.2
