Controlor for Humanoid. Walking trajectory generator, sensor reflection etc.
Dependencies: Adafruit-PWM-Servo-Driver MPU6050 RS300 mbed
Diff: Motions.cpp
- Revision:
- 15:e37a8c413e51
- Parent:
- 14:522bb06f0f0d
- Child:
- 16:e65c192b7ecf
--- a/Motions.cpp Thu Feb 21 14:27:19 2013 +0000 +++ b/Motions.cpp Thu Feb 21 15:21:12 2013 +0000 @@ -9,6 +9,8 @@ extern uint16_t data[0x2000] __attribute__((section("AHBSRAM1"))); extern Ticker tick; +bool g_motion_playing = false; + //Serial serial(USBTX, USBRX); Motions::Motions(uint16_t* data) @@ -70,17 +72,7 @@ } } -void Motions::play() -{ - if (playing) { - if (!inter->is_in_interrupt()) { - delete inter; - playing = false; - } - } -} - -void Motions::setmotion(const int id) +/*void Motions::setmotion(const int id) { if (!playing) { //serial.printf("start motion! id = %d \r\n", id); @@ -88,21 +80,20 @@ tick.attach(inter, &Motion::step, TIMESTEP); playing = true; } -} +}*/ -/*void Motions::setmotion(const int id) +void Motions::setmotion(const int id) { - //if (inter == NULL) { + if (!g_motion_playing) { //serial.printf("start motion! id = %d \r\n", id); inter = new Motion(motions[id], pose_size[id], servo_size); tick.attach(inter, &Motion::step, TIMESTEP); playing = true; - //} -}*/ + } +} void Motions::control() { - play(); //int id = comu->getid(); //serial.printf("id: %d \r\n", id); //if (checkid(id)) { //<- Misterious bug. Why is id starts from 48?