
Clase Tracción que implementa 2 objetos del tipo motor para controlar la dirección, velocidad, ángulo de giro de un vehículo a base de 2 motores, tanto continuos como discretos. Esta clase genera los comandos para cada motor con el fin de que la plataforma gire o se mueva en el sentido deseado o la cantidad de grados necesarios.
comments.txt@0:9b57ccb09755, 2021-09-03 (annotated)
- Committer:
- CCastrop1012
- Date:
- Fri Sep 03 05:11:24 2021 +0000
- Revision:
- 0:9b57ccb09755
Clase Traccion que implementa 2 objetos del tipo motor para controlar la direccion, velocidad, angulo de giro de un vehiculo a base de 2 motores, tanto continuos como discretos. Esta clase genera los comandos para cada motor para cada movimiento.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
CCastrop1012 | 0:9b57ccb09755 | 1 | |
CCastrop1012 | 0:9b57ccb09755 | 2 | |
CCastrop1012 | 0:9b57ccb09755 | 3 | /// Constructores para Motores Continuos |
CCastrop1012 | 0:9b57ccb09755 | 4 | /* |
CCastrop1012 | 0:9b57ccb09755 | 5 | Motor::Motor(PinName L1, PinName L2, PinName speedPin, PinName encodin, PinName PosInicial, int EncodPulses ): |
CCastrop1012 | 0:9b57ccb09755 | 6 | _L1(L1), _L2(L2), _speedPin(speedPin), _encodin(encodin), _PosInicial(PosInicial), _EncodPulses(EncodPulses) |
CCastrop1012 | 0:9b57ccb09755 | 7 | { |
CCastrop1012 | 0:9b57ccb09755 | 8 | _speedPin.period_ms(5); |
CCastrop1012 | 0:9b57ccb09755 | 9 | _speedPin.write(0); |
CCastrop1012 | 0:9b57ccb09755 | 10 | |
CCastrop1012 | 0:9b57ccb09755 | 11 | }; |
CCastrop1012 | 0:9b57ccb09755 | 12 | |
CCastrop1012 | 0:9b57ccb09755 | 13 | |
CCastrop1012 | 0:9b57ccb09755 | 14 | |
CCastrop1012 | 0:9b57ccb09755 | 15 | |
CCastrop1012 | 0:9b57ccb09755 | 16 | Motor::Motor(PinName L1, PinName L2, PinName speedPin) |
CCastrop1012 | 0:9b57ccb09755 | 17 | { |
CCastrop1012 | 0:9b57ccb09755 | 18 | _L1(L1); |
CCastrop1012 | 0:9b57ccb09755 | 19 | _L2(L2); |
CCastrop1012 | 0:9b57ccb09755 | 20 | _speedPin(speedPin); |
CCastrop1012 | 0:9b57ccb09755 | 21 | |
CCastrop1012 | 0:9b57ccb09755 | 22 | _speedPin.period_ms(5); |
CCastrop1012 | 0:9b57ccb09755 | 23 | _speedPin.write(0); |
CCastrop1012 | 0:9b57ccb09755 | 24 | }; |
CCastrop1012 | 0:9b57ccb09755 | 25 | |
CCastrop1012 | 0:9b57ccb09755 | 26 | |
CCastrop1012 | 0:9b57ccb09755 | 27 | Motor::Motor(PinName L1, PinName L2, PinName speedPin, PinName EncodIn, int EncodPulses): // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 28 | _L1(L1), _L2(L2), _speedPin(speedPin), _EncodIn(EncodIn), _EncodPulses(EncodPulses) |
CCastrop1012 | 0:9b57ccb09755 | 29 | { |
CCastrop1012 | 0:9b57ccb09755 | 30 | _speedPin.period_ms(5); |
CCastrop1012 | 0:9b57ccb09755 | 31 | _speedPin.write(0); |
CCastrop1012 | 0:9b57ccb09755 | 32 | }; |
CCastrop1012 | 0:9b57ccb09755 | 33 | |
CCastrop1012 | 0:9b57ccb09755 | 34 | |
CCastrop1012 | 0:9b57ccb09755 | 35 | |
CCastrop1012 | 0:9b57ccb09755 | 36 | /// Constructores para Motores Discretos |
CCastrop1012 | 0:9b57ccb09755 | 37 | |
CCastrop1012 | 0:9b57ccb09755 | 38 | Motor::Motor(char tipo, PinName Dir, PinName Step): _Dir(Dir), _Step(Step) // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 39 | { |
CCastrop1012 | 0:9b57ccb09755 | 40 | |
CCastrop1012 | 0:9b57ccb09755 | 41 | }; |
CCastrop1012 | 0:9b57ccb09755 | 42 | |
CCastrop1012 | 0:9b57ccb09755 | 43 | Motor::Motor(char tipo, PinName Dir, PinName Step, PinName EncodIn, int EncodPulses): _Dir(Dir), _Step(Step), // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 44 | _EncodIn(EncodIn), _EncodPulses(EncodPulses) |
CCastrop1012 | 0:9b57ccb09755 | 45 | { |
CCastrop1012 | 0:9b57ccb09755 | 46 | |
CCastrop1012 | 0:9b57ccb09755 | 47 | }; // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 48 | |
CCastrop1012 | 0:9b57ccb09755 | 49 | Motor::Motor(char tipo, PinName Dir, PinName Step, PinName EncodIn, int EncodPulses, PinName PosInicial): _Dir(Dir), _Step(Step), // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 50 | _EncodIn(EncodIn), _EncodPulses(EncodPulses), _PosInicial(PosInicial) |
CCastrop1012 | 0:9b57ccb09755 | 51 | { |
CCastrop1012 | 0:9b57ccb09755 | 52 | |
CCastrop1012 | 0:9b57ccb09755 | 53 | }; // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 54 | |
CCastrop1012 | 0:9b57ccb09755 | 55 | Motor::Motor(char tipo, PinName Dir, PinName Step, PinName ustep1, PinName ustep2,PinName ustep3): _Dir(Dir), _Step(Step), // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 56 | _ustep1(ustep1), _ustep2(ustep2), _ustep3(ustep3) |
CCastrop1012 | 0:9b57ccb09755 | 57 | { |
CCastrop1012 | 0:9b57ccb09755 | 58 | |
CCastrop1012 | 0:9b57ccb09755 | 59 | }; // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 60 | |
CCastrop1012 | 0:9b57ccb09755 | 61 | Motor::Motor(char tipo, PinName Dir, PinName Step, PinName ustep1, PinName ustep2,PinName ustep3, |
CCastrop1012 | 0:9b57ccb09755 | 62 | PinName EncodIn, int EncodPulses): _Dir(Dir), _Step(Step,_ustep1(ustep1), _ustep2(ustep2), |
CCastrop1012 | 0:9b57ccb09755 | 63 | _ustep3(ustep3), _EncodIn(EncodIn), _EncodPulses(EncodPulses) // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 64 | |
CCastrop1012 | 0:9b57ccb09755 | 65 | { |
CCastrop1012 | 0:9b57ccb09755 | 66 | |
CCastrop1012 | 0:9b57ccb09755 | 67 | }; |
CCastrop1012 | 0:9b57ccb09755 | 68 | |
CCastrop1012 | 0:9b57ccb09755 | 69 | // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 70 | Motor::Motor(char tipo, PinName Dir, PinName Step, PinName ustep1, PinName ustep2,PinName ustep3, |
CCastrop1012 | 0:9b57ccb09755 | 71 | PinName EncodIn, int EncodPulses, PinName PosInicial): _Dir(Dir), _Step(Step,_ustep1(ustep1), |
CCastrop1012 | 0:9b57ccb09755 | 72 | _ustep2(ustep2), _ustep3(ustep3), _EncodIn(EncodIn), _EncodPulses(EncodPulses), _PosInicial(PosInicial) // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 73 | { |
CCastrop1012 | 0:9b57ccb09755 | 74 | |
CCastrop1012 | 0:9b57ccb09755 | 75 | }; // Constructor del Objeto |
CCastrop1012 | 0:9b57ccb09755 | 76 | */ |
CCastrop1012 | 0:9b57ccb09755 | 77 |