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:
- 13:6dc51981f391
- Parent:
- 12:ae291fa7239c
- Child:
- 14:7cc98e159c6e
--- a/TVDCTRL.cpp Sun Aug 07 15:23:01 2016 +0000 +++ b/TVDCTRL.cpp Tue Aug 09 06:10:35 2016 +0000 @@ -308,13 +308,13 @@ int distributeTorque(float steering) { int disTrq = 0; - const double deadband = (M_PI/180.0)*5.0; + const float deadband = (M_PI/180.0f)*5.0f; if(steering < deadband) disTrq = 0; else { steering -= deadband; - disTrq = (MAX_DISTRIBUTION_TORQUE / (M_PI - deadband)) * steering; + disTrq = (int)((MAX_DISTRIBUTION_TORQUE / (M_PI - deadband)) * steering); } return disTrq; @@ -359,7 +359,7 @@ outputVoltage += DACOUTPUT_MIN; //最低入力電圧でかさ上げ - preOutputVol = (int)(outputVoltage*0.003 + preOutputVol*0.997); + preOutputVol = (int)(outputVoltage*0.01 + preOutputVol*0.99); return (unsigned int)(0xFFF*((double)preOutputVol/0xFFFF)); //DACの分解能に適応(16bit->12bit) } @@ -428,7 +428,7 @@ distributionTrq /= 2.0; //デバッグ中 - distributionTrq = 0; + //distributionTrq = 0; if(requestTorque + distributionTrq > MAX_OUTPUT_TORQUE) //片モーター上限時最大値にクリップ torqueHigh = MAX_OUTPUT_TORQUE;