![](/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
readMotion/readMotion.cpp
- Committer:
- syundo0730
- Date:
- 2013-11-22
- Revision:
- 23:0927e605af4b
- Parent:
- 20:abb7852df747
File content as of revision 23:0927e605af4b:
#include "readMotion.h" using namespace std; bool readMotion(string filename, uint16_t* pos, int &servo_size, int &motion_size, int* pose_size) { fstream file; string line, tmp; stringstream sstr; file.open(filename.c_str(), ios::in); if(! file.is_open()) { return false; } int i = 0, id = 0; while(getline(file, line)) { std::replace(line.begin(), line.end(), ',', ' '); sstr.clear(); sstr.str(line); while (sstr >> tmp) { if (tmp == "d") { while (sstr >> pos[i]) ++i; } else if (tmp == "servo_size") { sstr >> servo_size; } else if (tmp == "motion_size") { sstr >> motion_size; } else if (tmp == "pose_size") { sstr >> pose_size[id]; ++id; } } } file.close(); return true; }