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:
- 11:88701a5e7eae
- Parent:
- 10:87ad65eef0e9
- Child:
- 12:ae291fa7239c
diff -r 87ad65eef0e9 -r 88701a5e7eae TVDCTRL.cpp --- a/TVDCTRL.cpp Sat Aug 06 05:39:00 2016 +0000 +++ b/TVDCTRL.cpp Sat Aug 06 05:56:18 2016 +0000 @@ -323,6 +323,8 @@ int outputVoltage=0; int rpm=0; int currentMaxTorque=0; + + int preOutputVol=0; if(torque <= LINEAR_REGION_TORQUE) { //要求トルク<=2.5Nmの時 outputVoltage = (int)((double)(LINEAR_REGION_VOLTAGE-DACOUTPUT_MIN)/LINEAR_REGION_TORQUE * torque); @@ -350,8 +352,10 @@ } outputVoltage += DACOUTPUT_MIN; //最低入力電圧でかさ上げ + + preOutputVol = (int)(outputVoltage*0.05 + preOutputVol*0.95); - return (unsigned int)(0xFFF*((double)outputVoltage/0xFFFF)); //DACの分解能に適応(16bit->12bit) + return (unsigned int)(0xFFF*((double)preOutputVol/0xFFFF)); //DACの分解能に適応(16bit->12bit) } int calcRequestTorque(void) @@ -383,7 +387,7 @@ int requestTorque=0; //ドライバー要求トルク int distributionTrq=0; //分配トルク int torqueHigh, torqueLow; //トルクの大きい方小さい方 - + loadSensors(); //APS,BRAKE更新 loadSteerAngle(); //舵角更新 //getPulseTime(RIGHT_MOTOR); //車速更新(更新時は片方指定コールでOK)