手動b足回り

Dependents:   kobayashi_rei

Committer:
THtakahiro702286
Date:
Thu Jul 11 09:19:29 2019 +0000
Revision:
2:9017bbe177b7
Parent:
1:3c9eaf598f21
Child:
3:01a6eca21b23
start work together neko

Who changed what in which revision?

UserRevisionLine numberNew contents of line
THtakahiro702286 0:0d52f303ac08 1 #include "wheelUnit.h"
THtakahiro702286 0:0d52f303ac08 2
THtakahiro702286 0:0d52f303ac08 3 WheelUnit::WheelUnit(Serial* serial) :
THtakahiro702286 0:0d52f303ac08 4 omni(4),
THtakahiro702286 0:0d52f303ac08 5 pc(USBTX, USBRX, 115200)
THtakahiro702286 0:0d52f303ac08 6 {
THtakahiro702286 0:0d52f303ac08 7 md = new ikarashiMDC*[4];
THtakahiro702286 0:0d52f303ac08 8 for(int i = 0; i < 4; ++i) md[i] = new ikarashiMDC(2,i,SM,serial);
THtakahiro702286 0:0d52f303ac08 9 for(int i = 0; i < 4; ++i) md[i]->braking = true;
THtakahiro702286 0:0d52f303ac08 10 for(int i = 0; i < 4; i++) omni.wheel[i].setRadian(PI / 4.0 * (2.0*i+1.0));
THtakahiro702286 0:0d52f303ac08 11 }
THtakahiro702286 0:0d52f303ac08 12
THtakahiro702286 0:0d52f303ac08 13 void WheelUnit::move(float x,float y,float turnPower)
THtakahiro702286 0:0d52f303ac08 14 {
THtakahiro702286 0:0d52f303ac08 15 omni.computeXY(x,y,turnPower);
THtakahiro702286 2:9017bbe177b7 16 for (int i = 0; i < 4; ++i) wheel[i] = omni.wheel[i];
THtakahiro702286 2:9017bbe177b7 17 for (int i = 0; i < 4; ++i) md[i]->setSpeed(wheel[i] * SPEEDRATE);
THtakahiro702286 0:0d52f303ac08 18 print = omni.wheel[0];
THtakahiro702286 0:0d52f303ac08 19 pc.printf("%f\n\r",print);
THtakahiro702286 0:0d52f303ac08 20 }
THtakahiro702286 0:0d52f303ac08 21
THtakahiro702286 0:0d52f303ac08 22 void WheelUnit::stop()
THtakahiro702286 0:0d52f303ac08 23 {
THtakahiro702286 0:0d52f303ac08 24 for (int i = 0; i < 4; ++i) md[i]->setSpeed(0);
THtakahiro702286 0:0d52f303ac08 25 pc.printf("0\n\r");
THtakahiro702286 0:0d52f303ac08 26 }