手動b足回り

Dependents:   kobayashi_rei

Committer:
THtakahiro702286
Date:
Wed Jul 10 08:01:51 2019 +0000
Revision:
1:3c9eaf598f21
Parent:
0:0d52f303ac08
Child:
2:9017bbe177b7
add rate;

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 1:3c9eaf598f21 16 for (int i = 0; i < 4; ++i) md[i]->setSpeed(omni.wheel[i] * SPEEDRATE);
THtakahiro702286 0:0d52f303ac08 17 print = omni.wheel[0];
THtakahiro702286 0:0d52f303ac08 18 pc.printf("%f\n\r",print);
THtakahiro702286 0:0d52f303ac08 19 }
THtakahiro702286 0:0d52f303ac08 20
THtakahiro702286 0:0d52f303ac08 21 void WheelUnit::stop()
THtakahiro702286 0:0d52f303ac08 22 {
THtakahiro702286 0:0d52f303ac08 23 for (int i = 0; i < 4; ++i) md[i]->setSpeed(0);
THtakahiro702286 0:0d52f303ac08 24 pc.printf("0\n\r");
THtakahiro702286 0:0d52f303ac08 25 }