robot

Dependencies:   FastPWM3 mbed

Revision:
159:9dbc0657238c
Parent:
64:b4175385d718
Child:
181:d3510c8beab6
--- a/MathHelpers/MathHelpers.cpp	Sun May 07 17:36:33 2017 +0000
+++ b/MathHelpers/MathHelpers.cpp	Sun May 07 17:43:41 2017 +0000
@@ -16,8 +16,8 @@
 float constrain_norm(float *x, float *y, float coeffx, float coeffy, float max) {
     float norm = sqrtf(coeffx * *x * *x + coeffy * *y * *y);
     if (norm > max) {
-        *x /= norm;
-        *y /= norm;
+        *x /= (norm / max);
+        *y /= (norm / max);
     }
     return norm;
 }