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.h
- Revision:
- 1:4d86ec2fe4b1
- Parent:
- 0:276c1dab2d62
- Child:
- 2:9d69f27a3d3b
--- a/TVDCTRL.h Fri Jul 08 05:29:15 2016 +0000 +++ b/TVDCTRL.h Sat Jul 09 12:04:47 2016 +0000 @@ -2,15 +2,19 @@ #define TVDCTRL_H #include "mbed.h" -const float convPToV_533[]={ +//受け入れるパルス時間,これより長い時間は停止とみなす +#define MAX_PULSETIME 100 +//モーターパルスを車速[m/s]に変換する.indexが時間[ms]に対応.0[ms]は無効(0)とする +const float convPToV_533[MAX_PULSETIME+1]={ 0.000,167.447,83.723,55.816,41.862,33.489,27.908,23.921,20.931,18.605,16.745,15.222,13.954,12.881,11.960,11.163,10.465,9.850,9.303,8.813, 8.372,7.974,7.611,7.280,6.977,6.698,6.440,6.202,5.980,5.774,5.582,5.402,5.233,5.074,4.925,4.784,4.651,4.526,4.406,4.294, 4.186,4.084,3.987,3.894,3.806,3.721,3.640,3.563,3.488,3.417,3.349,3.283,3.220,3.159,3.101,3.044,2.990,2.938,2.887,2.838, 2.791,2.745,2.701,2.658,2.616,2.576,2.537,2.499,2.462,2.427,2.392,2.358,2.326,2.294,2.263,2.233,2.203,2.175,2.147,2.120, -2.093,2.067,2.042,2.017,1.993,1.970,1.947,1.925,1.903,1.881,1.861,1.840,1.820,1.801,1.781,1.763,1.744,1.726,1.709,1.691 +2.093,2.067,2.042,2.017,1.993,1.970,1.947,1.925,1.903,1.881,1.861,1.840,1.820,1.801,1.781,1.763,1.744,1.726,1.709,1.691, +1.674 }; -//トルク信号(電圧)をトルクに変換 +//トルク信号[V]をトルク[Nm]に変換 //[0] -> 0.49V //[+1] -> +0.01V const float convVToT_500[]={ @@ -50,10 +54,15 @@ 0.000,0.025,0.050,0.075,0.100,0.125,0.150,0.175,0.200,0.225,0.250,0.275,0.300,0.325,0.350,0.375,0.400,0.425,0.450,0.475,0.500,0.525,0.550,0.575,0.600,0.625,0.650,0.675,0.700,0.725,0.750,0.775,0.800,0.825,0.850,0.875,0.900,0.925,0.950,0.975,1.000,1.025,1.050,1.075,1.100,1.125,1.150,1.175,1.200,1.225,1.250,1.275,1.300,1.362,1.423,1.485,1.546,1.608,1.669,1.731,1.792,1.854,1.915,1.977,2.038,2.100,2.162,2.223,2.285,2.346,2.408,2.469,2.531,2.592,2.654,2.715,2.777,2.838,2.900,2.965,3.031,3.096,3.162,3.227,3.292,3.358,3.423,3.488,3.554,3.619,3.685,3.750,3.815,3.881,3.946,4.012,4.077,4.142,4.208,4.273,4.338,4.404,4.469,4.535,4.600,4.677,4.754,4.831,4.908,4.985,5.062,5.138,5.215,5.292,5.369,5.446,5.523,5.600,5.677,5.754,5.831,5.908,5.985,6.062,6.138,6.215,6.292,6.369,6.446,6.523,6.600,6.692,6.785,6.877,6.969,7.062,7.154,7.246,7.338,7.431,7.523,7.615,7.708,7.800,7.892,7.985,8.077,8.169,8.262,8.354,8.446,8.538,8.631,8.723,8.815,8.908,9.000,9.096,9.192,9.288,9.385,9.481,9.577,9.673,9.769,9.865,9.962,10.058,10.154,10.250,10.346,10.442,10.538,10.635,10.731,10.827,10.923,11.019,11.115,11.212,11.308,11.404,11.500,11.611,11.722,11.833,11.944,12.056,12.167,12.278,12.389,12.500,12.611,12.722,12.833,12.944,13.056,13.167,13.278,13.389,13.500 }; -#define DACOUTPUT_MIN 0.4f -#define DACOUTPUT_MAX 2.45f -#define DACOUTPUT_VALID_RANGE (DACOUTPUT_MAX - DACOUTPUT_MIN) -#define LIMIT 0.4f -#define MCP_REFERENCE 3.3f +#define ratioLPF 0.11795f //CutOff:20Hz + +const unsigned int MAX_MOTOR_TORQUE = 45; + +void loadSensorsLPF(void); +int checkSensorPlausibility(void); + +void initTVD(void); + +int getVelocity(void); #endif \ No newline at end of file