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: TVDCTRL.cpp
- Revision:
- 35:b75595b1da36
- Parent:
- 34:594ddb4008b2
- Child:
- 36:dc33a3a194c9
diff -r 594ddb4008b2 -r b75595b1da36 TVDCTRL.cpp --- a/TVDCTRL.cpp Fri Aug 04 02:58:51 2017 +0000 +++ b/TVDCTRL.cpp Thu Aug 17 06:01:28 2017 +0000 @@ -488,14 +488,14 @@ float limitRate; float currentVelocity = getVelocity() * 3.6f; //km/hで車速取得 - if(currentVelocity < 1.0f) + if(currentVelocity < 5.0f) limitRate = 0.0f; - else if(currentVelocity < 5.0f) - limitRate = (currentVelocity - 1.0f) / (5.0f - 1.0f); + else if(currentVelocity < 15.0f) + limitRate = (currentVelocity - 5.0f) / (15.0f - 5.0f); else limitRate = 1.0f; - printf("rate:%1.3f\r\n", limitRate); + //printf("rate:%1.3f\r\n", limitRate); return limitRate; } @@ -541,6 +541,7 @@ //printf("%d\r\n", distributionTrq); //distributionTrq = 0; + disTrq_omega = 0; torqueRight = requestTorque + distributionTrq; torqueLeft = requestTorque - distributionTrq; @@ -564,8 +565,11 @@ McpData.valA = calcTorqueToVoltage(torqueRight, getRPS(RIGHT)); McpData.valB = calcTorqueToVoltage(torqueLeft, getRPS(LEFT)); - preMcpA = (unsigned int)(McpData.valA * 0.456 + preMcpA * 0.544); - preMcpB = (unsigned int)(McpData.valB * 0.456 + preMcpB * 0.544); +// preMcpA = (unsigned int)(McpData.valA * 0.456 + preMcpA * 0.544); +// preMcpB = (unsigned int)(McpData.valB * 0.456 + preMcpB * 0.544); + + preMcpA = McpData.valA; + preMcpB = McpData.valB; mcp.writeA(preMcpA); //右モーター mcp.writeB(preMcpB); //左モーター