Jose Eduardo Laruta Espejo / motoresDC

Dependents:   maple_motores maple_heading_pid maple_chotobot_rf_motores motores ... more

Revision:
2:b5d41b0442a7
Parent:
0:b1e9ffb92a0a
--- a/motoresDC.cpp	Fri Jun 10 22:14:35 2016 +0000
+++ b/motoresDC.cpp	Mon Jun 13 23:09:28 2016 +0000
@@ -7,11 +7,28 @@
                         PinName MD_s1Pin, 
                         PinName MD_s2Pin):_MI_vel(MI_velPin), _MI_s1(MI_s1Pin), _MI_s2(MI_s2Pin), _MD_vel(MD_velPin), _MD_s1(MD_s1Pin), _MD_s2(MD_s2Pin)
     {
+        _R = 3.25;
+        _L = 9.0;
         _MI_vel.period_ms(1);
         _MI_vel.write(0);
         _MD_vel.period_ms(1);
         _MD_vel.write(0);
     }
+    
+    void MotoresDC::setParams(float R, float L)
+    {
+        this->_R = R;
+        this->_L = L;
+    }
+        
+    void MotoresDC::conducirUniciclo(float v, float w)
+    {
+        float v_r = (2 * v + this->_L * w)/(2 * this->_R);
+        float v_l = (2 * v - this->_L * w)/(2 * this->_R);
+        
+        this->motorIzq(v_l);
+        this->motorDer(v_r);  
+    }
     /* funciones base para conducir */
     void MotoresDC::_izqAdelante(float velocidad)
     {