robot

Dependencies:   FastPWM3 mbed

Revision:
111:451e40aed753
Parent:
56:c681001dfa46
Child:
160:6948bb7bcabd
--- a/ThrottleMapper/ThrottleMapper.cpp	Sat Apr 15 05:22:50 2017 +0000
+++ b/ThrottleMapper/ThrottleMapper.cpp	Fri Apr 21 01:23:59 2017 +0000
@@ -5,6 +5,8 @@
 #include "config_driving.h"
 
 float DrivingThrottleMapper::map(float throttle, float w) {
+    if (throttle < 0.0f) throttle = 0.0f;
+    
     float z = getZeroTqThrottle(w);
     float tq, tqmax;
     
@@ -37,6 +39,8 @@
 }
 
 float LimitingThrottleMapper::map(float throttle, float w) {
+    if (throttle < 0.0f) throttle = 0.0f;
+    
     if (w <= __wlim) {
         return throttle;
     }