use for experiment before the demonstration at open-campus
Dependencies: FEP ikarashiMDC omni PID R1370
Fork of omni_sample by
main.cpp@0:6c83a0871cc3, 2017-07-03 (annotated)
- Committer:
- UCHITAKE
- Date:
- Mon Jul 03 14:24:30 2017 +0000
- Revision:
- 0:6c83a0871cc3
- Child:
- 1:ba8cdae2652a
first commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
UCHITAKE | 0:6c83a0871cc3 | 1 | #include "mbed.h" |
UCHITAKE | 0:6c83a0871cc3 | 2 | #include "omni.h" |
UCHITAKE | 0:6c83a0871cc3 | 3 | #include "MotorDriverController.h" |
UCHITAKE | 0:6c83a0871cc3 | 4 | #include "pin_config.h" |
UCHITAKE | 0:6c83a0871cc3 | 5 | |
UCHITAKE | 0:6c83a0871cc3 | 6 | MDC motor(i2c_sda, i2c_scl); |
UCHITAKE | 0:6c83a0871cc3 | 7 | Omni omni(4, 45); |
UCHITAKE | 0:6c83a0871cc3 | 8 | |
UCHITAKE | 0:6c83a0871cc3 | 9 | int main() |
UCHITAKE | 0:6c83a0871cc3 | 10 | { |
UCHITAKE | 0:6c83a0871cc3 | 11 | double polarVector[2]; |
UCHITAKE | 0:6c83a0871cc3 | 12 | while(1) { |
UCHITAKE | 0:6c83a0871cc3 | 13 | for(int i = 0; i < 360; i++) { |
UCHITAKE | 0:6c83a0871cc3 | 14 | polarVector[0] = i; |
UCHITAKE | 0:6c83a0871cc3 | 15 | polarVector[1] = 1.0; |
UCHITAKE | 0:6c83a0871cc3 | 16 | omni.computePolar(polarVector, 0); |
UCHITAKE | 0:6c83a0871cc3 | 17 | for(int j = 0; j < 4; j++) { |
UCHITAKE | 0:6c83a0871cc3 | 18 | motor.write(7, j, omni.getOutput(j)); |
UCHITAKE | 0:6c83a0871cc3 | 19 | } |
UCHITAKE | 0:6c83a0871cc3 | 20 | } |
UCHITAKE | 0:6c83a0871cc3 | 21 | } |
UCHITAKE | 0:6c83a0871cc3 | 22 | } |