11

Dependencies:   mbed-dev-f303

fuzzy/fuzzy.h

Committer:
yezhong
Date:
2021-08-06
Revision:
2:9418258519ea
Parent:
0:dd5d4837292c

File content as of revision 2:9418258519ea:

#ifndef _fuzzy_h_
#define _fuzzy_h_

#include "mbed.h"

#define max(a, b)           (a>b? a:b)
#define min(a, b)           (a<b? a:b)
#define range(x, a, b)      (min(max(x, a), b))


#define ANKLEE   (60.0f)
#define ANKLEEC  (15.0f)

#define KNEEE   (35.0f)
#define KNEEEC  (15.0f)




extern const float FuzzyRuleKp[7][7];
extern const float FuzzyRuleKd[7][7];


typedef struct{
float quantied_e;
float quantied_ec;
float quantied_resault;
float outKp;
float outKd;
}fuzzy_control_t;
void fuzzy_init(fuzzy_control_t *fuzzy ,float max_e,float max_ec,float gain);
void fuzzy_control(float e,float ec,fuzzy_control_t *fuzzy,const float fuzzyRuleKp[7][7],const float fuzzyRuleKd[7][7]);

extern fuzzy_control_t ankleFuzzy, kneeFuzzy;


#endif