11

Dependencies:   mbed-dev-f303

Revision:
0:dd5d4837292c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fuzzy/fuzzy.h	Wed Jun 09 01:41:45 2021 +0000
@@ -0,0 +1,37 @@
+#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