pan zhan / panzhan_main_controller_continuous

Dependencies:   mbed-dev_spine

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fuzzy.h Source File

fuzzy.h

00001 #ifndef _fuzzy_h_
00002 #define _fuzzy_h_
00003 
00004 #include "mbed.h"
00005 
00006 #define max(a, b)           (a>b? a:b)
00007 #define min(a, b)           (a<b? a:b)
00008 #define range(x, a, b)      (min(max(x, a), b))
00009 
00010 
00011 #define ANKLEE   (60.0f)
00012 #define ANKLEEC  (15.0f)
00013 
00014 #define KNEEE   (35.0f)
00015 #define KNEEEC  (15.0f)
00016 
00017 
00018 
00019 
00020 extern const float FuzzyRuleKp[7][7];
00021 extern const float FuzzyRuleKd[7][7];
00022 
00023 
00024 typedef struct{
00025 float quantied_e;
00026 float quantied_ec;
00027 float quantied_resault;
00028 float outKp;
00029 float outKd;
00030 }fuzzy_control_t;
00031 void fuzzy_init(fuzzy_control_t *fuzzy ,float max_e,float max_ec,float gain);
00032 void fuzzy_control(float e,float ec,fuzzy_control_t *fuzzy,const float fuzzyRuleKp[7][7],const float fuzzyRuleKd[7][7]);
00033 
00034 extern fuzzy_control_t ankleFuzzy, kneeFuzzy;
00035 
00036 
00037 #endif