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.
Fork of TVDctrller2017_brdRev1_ver6 by
Diff: main.cpp
- Revision:
- 26:331e77bb479b
- Parent:
- 25:c21d35c7f0de
- Child:
- 27:37a8b4f6d28d
--- a/main.cpp Sat Jul 01 00:26:28 2017 +0000 +++ b/main.cpp Sat Jul 01 07:24:50 2017 +0000 @@ -52,14 +52,14 @@ SLCTSW[0].mode(PullNone); SLCTSW[1].mode(PullNone); SLCTSW[2].mode(PullNone); - + rightMotorPulse.mode(PullNone); leftMotorPulse.mode(PullNone); rightTirePulse1.mode(PullNone); rightTirePulse2.mode(PullNone); leftTirePulse1.mode(PullNone); leftTirePulse2.mode(PullNone); - + indicateSystem(1); bootSystem(); } @@ -67,11 +67,11 @@ int main(void) { int f_whatchdog=0; - + wait(1); pc.baud(115200); - printf("\033[2J"); + printf("\033[2J"); //teratermの画面クリア printf("\033[1;1H"); //teratermの画面クリア printf("\r\nVersion:TVDctrller2017_brdRev1...start!!!!!\r\n"); @@ -86,24 +86,26 @@ float time; struct errCounter_t eCounter= {0,0,0,0,0,0,0,0}; - + + wait(1); + while(1) { //f_whatchdog = ~f_whatchdog; //WDT.write(f_whatchdog); //getCurrentErrCount(&eCounter); - + timer.reset(); - driveTVD(); + driveTVD(0, isPressedRTD()); //printf("%f\n\r", 45.0/0xFFFF * calcRequestTorque()); - //printf("%2.2f\t%3.2f\t%1.2f\r\n", 45.0f / 0xffff * calcRequestTorque(), getVelocity(), getSteerAngle()); + printf("%2.2f\t%3.2f\t%1.2f\r\n", 45.0f / 0xffff * calcRequestTorque(), getVelocity(), getSteerAngle()); //printf("%1.6f\r\n", time); //printf("%d\r\n", eCounter.brakeOverRide); time = timer.read(); while(timer.read_ms() < CONTROL_CYCLE_MS); //制御周期管理 関数内処理時間より短い時間の制御周期の設定は禁止 - + //printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t\r\n", eCounter.apsUnderVolt, eCounter.apsExceedVolt, eCounter.apsErrorTolerance, eCounter.apsStick, eCounter.brakeUnderVolt, eCounter.brakeExceedVolt, eCounter.brakeFuzzyVolt, eCounter.brakeOverRide); //printf("apsP:%1.2f, apsS:%1.2f, brake:%1.2f\r", 3.3f/65535 * getRawSensor(APS_PRIMARY), 3.3f/65535 * getRawSensor(APS_SECONDARY), 3.3f/65535 * getRawSensor(BRAKE)); }