Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
src/dynamics.cpp@29:33c5c61f1068, 2013-11-24 (annotated)
- Committer:
- calamaridudeman
- Date:
- Sun Nov 24 19:21:47 2013 +0000
- Revision:
- 29:33c5c61f1068
- Parent:
- 28:21773a6fb6df
- Child:
- 30:18724a8fb2bf
Added & everywhere (including fields!) to ensure no copying of encoders (which breaks the interrupts). All motor encoders reporting properly now
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| calamaridudeman | 21:a9569c7b4379 | 1 | #include "mbed.h" |
| calamaridudeman | 23:112c0be5a7f3 | 2 | #include "include/dynamics.hpp" |
| calamaridudeman | 25:8a34b8d6cc6e | 3 | #include "include/motor.hpp" |
| calamaridudeman | 16:c21df8c0c458 | 4 | |
| calamaridudeman | 28:21773a6fb6df | 5 | Kangaroo::Kangaroo(Motor &M1, Motor &M2, QEI &e1, QEI &e2):enc1(e1),enc2(e2),m1(M1),m2(M2){ |
| calamaridudeman | 25:8a34b8d6cc6e | 6 | |
| calamaridudeman | 25:8a34b8d6cc6e | 7 | } |
| calamaridudeman | 25:8a34b8d6cc6e | 8 | |
| calamaridudeman | 26:53b793b7a82f | 9 | void Kangaroo::zero(){ |
| calamaridudeman | 25:8a34b8d6cc6e | 10 | m1.setVel(-.002);//wait for the legs to go to stopping points |
| calamaridudeman | 25:8a34b8d6cc6e | 11 | m2.setVel(-.002); |
| calamaridudeman | 25:8a34b8d6cc6e | 12 | wait(1); |
| calamaridudeman | 25:8a34b8d6cc6e | 13 | |
| calamaridudeman | 25:8a34b8d6cc6e | 14 | m1.zero(); |
| calamaridudeman | 25:8a34b8d6cc6e | 15 | m2.zero(); |
| calamaridudeman | 25:8a34b8d6cc6e | 16 | |
| calamaridudeman | 25:8a34b8d6cc6e | 17 | enc1.reset(); |
| calamaridudeman | 25:8a34b8d6cc6e | 18 | enc2.reset(); |
| calamaridudeman | 25:8a34b8d6cc6e | 19 | |
| calamaridudeman | 25:8a34b8d6cc6e | 20 | while((enc1.getRevolutions()==0)&&(enc2.getRevolutions()==0)){ |
| calamaridudeman | 25:8a34b8d6cc6e | 21 | wait(0.1); |
| calamaridudeman | 25:8a34b8d6cc6e | 22 | } |
| calamaridudeman | 25:8a34b8d6cc6e | 23 | |
| calamaridudeman | 25:8a34b8d6cc6e | 24 | |
| calamaridudeman | 26:53b793b7a82f | 25 | } |
| calamaridudeman | 26:53b793b7a82f | 26 | |
| calamaridudeman | 28:21773a6fb6df | 27 | void Kangaroo::testEncoders(Serial &pc){ |
| calamaridudeman | 28:21773a6fb6df | 28 | //pc.printf("hello world\n"); |
| calamaridudeman | 26:53b793b7a82f | 29 | |
| calamaridudeman | 29:33c5c61f1068 | 30 | //pc.printf("motor1: %i\n",m1.getPos()); |
| calamaridudeman | 28:21773a6fb6df | 31 | pc.printf("clix1: %i, rots1: %i\n",enc1.getPulses(), enc1.getRevolutions()); |
| calamaridudeman | 28:21773a6fb6df | 32 | |
| calamaridudeman | 29:33c5c61f1068 | 33 | //pc.printf("motor2: %i\n",); |
| calamaridudeman | 28:21773a6fb6df | 34 | pc.printf("clix2: %i, rots2: %i\n",enc2.getPulses(), enc2.getRevolutions()); |
| calamaridudeman | 25:8a34b8d6cc6e | 35 | } |
