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.
Dependencies: mbed SpeedController Encoder CruizCore_R1370P
Diff: main.cpp
- Revision:
- 15:e26bad257626
- Parent:
- 14:4bdb572bf464
- Child:
- 16:7ce4ab00621a
diff -r 4bdb572bf464 -r e26bad257626 main.cpp --- a/main.cpp Thu Mar 05 08:02:27 2020 +0000 +++ b/main.cpp Thu Mar 05 08:50:38 2020 +0000 @@ -155,7 +155,7 @@ } } -double a=1; +double z=1; int main() { @@ -196,7 +196,7 @@ x=location.getX(); y=location.getY(); - printf("X=%d,Y=%d theta=%5.3f \r\n",x,y,theta); + printf("X=%d,Y=%d theta=%5.3f z=%5.3f \r\n",x,y,theta,z); //目的地決定(syuusoku check) aimX = plot[n][0]; @@ -208,14 +208,14 @@ vy=dy/sqrt((double)dx*dx+dy*dy); //四輪の出力計算 - omega.setOmega(a); + omega.setOmega(z); omega.setVxy(vx,vy); omega.calOmega(); if(dx<300 &&dx>-300) { if(dy<300 && dy>-300) { - if(a>5) { - a=a-0.1; + if(z>5) { + z=z-0.1; } if(dx<50 && dx>-50) { if(dy<50 && dy>-50) { @@ -231,9 +231,12 @@ } } - } else { - if(a<10) { - a=a+0.01; + } + if(dx>300 || dx<-300) { + if(dy>300 || dy<-300) { + if(z<10) { + z=z+0.1; + } } } if(n>4) {