![](/media/cache/profiles/e5815151957be36ad2085b7a1a02c5cc.jpg.50x50_q85.jpg)
Controlor for Humanoid. Walking trajectory generator, sensor reflection etc.
Dependencies: Adafruit-PWM-Servo-Driver MPU6050 RS300 mbed
main.cpp@12:6cd135bf03bd, 2013-02-03 (annotated)
- Committer:
- syundo0730
- Date:
- Sun Feb 03 04:53:44 2013 +0000
- Revision:
- 12:6cd135bf03bd
- Parent:
- 11:1539d181e159
- Child:
- 13:711f74b2fa33
file reading, motion selecting, serial communication
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 | 12:6cd135bf03bd | 3 | #include "Motions.h" |
syundo0730 | 0:d114194bff43 | 4 | |
syundo0730 | 12:6cd135bf03bd | 5 | uint16_t data[0x2000] __attribute__((section("AHBSRAM1"))); //motion data area |
syundo0730 | 12:6cd135bf03bd | 6 | Ticker tick; //Ticker for main control roop |
syundo0730 | 5:0ca9f1bc1fb0 | 7 | |
syundo0730 | 8:72b4a248d469 | 8 | int main(void) |
syundo0730 | 8:72b4a248d469 | 9 | { |
syundo0730 | 12:6cd135bf03bd | 10 | unsigned short int size_x = 25; //max about 25kb |
syundo0730 | 12:6cd135bf03bd | 11 | unsigned short int size_y = 400; |
syundo0730 | 0:d114194bff43 | 12 | |
syundo0730 | 11:1539d181e159 | 13 | uint16_t **array = new uint16_t*[size_x]; |
syundo0730 | 12:6cd135bf03bd | 14 | for (int i = 0; i < size_y; ++i) { |
syundo0730 | 12:6cd135bf03bd | 15 | array[i] = new uint16_t[size_x]; |
syundo0730 | 12:6cd135bf03bd | 16 | } |
syundo0730 | 12:6cd135bf03bd | 17 | for (int i = 0; i < size_y; ++i) { |
syundo0730 | 12:6cd135bf03bd | 18 | for (int j = 0; j < size_x; ++j) { |
syundo0730 | 12:6cd135bf03bd | 19 | array[i][j] = 900 + 2*i; |
syundo0730 | 12:6cd135bf03bd | 20 | } |
syundo0730 | 12:6cd135bf03bd | 21 | } |
syundo0730 | 12:6cd135bf03bd | 22 | for (int i = 0; i < size_y; ++i) { |
syundo0730 | 12:6cd135bf03bd | 23 | array[i][size_x - 1] = 1; |
syundo0730 | 12:6cd135bf03bd | 24 | } |
syundo0730 | 9:d9ce965299d2 | 25 | |
syundo0730 | 12:6cd135bf03bd | 26 | Motion inter0(array, size_y, size_x); |
syundo0730 | 12:6cd135bf03bd | 27 | //int data[256]; |
syundo0730 | 12:6cd135bf03bd | 28 | //CSV csv; |
syundo0730 | 12:6cd135bf03bd | 29 | //csv.readCSV("data.csv", data); |
syundo0730 | 12:6cd135bf03bd | 30 | |
syundo0730 | 12:6cd135bf03bd | 31 | //Motions motions(data); |
syundo0730 | 1:5c2e40445778 | 32 | |
syundo0730 | 5:0ca9f1bc1fb0 | 33 | while (1) { |
syundo0730 | 12:6cd135bf03bd | 34 | //motions.control(); |
syundo0730 | 10:be8b10e54ecb | 35 | if (!inter0.is_in_interrupt()) { |
syundo0730 | 10:be8b10e54ecb | 36 | tick.attach(&inter0, &Motion::step, 0.02); |
syundo0730 | 10:be8b10e54ecb | 37 | } |
syundo0730 | 12:6cd135bf03bd | 38 | wait(5); |
syundo0730 | 5:0ca9f1bc1fb0 | 39 | } |
syundo0730 | 10:be8b10e54ecb | 40 | } |