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 analoghalls5_5 by
Diff: loopdriver.cpp
- Revision:
- 5:ee1e6c84c302
- Parent:
- 4:fdadf4a3577a
- Child:
- 6:99ee0ce47fb2
diff -r fdadf4a3577a -r ee1e6c84c302 loopdriver.cpp
--- a/loopdriver.cpp Mon Mar 02 11:17:15 2015 +0000
+++ b/loopdriver.cpp Tue Mar 03 06:28:10 2015 +0000
@@ -52,7 +52,7 @@
float LoopDriver::LutSin(float theta) {
if (theta < 0.0f) theta += 360.0f;
if (theta >= 360.0f) theta -= 360.0f;
- return sinetab[(int) theta];
+ return (sinetab[(int) theta]*2)-1.0f; //shift range 0:1 to -1:1
}
float LoopDriver::LutCos(float theta) {
@@ -60,11 +60,11 @@
}
void LoopDriver::update() {
- _blinky_toggle = !_blinky_toggle;
-
+ /*
_inverter->SetDtcA(LutSin(_motor->angle));
_inverter->SetDtcB(LutSin(_motor->angle - 120.0f));
_inverter->SetDtcC(LutSin(_motor->angle + 120.0f));
+ */
float alpha, beta, d, q, ref_d, ref_q, valpha, vbeta;
Clarke(_motor->I_a, _motor->I_b, &alpha, &beta);
@@ -73,4 +73,7 @@
float vd = _pid_d->Update(ref_d, d);
float vq = _pid_q->Update(ref_q, q);
InverseParke(vd, vq, _motor->angle, &valpha, &vbeta);
+ _modulator->Update(valpha, vbeta);
+
+
}
