Rauno U
/
Miisu
Six crescent shaped legs
Diff: main.cpp
- Revision:
- 25:a8bb69e99d6b
- Parent:
- 24:fb1827be6f7e
- Child:
- 26:c865244ca3cf
diff -r fb1827be6f7e -r a8bb69e99d6b main.cpp --- a/main.cpp Tue Apr 19 18:26:44 2016 +0000 +++ b/main.cpp Tue Apr 26 12:22:05 2016 +0000 @@ -8,14 +8,14 @@ //PIDData speedPIDData = {0.3f, 2.0f, 0.02f}; //PIDData turnPIDData = {5.0f, 0.1f, 0.04f}; PIDData speedPIDData = {0.5f, 0.0f, 0.0f}; -PIDData turnPIDData = {5.0f, 0.1f, 0.04f}; +PIDData turnPIDData = {30.0f, 0.01f, 1.f}; SyncGroup sync; MotorData mData = {PB_0, PC_0, PC_1}; //EncoderData encData = {PA_0, PA_1, 100 * 64}; EncoderData encData = {PA_0, PA_1, 102.083 * 64}; // https://www.pololu.com/product/2826 -EncoderMotor m(mData, encData, speedPIDData, turnPIDData, NULL); +EncoderMotor m(mData, encData, speedPIDData, turnPIDData, &sync); //SpeedEncoder s(encData); @@ -46,18 +46,22 @@ m.setup(); - float speed; + float rot, speed; + //m.rotate(1.f, 0.5); + + //sync.update(NULL, 0.5); + while(1) { //scanf("%f", &turn); //m.rotate(turn, 0.2); - //scanf("%f", &speed); + scanf("%f %f", &rot, &speed); + m.rotate(rot, speed); //m.drive(speed); //printf("%f %f\n", s.getTurnSpeed(), m.getSetSpeed()); //printf("%f %f\n", m.s, m.getSetSpeed()); - printf("%ld %f\n", m.getEncoder().getCount(), m.getEncoder().getTurn()); - m.tick(); + printf("%ld %f %f\n", m.getEncoder().getCount(), m.getEncoder().getTurn(), m.getSetTurn()); //printf("%f %f\n", m.getEncoder().getTurn(), m.getSetTurn()); wait(1.f / 60); }