robot

Dependencies:   FastPWM3 mbed

Revision:
124:e70ca81676fc
Parent:
98:1051c4103900
Child:
160:6948bb7bcabd
--- a/DQMapper/DQMapper.cpp	Fri Apr 28 01:11:04 2017 +0000
+++ b/DQMapper/DQMapper.cpp	Sun Apr 30 03:46:34 2017 +0000
@@ -60,4 +60,19 @@
 void AngleMapper::map(float torque_percent, float w, float *d, float *q) {
     *q = _is * torque_percent * sinf(_theta);
     *d = _is * torque_percent * cosf(_theta);
+}
+
+void DirectMapper::map(float torque_percent, float w, float *d, float *q) {
+    *d = _id * torque_percent;
+    *q = _iq * torque_percent;
+}
+
+void SwapMapper::map(float torque_percent, float w, float *d, float *q) {
+    if (torque_percent < 0.5f) {
+        *d = 0.0f;
+        *q = _iq;
+    } else {
+        *d = _id;
+        *q = 0.0f;
+    }
 }
\ No newline at end of file