Controlor for Humanoid. Walking trajectory generator, sensor reflection etc.
Dependencies: Adafruit-PWM-Servo-Driver MPU6050 RS300 mbed
main.cpp@10:be8b10e54ecb, 2012-09-22 (annotated)
- Committer:
- syundo0730
- Date:
- Sat Sep 22 06:58:21 2012 +0000
- Revision:
- 10:be8b10e54ecb
- Parent:
- 9:d9ce965299d2
- Child:
- 11:1539d181e159
repeat
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
syundo0730 | 0:d114194bff43 | 1 | #include "LPC17xx.h" |
syundo0730 | 0:d114194bff43 | 2 | #include "mbed.h" |
syundo0730 | 9:d9ce965299d2 | 3 | #include "PWM.h" |
syundo0730 | 9:d9ce965299d2 | 4 | #include "Motion.h" |
syundo0730 | 0:d114194bff43 | 5 | |
syundo0730 | 9:d9ce965299d2 | 6 | Ticker tick; |
syundo0730 | 9:d9ce965299d2 | 7 | PWM pwm; |
syundo0730 | 5:0ca9f1bc1fb0 | 8 | |
syundo0730 | 8:72b4a248d469 | 9 | int main(void) |
syundo0730 | 8:72b4a248d469 | 10 | { |
syundo0730 | 9:d9ce965299d2 | 11 | unsigned char size_x = 4, size_y = 24; |
syundo0730 | 0:d114194bff43 | 12 | |
syundo0730 | 9:d9ce965299d2 | 13 | uint32_t **array = new uint32_t*[size_x]; |
syundo0730 | 9:d9ce965299d2 | 14 | for (int i = 0; i < size_x; ++i) { |
syundo0730 | 9:d9ce965299d2 | 15 | array[i] = new uint32_t[size_y]; |
syundo0730 | 9:d9ce965299d2 | 16 | } |
syundo0730 | 9:d9ce965299d2 | 17 | for (int i = 0; i < size_x; ++i) { |
syundo0730 | 9:d9ce965299d2 | 18 | for (int j = 0; j < size_y; ++j) { |
syundo0730 | 9:d9ce965299d2 | 19 | array[i][j] = 900 + 300 * i; |
syundo0730 | 9:d9ce965299d2 | 20 | } |
syundo0730 | 9:d9ce965299d2 | 21 | } |
syundo0730 | 9:d9ce965299d2 | 22 | array[0][size_y - 1] = 50; |
syundo0730 | 9:d9ce965299d2 | 23 | array[1][size_y - 1] = 50; |
syundo0730 | 9:d9ce965299d2 | 24 | array[2][size_y - 1] = 50; |
syundo0730 | 9:d9ce965299d2 | 25 | array[3][size_y - 1] = 50; |
syundo0730 | 9:d9ce965299d2 | 26 | |
syundo0730 | 9:d9ce965299d2 | 27 | Motion inter0(array, size_x, size_y); |
syundo0730 | 9:d9ce965299d2 | 28 | |
syundo0730 | 10:be8b10e54ecb | 29 | //tick.attach(&inter0, &Motion::step, 0.02); |
syundo0730 | 1:5c2e40445778 | 30 | |
syundo0730 | 5:0ca9f1bc1fb0 | 31 | while (1) { |
syundo0730 | 10:be8b10e54ecb | 32 | //int id = 0; |
syundo0730 | 10:be8b10e54ecb | 33 | if (!inter0.is_in_interrupt()) { |
syundo0730 | 10:be8b10e54ecb | 34 | tick.attach(&inter0, &Motion::step, 0.02); |
syundo0730 | 10:be8b10e54ecb | 35 | } |
syundo0730 | 10:be8b10e54ecb | 36 | wait(0.02); |
syundo0730 | 5:0ca9f1bc1fb0 | 37 | } |
syundo0730 | 10:be8b10e54ecb | 38 | } |