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:
- 6:26fa8c78500e
- Parent:
- 5:a5462959b3ab
- Child:
- 7:ad013d88a539
diff -r a5462959b3ab -r 26fa8c78500e TVDCTRL.h --- a/TVDCTRL.h Mon Jul 25 07:12:49 2016 +0000 +++ b/TVDCTRL.h Tue Jul 26 05:12:15 2016 +0000 @@ -2,31 +2,19 @@ #define TVDCTRL_H #include "mbed.h" -//受け入れるパルス時間,これより長い時間は停止とみなす -#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, - 1.674 -}; - //10rpm刻みでその回転数での最大出力トルクを返す(3000rpm~) //[0] :3000 //[+1] :+10rpm -const float calcMaxTorque[801] = { - 45.00000,44.96063,44.92125,44.88188,44.84250,44.80313,44.76375,44.72438,44.68500,44.64563,44.60625,44.56688,44.52750,44.48813,44.44875,44.40938,44.37000,44.33063,44.29125,44.25188,44.21250,44.17313,44.13375,44.09438,44.05500,44.01563,43.97625,43.93688,43.89750,43.85813,43.81875,43.77938,43.74000,43.70063,43.66125,43.62188,43.58250,43.54313,43.50375,43.46438,43.42500,43.38563,43.34625,43.30688,43.26750,43.22813,43.18875,43.14938,43.11000,43.07063,43.03125,42.99188,42.95250,42.91313,42.87375,42.83438,42.79500,42.75563,42.71625,42.67688,42.63750,42.59813,42.55875,42.51938,42.48000,42.44063,42.40125,42.36188,42.32250,42.28313,42.24375,42.20438,42.16500,42.12563,42.08625,42.04688,42.00750,41.96813,41.92875,41.88938,41.85000,41.81063,41.77125,41.73188,41.69250,41.65313,41.61375,41.57438,41.53500,41.49563,41.45625,41.41688,41.37750,41.33813,41.29875,41.25938,41.22000,41.18063,41.14125,41.10188 - ,41.06250,41.02313,40.98375,40.94438,40.90500,40.86563,40.82625,40.78688,40.74750,40.70813,40.66875,40.62938,40.59000,40.55063,40.51125,40.47188,40.43250,40.39313,40.35375,40.31438,40.27500,40.23563,40.19625,40.15688,40.11750,40.07813,40.03875,39.99938,39.96000,39.92063,39.88125,39.84188,39.80250,39.76313,39.72375,39.68438,39.64500,39.60563,39.56625,39.52688,39.48750,39.44813,39.40875,39.36938,39.33000,39.29063,39.25125,39.21188,39.17250,39.13313,39.09375,39.05438,39.01500,38.97563,38.93625,38.89688,38.85750,38.81813,38.77875,38.73938,38.70000,38.66063,38.62125,38.58188,38.54250,38.50313,38.46375,38.42438,38.38500,38.34563,38.30625,38.26688,38.22750,38.18813,38.14875,38.10938,38.07000,38.03063,37.99125,37.95188,37.91250,37.87313,37.83375,37.79438,37.75500,37.71563,37.67625,37.63688,37.59750,37.55813,37.51875,37.47938,37.44000,37.40063,37.36125,37.32188,37.28250,37.24313,37.20375,37.16438 - ,37.12500,37.08563,37.04625,37.00688,36.96750,36.92813,36.88875,36.84938,36.81000,36.77063,36.73125,36.69188,36.65250,36.61313,36.57375,36.53438,36.49500,36.45563,36.41625,36.37688,36.33750,36.29813,36.25875,36.21938,36.18000,36.14063,36.10125,36.06188,36.02250,35.98313,35.94375,35.90438,35.86500,35.82563,35.78625,35.74688,35.70750,35.66813,35.62875,35.58938,35.55000,35.51063,35.47125,35.43188,35.39250,35.35313,35.31375,35.27438,35.23500,35.19563,35.15625,35.11688,35.07750,35.03813,34.99875,34.95938,34.92000,34.88063,34.84125,34.80188,34.76250,34.72313,34.68375,34.64438,34.60500,34.56563,34.52625,34.48688,34.44750,34.40813,34.36875,34.32938,34.29000,34.25063,34.21125,34.17188,34.13250,34.09313,34.05375,34.01438,33.97500,33.93563,33.89625,33.85688,33.81750,33.77813,33.73875,33.69938,33.66000,33.62063,33.58125,33.54188,33.50250,33.46313,33.42375,33.38438,33.34500,33.30563,33.26625,33.22688 - ,33.18750,33.14813,33.10875,33.06938,33.03000,32.99063,32.95125,32.91188,32.87250,32.83313,32.79375,32.75438,32.71500,32.67563,32.63625,32.59688,32.55750,32.51813,32.47875,32.43938,32.40000,32.36063,32.32125,32.28188,32.24250,32.20313,32.16375,32.12438,32.08500,32.04563,32.00625,31.96688,31.92750,31.88813,31.84875,31.80938,31.77000,31.73063,31.69125,31.65188,31.61250,31.57313,31.53375,31.49438,31.45500,31.41563,31.37625,31.33688,31.29750,31.25813,31.21875,31.17938,31.14000,31.10063,31.06125,31.02188,30.98250,30.94313,30.90375,30.86438,30.82500,30.78563,30.74625,30.70688,30.66750,30.62813,30.58875,30.54938,30.51000,30.47063,30.43125,30.39188,30.35250,30.31313,30.27375,30.23438,30.19500,30.15563,30.11625,30.07688,30.03750,29.99813,29.95875,29.91938,29.88000,29.84063,29.80125,29.76188,29.72250,29.68313,29.64375,29.60438,29.56500,29.52563,29.48625,29.44688,29.40750,29.36813,29.32875,29.28938 - ,29.25000,29.21063,29.17125,29.13188,29.09250,29.05313,29.01375,28.97438,28.93500,28.89563,28.85625,28.81688,28.77750,28.73813,28.69875,28.65938,28.62000,28.58063,28.54125,28.50188,28.46250,28.42313,28.38375,28.34438,28.30500,28.26563,28.22625,28.18688,28.14750,28.10813,28.06875,28.02938,27.99000,27.95063,27.91125,27.87188,27.83250,27.79313,27.75375,27.71438,27.67500,27.63563,27.59625,27.55688,27.51750,27.47813,27.43875,27.39938,27.36000,27.32063,27.28125,27.24188,27.20250,27.16313,27.12375,27.08438,27.04500,27.00563,26.96625,26.92688,26.88750,26.84813,26.80875,26.76938,26.73000,26.69063,26.65125,26.61188,26.57250,26.53313,26.49375,26.45438,26.41500,26.37563,26.33625,26.29688,26.25750,26.21813,26.17875,26.13938,26.10000,26.06063,26.02125,25.98188,25.94250,25.90313,25.86375,25.82438,25.78500,25.74563,25.70625,25.66688,25.62750,25.58813,25.54875,25.50938,25.47000,25.43063,25.39125,25.35188 - ,25.31250,25.27313,25.23375,25.19438,25.15500,25.11563,25.07625,25.03688,24.99750,24.95813,24.91875,24.87938,24.84000,24.80063,24.76125,24.72188,24.68250,24.64313,24.60375,24.56438,24.52500,24.48563,24.44625,24.40688,24.36750,24.32813,24.28875,24.24938,24.21000,24.17063,24.13125,24.09188,24.05250,24.01313,23.97375,23.93438,23.89500,23.85563,23.81625,23.77688,23.73750,23.69813,23.65875,23.61938,23.58000,23.54063,23.50125,23.46188,23.42250,23.38313,23.34375,23.30438,23.26500,23.22563,23.18625,23.14688,23.10750,23.06813,23.02875,22.98938,22.95000,22.91063,22.87125,22.83188,22.79250,22.75313,22.71375,22.67438,22.63500,22.59563,22.55625,22.51688,22.47750,22.43813,22.39875,22.35938,22.32000,22.28063,22.24125,22.20188,22.16250,22.12313,22.08375,22.04438,22.00500,21.96563,21.92625,21.88688,21.84750,21.80813,21.76875,21.72938,21.69000,21.65063,21.61125,21.57188,21.53250,21.49313,21.45375,21.41438 - ,21.37500,21.33563,21.29625,21.25688,21.21750,21.17813,21.13875,21.09938,21.06000,21.02063,20.98125,20.94188,20.90250,20.86313,20.82375,20.78438,20.74500,20.70563,20.66625,20.62688,20.58750,20.54813,20.50875,20.46938,20.43000,20.39063,20.35125,20.31188,20.27250,20.23313,20.19375,20.15438,20.11500,20.07563,20.03625,19.99688,19.95750,19.91813,19.87875,19.83938,19.80000,19.76063,19.72125,19.68188,19.64250,19.60313,19.56375,19.52438,19.48500,19.44563,19.40625,19.36688,19.32750,19.28813,19.24875,19.20938,19.17000,19.13063,19.09125,19.05188,19.01250,18.97313,18.93375,18.89438,18.85500,18.81563,18.77625,18.73688,18.69750,18.65813,18.61875,18.57938,18.54000,18.50063,18.46125,18.42188,18.38250,18.34313,18.30375,18.26438,18.22500,18.18563,18.14625,18.10688,18.06750,18.02813,17.98875,17.94938,17.91000,17.87063,17.83125,17.79188,17.75250,17.71313,17.67375,17.63438,17.59500,17.55563,17.51625,17.47688 - ,17.43750,17.39813,17.35875,17.31938,17.28000,17.24063,17.20125,17.16188,17.12250,17.08313,17.04375,17.00438,16.96500,16.92563,16.88625,16.84688,16.80750,16.76813,16.72875,16.68938,16.65000,16.61063,16.57125,16.53188,16.49250,16.45313,16.41375,16.37438,16.33500,16.29563,16.25625,16.21688,16.17750,16.13813,16.09875,16.05938,16.02000,15.98063,15.94125,15.90188,15.86250,15.82313,15.78375,15.74438,15.70500,15.66563,15.62625,15.58688,15.54750,15.50813,15.46875,15.42938,15.39000,15.35063,15.31125,15.27188,15.23250,15.19313,15.15375,15.11438,15.07500,15.03563,14.99625,14.95688,14.91750,14.87813,14.83875,14.79938,14.76000,14.72063,14.68125,14.64188,14.60250,14.56313,14.52375,14.48438,14.44500,14.40563,14.36625,14.32688,14.28750,14.24813,14.20875,14.16938,14.13000,14.09063,14.05125,14.01188,13.97250,13.93313,13.89375,13.85438,13.81500,13.77563,13.73625,13.69688,13.65750,13.61813,13.57875,13.53938 - ,13.50000 +const int calcMaxTorque[801] = { + 65535,65478,65420,65363,65306,65248,65191,65134,65076,65019,64962,64904,64847,64790,64732,64675,64618,64560,64503,64445,64388,64331,64273,64216,64159,64101,64044,63987,63929,63872,63815,63757,63700,63643,63585,63528,63471,63413,63356,63299,63241,63184,63127,63069,63012,62955,62897,62840,62783,62725,62668,62611,62553,62496,62438,62381,62324,62266,62209,62152,62094,62037,61980,61922,61865,61808,61750,61693,61636,61578,61521,61464,61406,61349,61292,61234,61177,61120,61062,61005,60948,60890,60833,60776,60718,60661,60603,60546,60489,60431,60374,60317,60259,60202,60145,60087,60030,59973,59915,59858 + ,59801,59743,59686,59629,59571,59514,59457,59399,59342,59285,59227,59170,59113,59055,58998,58941,58883,58826,58769,58711,58654,58596,58539,58482,58424,58367,58310,58252,58195,58138,58080,58023,57966,57908,57851,57794,57736,57679,57622,57564,57507,57450,57392,57335,57278,57220,57163,57106,57048,56991,56934,56876,56819,56762,56704,56647,56589,56532,56475,56417,56360,56303,56245,56188,56131,56073,56016,55959,55901,55844,55787,55729,55672,55615,55557,55500,55443,55385,55328,55271,55213,55156,55099,55041,54984,54927,54869,54812,54754,54697,54640,54582,54525,54468,54410,54353,54296,54238,54181,54124 + ,54066,54009,53952,53894,53837,53780,53722,53665,53608,53550,53493,53436,53378,53321,53264,53206,53149,53092,53034,52977,52920,52862,52805,52747,52690,52633,52575,52518,52461,52403,52346,52289,52231,52174,52117,52059,52002,51945,51887,51830,51773,51715,51658,51601,51543,51486,51429,51371,51314,51257,51199,51142,51085,51027,50970,50913,50855,50798,50740,50683,50626,50568,50511,50454,50396,50339,50282,50224,50167,50110,50052,49995,49938,49880,49823,49766,49708,49651,49594,49536,49479,49422,49364,49307,49250,49192,49135,49078,49020,48963,48905,48848,48791,48733,48676,48619,48561,48504,48447,48389 + ,48332,48275,48217,48160,48103,48045,47988,47931,47873,47816,47759,47701,47644,47587,47529,47472,47415,47357,47300,47243,47185,47128,47071,47013,46956,46898,46841,46784,46726,46669,46612,46554,46497,46440,46382,46325,46268,46210,46153,46096,46038,45981,45924,45866,45809,45752,45694,45637,45580,45522,45465,45408,45350,45293,45236,45178,45121,45064,45006,44949,44891,44834,44777,44719,44662,44605,44547,44490,44433,44375,44318,44261,44203,44146,44089,44031,43974,43917,43859,43802,43745,43687,43630,43573,43515,43458,43401,43343,43286,43229,43171,43114,43056,42999,42942,42884,42827,42770,42712,42655 + ,42598,42540,42483,42426,42368,42311,42254,42196,42139,42082,42024,41967,41910,41852,41795,41738,41680,41623,41566,41508,41451,41394,41336,41279,41222,41164,41107,41049,40992,40935,40877,40820,40763,40705,40648,40591,40533,40476,40419,40361,40304,40247,40189,40132,40075,40017,39960,39903,39845,39788,39731,39673,39616,39559,39501,39444,39387,39329,39272,39215,39157,39100,39042,38985,38928,38870,38813,38756,38698,38641,38584,38526,38469,38412,38354,38297,38240,38182,38125,38068,38010,37953,37896,37838,37781,37724,37666,37609,37552,37494,37437,37380,37322,37265,37207,37150,37093,37035,36978,36921 + ,36863,36806,36749,36691,36634,36577,36519,36462,36405,36347,36290,36233,36175,36118,36061,36003,35946,35889,35831,35774,35717,35659,35602,35545,35487,35430,35373,35315,35258,35200,35143,35086,35028,34971,34914,34856,34799,34742,34684,34627,34570,34512,34455,34398,34340,34283,34226,34168,34111,34054,33996,33939,33882,33824,33767,33710,33652,33595,33538,33480,33423,33366,33308,33251,33193,33136,33079,33021,32964,32907,32849,32792,32735,32677,32620,32563,32505,32448,32391,32333,32276,32219,32161,32104,32047,31989,31932,31875,31817,31760,31703,31645,31588,31531,31473,31416,31358,31301,31244,31186 + ,31129,31072,31014,30957,30900,30842,30785,30728,30670,30613,30556,30498,30441,30384,30326,30269,30212,30154,30097,30040,29982,29925,29868,29810,29753,29696,29638,29581,29524,29466,29409,29351,29294,29237,29179,29122,29065,29007,28950,28893,28835,28778,28721,28663,28606,28549,28491,28434,28377,28319,28262,28205,28147,28090,28033,27975,27918,27861,27803,27746,27689,27631,27574,27517,27459,27402,27344,27287,27230,27172,27115,27058,27000,26943,26886,26828,26771,26714,26656,26599,26542,26484,26427,26370,26312,26255,26198,26140,26083,26026,25968,25911,25854,25796,25739,25682,25624,25567,25509,25452 + ,25395,25337,25280,25223,25165,25108,25051,24993,24936,24879,24821,24764,24707,24649,24592,24535,24477,24420,24363,24305,24248,24191,24133,24076,24019,23961,23904,23847,23789,23732,23675,23617,23560,23502,23445,23388,23330,23273,23216,23158,23101,23044,22986,22929,22872,22814,22757,22700,22642,22585,22528,22470,22413,22356,22298,22241,22184,22126,22069,22012,21954,21897,21840,21782,21725,21668,21610,21553,21495,21438,21381,21323,21266,21209,21151,21094,21037,20979,20922,20865,20807,20750,20693,20635,20578,20521,20463,20406,20349,20291,20234,20177,20119,20062,20005,19947,19890,19833,19775,19718 + ,19661 }; struct errCounter_t {