Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
wheelUnit.cpp
00001 #include "wheelUnit.h" 00002 00003 WheelUnit::WheelUnit(Serial* serial) : 00004 omni(4), 00005 pc(USBTX, USBRX, 115200) 00006 { 00007 md = new ikarashiMDC*[4]; 00008 for(int i = 0; i < 4; ++i) md[i] = new ikarashiMDC(2,i,SM,serial); 00009 for(int i = 0; i < 4; ++i) md[i]->braking = true; 00010 for(int i = 0; i < 4; i++) omni.wheel[i].setRadian(PI / 4.0 * (2.0*i+1.0)); 00011 } 00012 00013 void WheelUnit::move(float x,float y,float turnPower) 00014 { 00015 omni.computeXY(x,y,turnPower); 00016 for (int i = 0; i < 4; ++i) wheel[i] = omni.wheel[i]; 00017 for (int i = 0; i < 4; ++i) md[i]->setSpeed(wheel[i] * SPEEDRATE); 00018 print = omni.wheel[0]; 00019 pc.printf("%f\n\r",print); 00020 } 00021 00022 void WheelUnit::stop() 00023 { 00024 for (int i = 0; i < 4; ++i) md[i]->setSpeed(0); 00025 pc.printf("0\n\r"); 00026 }
Generated on Tue Jul 12 2022 18:01:51 by
1.7.2