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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 4:37df0f6a1bc3
- Parent:
- 3:477db0d9895e
--- a/main.cpp Fri May 10 14:24:29 2019 +0000
+++ b/main.cpp Fri May 10 18:15:41 2019 +0000
@@ -2,6 +2,7 @@
#include "EncoderCounter.h"
#include "PID_Cntrl.h"
#include "LinearCharacteristics.h"
+#include "GPA.h"
//------------------------------------------
#define PI 3.1415927f
//------------------------------------------
@@ -35,6 +36,28 @@
PID_Cntrl dt1(0.0f, 0.0f, 0.0126f, 0.00067f, Ts, -3.0f, 3.0f);
PID_Cntrl pi1(3.16f, 15.1f, 0.0f, 1.0f, Ts, -3.0f, 3.0f);
float w = 0.5f;
+/*
+// low frequency region until 20 Hz with more amplitude
+float fMin = 0.3f;
+float fMax = 20.0f;
+int NfexcDes = 60;
+float Aexc0 = 3.0f;
+float Aexc1 = 0.8f; // Aexc0/fMax;
+GPA gpa(fMin, fMax, NfexcDes, Aexc0, Aexc1, Ts);
+float w = 0.0f;
+float exc = 0.0f;
+*/
+/*
+// all frequencies with less amplitude (until approx. 20 Hz bad quality)
+float fMin = 1.0f;
+float fMax = 0.99f/2.0f/Ts;
+int NfexcDes = 200;
+float Aexc0 = 0.8f;
+float Aexc1 = 0.2f; // Aexc0/fMax;
+GPA gpa(fMin, fMax, NfexcDes, Aexc0, Aexc1, Ts);
+float w = 0.0f;
+float exc = 0.0f;
+*/
//******************************************************************************
//---------- main loop -------------
//******************************************************************************
@@ -59,6 +82,8 @@
if(controller_active) {
// controller update
i_des = pi1(w - x) - dt1(x);
+ // i_des = pi1(exc - x) - dt1(x);
+ // exc = gpa(i_des, x);
}
out.write(i2u(i_des));
if(++k>1000) {
@@ -90,6 +115,8 @@
// reset controller here!!!
dt1.reset(0.0);
pi1.reset(0.0);
+ // gpa.reset();
+ // exc = 0.0f;
} else
pc.printf("Controller disabled\r\n");
}