![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
bio robot
Dependencies: MPU6050-DMP QEI_hw mbed-rpc mbed
Fork of MPU6050_Example by
main.cpp@9:1d9b24d7ac77, 2015-12-05 (annotated)
- Committer:
- amandaghassaei
- Date:
- Sat Dec 05 00:40:42 2015 +0000
- Revision:
- 9:1d9b24d7ac77
- Parent:
- 8:1a3a69fecedf
- Child:
- 10:769cc457c3a4
basic motor pwm working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
amandaghassaei | 3:be5cf450436d | 1 | #include "mbed.h" |
amandaghassaei | 7:7efcd3bf3302 | 2 | #include "mbed_rpc.h" |
amandaghassaei | 2:17b18ea93551 | 3 | #include "Comm.h" |
amandaghassaei | 7:7efcd3bf3302 | 4 | #include "Controls.h" |
amandaghassaei | 3:be5cf450436d | 5 | |
amandaghassaei | 7:7efcd3bf3302 | 6 | Controls controls; |
amandaghassaei | 9:1d9b24d7ac77 | 7 | Comm comm(&controls); |
amandaghassaei | 9:1d9b24d7ac77 | 8 | |
amandaghassaei | 9:1d9b24d7ac77 | 9 | long serialCounter = 0; |
amandaghassaei | 9:1d9b24d7ac77 | 10 | |
amandaghassaei | 9:1d9b24d7ac77 | 11 | |
syundo0730 | 0:8d2c753a96e7 | 12 | |
amandaghassaei | 6:12b6be801ad8 | 13 | int main() { |
amandaghassaei | 9:1d9b24d7ac77 | 14 | controls.setPC(comm.getPC()); |
amandaghassaei | 9:1d9b24d7ac77 | 15 | // comm.printPosition(); |
amandaghassaei | 9:1d9b24d7ac77 | 16 | // comm.printGains(); |
amandaghassaei | 6:12b6be801ad8 | 17 | while(1) { |
amandaghassaei | 7:7efcd3bf3302 | 18 | controls.loop(); |
amandaghassaei | 6:12b6be801ad8 | 19 | comm.check(); |
amandaghassaei | 9:1d9b24d7ac77 | 20 | if (serialCounter++>100) { |
amandaghassaei | 9:1d9b24d7ac77 | 21 | // comm.printPosition(); |
amandaghassaei | 9:1d9b24d7ac77 | 22 | // controls.printPWM(); |
amandaghassaei | 9:1d9b24d7ac77 | 23 | serialCounter = 0; |
amandaghassaei | 9:1d9b24d7ac77 | 24 | } |
amandaghassaei | 6:12b6be801ad8 | 25 | } |
amandaghassaei | 6:12b6be801ad8 | 26 | } |
amandaghassaei | 6:12b6be801ad8 | 27 | |
amandaghassaei | 6:12b6be801ad8 | 28 | |
amandaghassaei | 6:12b6be801ad8 | 29 | //wrappers for comm stack |
amandaghassaei | 5:c3d671959ef3 | 30 | void openGripper1Wrapper(Arguments * input, Reply * output){ |
amandaghassaei | 5:c3d671959ef3 | 31 | comm.openGripper1(input, output); |
amandaghassaei | 5:c3d671959ef3 | 32 | }; |
amandaghassaei | 5:c3d671959ef3 | 33 | RPCFunction OpenGripper1(&openGripper1Wrapper, "OpenGripper1"); |
amandaghassaei | 5:c3d671959ef3 | 34 | void closeGripper1Wrapper(Arguments * input, Reply * output){ |
amandaghassaei | 5:c3d671959ef3 | 35 | comm.closeGripper1(input, output); |
amandaghassaei | 5:c3d671959ef3 | 36 | }; |
amandaghassaei | 5:c3d671959ef3 | 37 | RPCFunction CloseGripper1(&closeGripper1Wrapper, "CloseGripper1"); |
amandaghassaei | 5:c3d671959ef3 | 38 | void openGripper2Wrapper(Arguments * input, Reply * output){ |
amandaghassaei | 5:c3d671959ef3 | 39 | comm.openGripper2(input, output); |
amandaghassaei | 5:c3d671959ef3 | 40 | }; |
amandaghassaei | 5:c3d671959ef3 | 41 | RPCFunction OpenGripper2(&openGripper2Wrapper, "OpenGripper2"); |
amandaghassaei | 5:c3d671959ef3 | 42 | void closeGripper2Wrapper(Arguments * input, Reply * output){ |
amandaghassaei | 5:c3d671959ef3 | 43 | comm.closeGripper2(input, output); |
amandaghassaei | 5:c3d671959ef3 | 44 | }; |
amandaghassaei | 5:c3d671959ef3 | 45 | RPCFunction CloseGripper2(&closeGripper2Wrapper, "CloseGripper2"); |
amandaghassaei | 9:1d9b24d7ac77 | 46 | void setSwingUpKWrapper(Arguments * input, Reply * output){ |
amandaghassaei | 9:1d9b24d7ac77 | 47 | comm.setSwingUpK(input, output); |
amandaghassaei | 5:c3d671959ef3 | 48 | }; |
amandaghassaei | 9:1d9b24d7ac77 | 49 | RPCFunction SetSwingUpK(&setSwingUpKWrapper, "SetSwingUpK"); |
amandaghassaei | 9:1d9b24d7ac77 | 50 | void setSwingUpDWrapper(Arguments * input, Reply * output){ |
amandaghassaei | 9:1d9b24d7ac77 | 51 | comm.setSwingUpD(input, output); |
amandaghassaei | 9:1d9b24d7ac77 | 52 | }; |
amandaghassaei | 9:1d9b24d7ac77 | 53 | RPCFunction SetSwingUpD(&setSwingUpDWrapper, "SetSwingUpD"); |
amandaghassaei | 9:1d9b24d7ac77 | 54 | void setTargetWrapper(Arguments * input, Reply * output){ |
amandaghassaei | 5:c3d671959ef3 | 55 | comm.setTarget(input, output); |
amandaghassaei | 5:c3d671959ef3 | 56 | }; |
amandaghassaei | 9:1d9b24d7ac77 | 57 | RPCFunction SetTarget(&setTargetWrapper, "SetTarget"); |
amandaghassaei | 9:1d9b24d7ac77 | 58 | void setTorqueWrapper(Arguments * input, Reply * output){ |
amandaghassaei | 9:1d9b24d7ac77 | 59 | comm.setTorque(input, output); |
amandaghassaei | 9:1d9b24d7ac77 | 60 | }; |
amandaghassaei | 9:1d9b24d7ac77 | 61 | RPCFunction SetTorque(&setTorqueWrapper, "SetTorque"); |
amandaghassaei | 5:c3d671959ef3 | 62 | |
amandaghassaei | 5:c3d671959ef3 | 63 | |
amandaghassaei | 5:c3d671959ef3 | 64 | |
amandaghassaei | 5:c3d671959ef3 | 65 | |
syundo0730 | 0:8d2c753a96e7 | 66 |