Controlor for Humanoid. Walking trajectory generator, sensor reflection etc.

Dependencies:   Adafruit-PWM-Servo-Driver MPU6050 RS300 mbed

Committer:
syundo0730
Date:
Sat Sep 22 10:24:14 2012 +0000
Revision:
11:1539d181e159
Parent:
10:be8b10e54ecb
Child:
12:6cd135bf03bd
16bit version

Who changed what in which revision?

UserRevisionLine numberNew 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 11:1539d181e159 11 unsigned short int size_x = 400; //max about 25kb
syundo0730 11:1539d181e159 12 unsigned char size_y = 25;
syundo0730 0:d114194bff43 13
syundo0730 11:1539d181e159 14 uint16_t **array = new uint16_t*[size_x];
syundo0730 9:d9ce965299d2 15 for (int i = 0; i < size_x; ++i) {
syundo0730 11:1539d181e159 16 array[i] = new uint16_t[size_y];
syundo0730 9:d9ce965299d2 17 }
syundo0730 9:d9ce965299d2 18 for (int i = 0; i < size_x; ++i) {
syundo0730 9:d9ce965299d2 19 for (int j = 0; j < size_y; ++j) {
syundo0730 11:1539d181e159 20 array[i][j] = 900 + 2*i;
syundo0730 9:d9ce965299d2 21 }
syundo0730 9:d9ce965299d2 22 }
syundo0730 11:1539d181e159 23 for (int i = 0; i < size_x; ++i) {
syundo0730 11:1539d181e159 24 array[i][size_y - 1] = 1;
syundo0730 11:1539d181e159 25 }
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 11:1539d181e159 36 wait(0.05);
syundo0730 5:0ca9f1bc1fb0 37 }
syundo0730 10:be8b10e54ecb 38 }