![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
2011
Diff: main.cpp
- Revision:
- 212:ec41f1449ef9
- Parent:
- 211:6fe9886cdb6e
- Child:
- 213:3e7bee70a0b4
- Child:
- 214:231d27008443
diff -r 6fe9886cdb6e -r ec41f1449ef9 main.cpp --- a/main.cpp Wed Dec 23 06:27:15 2020 +0000 +++ b/main.cpp Wed Dec 23 11:22:31 2020 +0000 @@ -1,4 +1,4 @@ -//201223_3 +//201223_4 #include "mbed.h" #include "FastPWM.h" #include "INIT_HW.h" @@ -199,72 +199,72 @@ float input_NN[num_input] = { 0.0f }; const float h1[num_input][16] = { - {-1.546078085899353f,0.361652135848999f,0.12903714179992676f,-1.0499156713485718f,-1.5020780563354492f,0.799557089805603f,-0.17472904920578003f,1.6538918018341064f,-0.33628979325294495f,-1.0321094989776611f,-0.23684848845005035f,-0.9042033553123474f,-0.25509142875671387f,-1.1200040578842163f,-0.2571594715118408f,-0.6349852085113525f}, -{-0.8596522808074951f,-0.3120137155056f,-0.3927857577800751f,-1.1837406158447266f,-0.7431631088256836f,0.11158730834722519f,-0.4054011106491089f,0.4331357181072235f,-0.13612186908721924f,0.5075802206993103f,-0.27370503544807434f,-0.5497169494628906f,0.24488189816474915f,-1.353187918663025f,-0.20967772603034973f,-0.2520674169063568f}, -{-1.027856707572937f,0.2214081585407257f,0.36391180753707886f,-1.4669344425201416f,-0.6888070702552795f,0.08477509766817093f,0.2872133255004883f,0.6314951181411743f,-0.23233523964881897f,0.12511108815670013f,-0.34768086671829224f,-0.4033336937427521f,0.006954585202038288f,-1.001330852508545f,0.05590221285820007f,-0.35799112915992737f}, -{-0.8887169361114502f,0.9978446364402771f,0.39742106199264526f,-0.22255514562129974f,-0.8239138722419739f,-0.41667890548706055f,-0.11584559082984924f,0.975131630897522f,-0.06620155274868011f,-0.9019508957862854f,0.09614303708076477f,0.20408129692077637f,-0.1548970490694046f,-0.6461730003356934f,-0.2961459457874298f,0.17067596316337585f}, -{0.6723200082778931f,1.1419994831085205f,-0.0051451027393341064f,1.0692040920257568f,0.10727441310882568f,-0.5531254410743713f,0.1294034719467163f,-0.25556430220603943f,-0.07107188552618027f,-1.0929906368255615f,0.3479995131492615f,0.2231312096118927f,-0.058105532079935074f,0.8237587809562683f,-0.3865056037902832f,0.11934724450111389f}, -{3.7127530574798584f,-2.5174219608306885f,0.21773302555084229f,3.0477185249328613f,3.436016082763672f,-1.961868166923523f,0.16514194011688232f,-3.4211652278900146f,-0.0615205354988575f,2.477680206298828f,-0.2475488781929016f,0.8490079045295715f,-0.2543642520904541f,3.181417226791382f,-0.4132833778858185f,0.3736213147640228f}, -{-0.26929038763046265f,3.1808366775512695f,-0.2501986622810364f,-4.459082126617432f,-1.539385199546814f,0.6246992349624634f,0.06014183163642883f,-1.5718029737472534f,0.06852987408638f,-1.5334218740463257f,0.15086963772773743f,-0.08829033374786377f,-0.17151489853858948f,3.3346705436706543f,-0.15618428587913513f,-0.29000696539878845f}, -{-1.1418464183807373f,1.525067687034607f,-0.26619744300842285f,0.19319379329681396f,-1.3049606084823608f,0.38398781418800354f,-0.17925891280174255f,0.7847610116004944f,-0.10247176140546799f,-0.9229041934013367f,0.10430599004030228f,-0.8101029396057129f,0.3782026171684265f,-0.81373530626297f,0.04303058981895447f,-0.20076002180576324f}, -{0.4776228070259094f,-1.9194914102554321f,0.10248100757598877f,-0.7253445386886597f,0.7790623307228088f,-0.7391023635864258f,-0.07246989011764526f,-1.3036123514175415f,-0.4540105164051056f,3.632073402404785f,-0.2983750104904175f,-0.27986952662467957f,0.23655663430690765f,-0.36471793055534363f,-0.30555272102355957f,-0.650860607624054f}, -{-0.27427127957344055f,-2.133636713027954f,0.18462657928466797f,-0.8196331858634949f,0.28979337215423584f,-0.3763601779937744f,-0.2990540862083435f,-0.35786694288253784f,-0.1715877801179886f,1.369327187538147f,-0.009420383721590042f,-1.114159345626831f,0.3801093101501465f,-0.5582246780395508f,0.3484981060028076f,-0.8675364851951599f}, -{0.17901860177516937f,-1.224602460861206f,0.37182438373565674f,-0.17586977779865265f,-0.19623121619224548f,-0.3711324632167816f,-0.20339298248291016f,0.016905533149838448f,-0.5214647054672241f,0.6325316429138184f,0.34721440076828003f,-0.8592796921730042f,-0.05839260667562485f,-0.005120187532156706f,0.26688337326049805f,-0.9529700875282288f}, -{-0.06906984001398087f,-1.2341407537460327f,-0.40320003032684326f,0.02483939193189144f,0.1510181427001953f,-0.5047181844711304f,0.1533789038658142f,0.14664340019226074f,-0.16939152777194977f,0.3664097189903259f,-0.4153592884540558f,-0.17172104120254517f,0.15277211368083954f,0.43496182560920715f,0.10493969917297363f,-0.41127416491508484f}, -{0.023423831909894943f,-0.88052898645401f,0.19847965240478516f,0.30479538440704346f,0.2847832441329956f,-0.2262878566980362f,-0.2404318004846573f,0.18100465834140778f,-0.1452060043811798f,0.01916847750544548f,-0.10988222062587738f,-0.33172914385795593f,0.09968993812799454f,0.26685139536857605f,-0.22268100082874298f,-0.4445679485797882f}, -{-0.09026174992322922f,-0.6224011182785034f,0.4127817749977112f,0.4731111526489258f,-0.190794438123703f,-0.5028371214866638f,-0.32001304626464844f,-0.24426521360874176f,-0.08077334612607956f,-0.007110084872692823f,-0.19549734890460968f,-0.11970767378807068f,-0.3054847717285156f,0.2603020668029785f,0.0479682981967926f,0.15816257894039154f}, -{0.022531412541866302f,-0.17848119139671326f,0.20282304286956787f,0.4242058992385864f,0.2516932785511017f,-0.20840142667293549f,0.04202890396118164f,0.35329484939575195f,0.3554973304271698f,0.1979427933692932f,-0.27989843487739563f,-0.3284192681312561f,0.11093859374523163f,0.19121049344539642f,0.0668090283870697f,0.2350914478302002f}, -{0.0005804843385703862f,-0.3353522717952728f,-0.40439701080322266f,0.6412276029586792f,-0.07361637055873871f,0.00661800242960453f,-0.15568238496780396f,-0.03549305722117424f,0.26091328263282776f,0.1284361630678177f,-0.47459378838539124f,-0.04844345897436142f,-0.2634789049625397f,0.25194695591926575f,-0.08245879411697388f,0.22769993543624878f}, -{-0.12284072488546371f,-0.24371252954006195f,0.16706281900405884f,1.3465361595153809f,0.027943080291152f,-0.13184677064418793f,-0.041414469480514526f,0.14739923179149628f,0.009675423614680767f,0.09683336317539215f,-0.354688823223114f,0.17883950471878052f,0.12002348899841309f,0.7905712723731995f,0.29427415132522583f,0.016808994114398956f}, + {-1.6070621013641357f,1.4444793462753296f,0.12903714179992676f,0.45971256494522095f,-1.8895007371902466f,1.5912665128707886f,-0.17472904920578003f,1.3318427801132202f,-2.261326551437378f,-0.03385619446635246f,-0.23437689244747162f,-1.2534494400024414f,-0.26408806443214417f,-1.1718051433563232f,-0.2571594715118408f,-1.0255193710327148f}, +{-1.0846422910690308f,0.8761099576950073f,-0.3927857577800751f,0.10885071754455566f,-1.2603814601898193f,0.7932608127593994f,-0.4054011106491089f,0.5438631772994995f,-1.546224594116211f,0.22130662202835083f,-0.27116647362709045f,-0.7526845335960388f,0.23553097248077393f,-1.0961291790008545f,-0.20967772603034973f,-0.659416675567627f}, +{-0.8406979441642761f,0.5655145645141602f,0.36391180753707886f,-0.2829425036907196f,-0.6366292238235474f,0.6242642402648926f,0.2872133255004883f,0.39269590377807617f,-1.4623386859893799f,0.22947895526885986f,-0.34503698348999023f,-0.4441416561603546f,-0.00272137182764709f,-0.3268943130970001f,0.05590221285820007f,-1.1436342000961304f}, +{-0.35294806957244873f,-0.09107200056314468f,0.39742106199264526f,0.33738622069358826f,-0.11074129492044449f,-0.19795556366443634f,-0.11584559082984924f,0.2239270806312561f,-1.016740083694458f,0.367963969707489f,0.09880797564983368f,0.34261059761047363f,-0.16485224664211273f,-0.02963976189494133f,-0.2961459457874298f,-0.9800482988357544f}, +{1.1172692775726318f,-0.881708025932312f,-0.0051451027393341064f,0.24785789847373962f,0.949159562587738f,-0.8879446387290955f,0.1294034719467163f,-1.1183830499649048f,-0.18216757476329803f,0.18784251809120178f,0.35077041387557983f,0.5736857056617737f,-0.06842327117919922f,1.0481723546981812f,-0.3865056037902832f,-0.9325311183929443f}, +{3.2859668731689453f,-3.373445987701416f,0.21773302555084229f,0.23583510518074036f,3.153277635574341f,-3.0842037200927734f,0.16514194011688232f,-3.330359697341919f,1.6308770179748535f,0.20284788310527802f,-0.24478337168693542f,1.4629696607589722f,-0.26506540179252625f,3.084402084350586f,-0.4132833778858185f,0.3235807716846466f}, +{-0.16239909827709198f,0.652294397354126f,-0.2501986622810364f,-0.7905404567718506f,-0.6188644766807556f,0.8528907299041748f,0.06014183163642883f,-0.4905660152435303f,1.5433074235916138f,-0.1533675193786621f,0.15192021429538727f,-0.10490059852600098f,-0.1730978935956955f,0.015356072224676609f,-0.15618428587913513f,0.5344299077987671f}, +{-0.8749822974205017f,0.6992738246917725f,-0.26619744300842285f,-0.08359992504119873f,-1.2196704149246216f,0.7197252511978149f,-0.17925891280174255f,0.24655599892139435f,0.32290568947792053f,0.030707592144608498f,0.10629666596651077f,-0.48497965931892395f,0.37155985832214355f,-0.5724732875823975f,0.04303058981895447f,0.5185656547546387f}, +{0.44704651832580566f,0.0694582387804985f,0.10248100757598877f,-0.6408140659332275f,0.08685804158449173f,-0.24289385974407196f,-0.07246989011764526f,-0.8823809623718262f,0.975390613079071f,0.2915976345539093f,-0.2963060140609741f,0.3272884786128998f,0.22921693325042725f,0.7061342597007751f,-0.30555272102355957f,1.1997355222702026f}, +{0.10269708186388016f,-0.4119151830673218f,0.18462657928466797f,-0.4237739145755768f,0.28614145517349243f,-0.0384453721344471f,-0.2990540862083435f,-0.3690754175186157f,1.0338808298110962f,-0.506875216960907f,-0.007301787845790386f,-0.4488030672073364f,0.372331827878952f,0.18725666403770447f,0.3484981060028076f,0.7741178274154663f}, +{0.4530973434448242f,0.06094556301832199f,0.37182438373565674f,-0.03273813799023628f,0.0016666745068505406f,-0.13683553040027618f,-0.20339298248291016f,0.0006952928379178047f,0.36829644441604614f,0.007492598611861467f,0.3493041396141052f,-0.34462884068489075f,-0.06654797494411469f,0.2495005875825882f,0.26688337326049805f,0.2787923216819763f}, +{-0.41628196835517883f,-0.34683796763420105f,-0.40320003032684326f,-0.26510435342788696f,0.01427370309829712f,-0.12881697714328766f,0.1533789038658142f,0.6213264465332031f,0.43982186913490295f,0.1924997866153717f,-0.41328826546669006f,-0.0027057332918047905f,0.14470605552196503f,0.13542859256267548f,0.10493969917297363f,0.358428418636322f}, +{-0.09863808006048203f,-0.15524423122406006f,0.19847965240478516f,-0.08667934685945511f,0.2108737826347351f,0.0608486607670784f,-0.2404318004846573f,0.5305993556976318f,0.29834941029548645f,-0.20526979863643646f,-0.10813693702220917f,-0.45609328150749207f,0.09201034903526306f,0.16512572765350342f,-0.22268100082874298f,-0.07933637499809265f}, +{-0.1803528368473053f,-0.07565825432538986f,0.4127817749977112f,-0.29987478256225586f,-0.3406386971473694f,-0.3658057749271393f,-0.32001304626464844f,0.18756037950515747f,0.23431532084941864f,-0.23265855014324188f,-0.19404397904872894f,-0.44801175594329834f,-0.31276315450668335f,0.09663949906826019f,0.0479682981967926f,0.23482243716716766f}, +{0.09787440299987793f,0.05535588413476944f,0.20282304286956787f,-0.1285126656293869f,0.21852988004684448f,-0.23995305597782135f,0.04202890396118164f,0.899287223815918f,0.4933943748474121f,0.07827243953943253f,-0.2784428298473358f,-0.7169914841651917f,0.10353262722492218f,0.041469767689704895f,0.0668090283870697f,0.10634815692901611f}, +{-0.17166218161582947f,-0.24739637970924377f,-0.40439701080322266f,-0.278349369764328f,-0.34712228178977966f,-0.047724951058626175f,-0.15568238496780396f,0.7170681357383728f,0.2422538846731186f,-0.006808132864534855f,-0.47287464141845703f,-0.4041852056980133f,-0.2711547017097473f,0.0345175676047802f,-0.08245879411697388f,-0.017156904563307762f}, +{0.10945872962474823f,-0.3796606957912445f,0.16706281900405884f,-0.1058274433016777f,0.09715140610933304f,-0.6114601492881775f,-0.041414469480514526f,0.459582656621933f,0.15684588253498077f,0.09002777934074402f,-0.35252657532691956f,0.13107328116893768f,0.11200001835823059f,0.6847966313362122f,0.29427415132522583f,-0.10886158049106598f}, }; const float h2[16][16] = { - {-4.527799129486084f,0.6820409893989563f,-0.06966331601142883f,0.5540435910224915f,-0.21907491981983185f,3.1338891983032227f,-0.06048932299017906f,0.0904630720615387f,-0.43008196353912354f,-0.1415480375289917f,-4.606686592102051f,-0.37958794832229614f,-0.016400590538978577f,-4.008707046508789f,3.2936906814575195f,-0.4451225697994232f}, -{-0.025993891060352325f,-0.8604259490966797f,0.057057321071624756f,-0.5842818021774292f,-0.35503754019737244f,-0.5380035042762756f,-0.6036195158958435f,-0.2990124225616455f,-0.33757925033569336f,0.2895788848400116f,-0.5821780562400818f,-0.7649829387664795f,0.0743352621793747f,-0.12555116415023804f,0.844036877155304f,-0.6543750166893005f}, + {-0.2100285440683365f,0.5450449585914612f,-0.06966331601142883f,-0.16327691078186035f,-0.21907491981983185f,-0.7174352407455444f,-0.08997400104999542f,0.03496444225311279f,-0.43008196353912354f,-0.1415480375289917f,-1.024130940437317f,-0.43296945095062256f,0.12968102097511292f,-1.543792724609375f,-0.4490607678890228f,-4.010191440582275f}, +{0.09335885941982269f,-2.328054904937744f,0.057057321071624756f,-0.4136889576911926f,-0.35503754019737244f,-1.8548954725265503f,-0.5476264953613281f,-0.3163917064666748f,-0.33757925033569336f,0.2895788848400116f,-3.989751100540161f,-0.2958875000476837f,0.33698758482933044f,2.3762283325195312f,-0.10209953784942627f,-1.2367063760757446f}, {-0.22745239734649658f,0.003037691116333008f,-0.061119019985198975f,0.35696902871131897f,0.05568113923072815f,0.011741191148757935f,-0.20225946605205536f,-0.08465918898582458f,0.3489862382411957f,0.0687277615070343f,0.31964078545570374f,0.3004753887653351f,0.36063823103904724f,-0.42892736196517944f,0.08652284741401672f,0.027493387460708618f}, -{-0.3417482376098633f,0.3533795177936554f,-0.2894435524940491f,0.04954472929239273f,0.08946844935417175f,-0.08458209037780762f,-0.48501384258270264f,0.4122363030910492f,0.26211628317832947f,0.2953031361103058f,-0.19418053328990936f,0.020002810284495354f,-0.5509099364280701f,0.2837100028991699f,0.16813787817955017f,-0.1687486618757248f}, -{-1.1204174757003784f,1.8965997695922852f,-0.25313520431518555f,0.6254236698150635f,0.036378175020217896f,0.8173602819442749f,-0.6155303120613098f,-0.08570799231529236f,-0.024399548768997192f,-0.39465832710266113f,-1.9287620782852173f,-0.91059809923172f,-0.0442003458738327f,-1.2676142454147339f,0.927952229976654f,-0.6073963046073914f}, -{-0.16543826460838318f,0.021899903193116188f,-0.3519742488861084f,0.09473834186792374f,-0.3015052080154419f,-0.3208472728729248f,-0.7214264273643494f,-0.019414573907852173f,-0.23047015070915222f,0.3579089343547821f,0.20117740333080292f,-0.3499281406402588f,-0.3562796711921692f,-0.33363988995552063f,0.005666304845362902f,-0.934236466884613f}, +{0.05469902977347374f,-0.25110578536987305f,-0.2894435524940491f,0.5345750451087952f,0.08946844935417175f,0.4574865400791168f,-0.23805393278598785f,0.4122363030910492f,0.26211628317832947f,0.2953031361103058f,0.3205234110355377f,0.3810727894306183f,-0.404754102230072f,-0.2590928077697754f,0.2257760912179947f,0.16342028975486755f}, +{-0.25391754508018494f,0.49998918175697327f,-0.25313520431518555f,0.0678805261850357f,0.036378175020217896f,-0.5025586485862732f,-0.58262699842453f,-0.12088710814714432f,-0.024399548768997192f,-0.39465832710266113f,-1.5418189764022827f,-0.7374540567398071f,0.10077962279319763f,-0.42483294010162354f,-0.49100643396377563f,-0.64886075258255f}, +{0.34239134192466736f,-1.3530895709991455f,-0.3519742488861084f,0.014243300072848797f,-0.3015052080154419f,-1.4964323043823242f,-0.6469179391860962f,-0.04728340730071068f,-0.23047015070915222f,0.3579089343547821f,-2.080329179763794f,-0.22948884963989258f,-0.20959392189979553f,1.1190712451934814f,0.13593792915344238f,-2.15841007232666f}, {-0.1828227937221527f,-0.02554568648338318f,-0.3260969817638397f,0.08422836661338806f,-0.38453540205955505f,-0.25432005524635315f,0.285016268491745f,0.12387624382972717f,-0.0982072651386261f,0.13111665844917297f,-0.03692615032196045f,-0.32796353101730347f,-0.21546880900859833f,0.049302369356155396f,-0.27088475227355957f,-0.4124959409236908f}, -{1.434049367904663f,2.2621963024139404f,0.33083590865135193f,-0.9461531043052673f,-0.14358049631118774f,-1.4297912120819092f,-0.4557732939720154f,-0.3003333508968353f,0.2600560486316681f,-0.37898191809654236f,0.277005672454834f,-0.6271990537643433f,-0.3571954667568207f,2.0465574264526367f,1.4298032522201538f,-0.5386678576469421f}, -{-0.003402497386559844f,0.20103180408477783f,-0.11379697918891907f,0.13531987369060516f,0.041274964809417725f,-0.4882394075393677f,-0.10284432768821716f,0.0019084513187408447f,0.06103590130805969f,-0.38046833872795105f,-0.24828092753887177f,-0.41271302103996277f,-0.5109040141105652f,-0.3721432685852051f,-0.2930859923362732f,-0.37981683015823364f}, -{-0.11852412670850754f,1.400585412979126f,-0.13502129912376404f,-0.029812220484018326f,0.12987366318702698f,0.7441322207450867f,-0.19215475022792816f,-0.3632148504257202f,-0.13619378209114075f,0.16938945651054382f,1.7496157884597778f,-0.2276460826396942f,0.2347428798675537f,-1.5889536142349243f,-1.7217092514038086f,-0.642086923122406f}, -{-0.23210932314395905f,-0.04187174141407013f,0.0457797646522522f,-0.3829827308654785f,-0.03321319818496704f,-0.4536677598953247f,0.17873415350914001f,-0.20421427488327026f,-0.050184011459350586f,0.12480869889259338f,-0.2448161542415619f,0.3545852601528168f,-0.3647043704986572f,0.4557090699672699f,-0.3617521822452545f,-0.3207983374595642f}, -{0.5958813428878784f,-0.7483598589897156f,0.3954955041408539f,1.180490493774414f,0.0033026933670043945f,-0.33814364671707153f,-0.34186798334121704f,-0.11795541644096375f,0.3487861454486847f,-0.32520344853401184f,0.09490237385034561f,-0.25271910429000854f,-0.06444605439901352f,-0.3411557078361511f,1.0280723571777344f,0.09367766976356506f}, -{-0.2807841897010803f,-0.20072904229164124f,-0.15798500180244446f,0.3993121385574341f,-0.37393757700920105f,0.3688228130340576f,0.11292675137519836f,-0.2947862446308136f,-0.3764709532260895f,0.2424570620059967f,-0.10335299372673035f,-0.2837170362472534f,0.41839322447776794f,-0.03184046968817711f,-0.13749822974205017f,0.12308792769908905f}, -{-0.7124980688095093f,-1.5801732540130615f,-0.2018718123435974f,0.5093134045600891f,0.07545611262321472f,-0.9844921827316284f,-0.5402578711509705f,-0.21416273713111877f,-0.24509364366531372f,0.19522181153297424f,-0.9905045032501221f,-0.825104832649231f,-0.37918412685394287f,-0.08422137796878815f,-1.6365492343902588f,-0.5184823870658875f}, +{0.1319282501935959f,-1.5630793571472168f,0.33083590865135193f,-0.6722083687782288f,-0.14358049631118774f,-1.5424034595489502f,-0.5113024115562439f,-0.32745271921157837f,0.2600560486316681f,-0.37898191809654236f,-2.461042642593384f,-0.40288063883781433f,-0.31673234701156616f,1.4697182178497314f,0.17047874629497528f,-0.9254405498504639f}, +{-0.2827617824077606f,-0.5835872888565063f,-0.11379697918891907f,-0.2174888700246811f,0.041274964809417725f,-1.1300400495529175f,-0.5878999829292297f,-0.08471067994832993f,0.06103590130805969f,-0.38046833872795105f,-2.1991589069366455f,-0.5746544599533081f,-0.37024784088134766f,-1.505262017250061f,-0.564139187335968f,-0.7886471748352051f}, +{-0.16934998333454132f,0.5294079184532166f,-0.13502129912376404f,0.6688047051429749f,0.12987366318702698f,0.48973479866981506f,0.2711336314678192f,-0.3632148504257202f,-0.13619378209114075f,0.16938945651054382f,0.5563372373580933f,0.3686026632785797f,0.3811538517475128f,-0.608641505241394f,-0.3150292634963989f,-0.07790349423885345f}, +{-0.290787935256958f,0.008599113672971725f,0.0457797646522522f,-0.3533823788166046f,-0.03321319818496704f,-0.4156119227409363f,0.17873415350914001f,-0.20421427488327026f,-0.050184011459350586f,0.12480869889259338f,-0.2018822431564331f,0.3545852601528168f,-0.3647043704986572f,0.40289223194122314f,-0.40987616777420044f,-0.2687363028526306f}, +{0.31293871998786926f,0.514428973197937f,0.3954955041408539f,0.03152908384799957f,0.0033026933670043945f,0.11348362267017365f,-0.25357672572135925f,-0.1509854942560196f,0.3487861454486847f,-0.32520344853401184f,0.08041279017925262f,-0.32230615615844727f,0.0820283591747284f,-0.3886100947856903f,0.11279337108135223f,-0.043686479330062866f}, +{-0.26997238397598267f,-0.21165083348751068f,-0.15798500180244446f,0.37889501452445984f,-0.37393757700920105f,0.3643323481082916f,0.11292675137519836f,-0.2947862446308136f,-0.3764709532260895f,0.2424570620059967f,-0.11038123071193695f,-0.2837170362472534f,0.41839322447776794f,-0.016996487975120544f,-0.12759913504123688f,0.10896846652030945f}, +{-0.2488415539264679f,0.5050635933876038f,-0.2018718123435974f,0.4112447202205658f,0.07545611262321472f,0.41179272532463074f,-0.39304429292678833f,-0.21989363431930542f,-0.24509364366531372f,0.19522181153297424f,0.8638243079185486f,-0.5810434818267822f,-0.16718891263008118f,-0.8570426106452942f,-0.6993795037269592f,0.26117852330207825f}, {0.4138670265674591f,0.1604653298854828f,0.056746453046798706f,0.036025404930114746f,0.3228367865085602f,-0.07083973288536072f,0.018455177545547485f,0.0059362053871154785f,0.40515169501304626f,0.014240056276321411f,-0.07738298177719116f,0.1407785713672638f,-0.13024571537971497f,-0.29546058177948f,-0.11976784467697144f,-0.35825538635253906f}, -{0.27611151337623596f,0.09705754369497299f,0.12081471085548401f,0.27666717767715454f,0.29976895451545715f,-0.11293527483940125f,-0.112851083278656f,0.31089308857917786f,-0.3893685042858124f,-0.02222958207130432f,1.0978219509124756f,-0.19350941479206085f,-0.3426505923271179f,-0.2275802493095398f,0.19496259093284607f,-0.09103284776210785f}, +{-0.4079033434391022f,0.0030517925042659044f,0.12081471085548401f,-0.5565865635871887f,0.29976895451545715f,-1.0711815357208252f,-0.3759289085865021f,0.23442097008228302f,-0.3893685042858124f,-0.02222958207130432f,-3.00561785697937f,-0.32067564129829407f,-0.19991017878055573f,-0.5698347091674805f,0.07654765248298645f,-2.1375231742858887f}, }; const float h3[16][16] = { - {-0.36079341173171997f,-0.027788789942860603f,-0.5638431906700134f,-0.3619849383831024f,0.9020170569419861f,-1.959873080253601f,0.3332441747188568f,0.3036012351512909f,-5.876060485839844f,-0.054545141756534576f,-0.5245512127876282f,0.4001283347606659f,-1.4624212980270386f,-1.581647515296936f,-1.5321080684661865f,-13.199106216430664f}, -{0.047732532024383545f,-0.5910640358924866f,-8.166666030883789f,-0.5409420728683472f,-4.017717361450195f,0.39238861203193665f,-0.3198729455471039f,-0.09377332031726837f,0.43005314469337463f,-0.4782581329345703f,0.19243593513965607f,-0.37189948558807373f,-0.2667408287525177f,-0.2056405246257782f,0.30308958888053894f,-0.060796454548835754f}, + {-0.36079341173171997f,-0.08991171419620514f,-0.07854580879211426f,-0.3761775493621826f,-0.19077321887016296f,0.04002965986728668f,0.3332441747188568f,0.3036012351512909f,-0.2405819296836853f,0.04891335964202881f,-0.11870327591896057f,0.4001283347606659f,0.023342788219451904f,0.3089201748371124f,-0.3160521388053894f,0.14951297640800476f}, +{0.047732532024383545f,-0.09652574360370636f,0.8443890810012817f,-0.2737945318222046f,-0.6023720502853394f,0.0635899230837822f,-0.3198729455471039f,0.06247803568840027f,-0.14267313480377197f,-0.025146597996354103f,0.22248788177967072f,-0.3128277659416199f,-0.1967906951904297f,2.094522714614868f,-0.3103681206703186f,-0.29817160964012146f}, {0.07903262972831726f,0.2790505588054657f,-0.07798504829406738f,0.04248586297035217f,-0.1963958442211151f,-0.19260792434215546f,-0.4038352966308594f,0.015906542539596558f,0.15353140234947205f,0.030178606510162354f,0.2488909661769867f,0.13805970549583435f,-0.0816211998462677f,-0.20733052492141724f,-0.3036302626132965f,0.054825395345687866f}, -{-0.30922991037368774f,-0.9375655651092529f,1.271071434020996f,-0.39220312237739563f,0.5873679518699646f,-0.13144546747207642f,0.20021501183509827f,0.07002416253089905f,-0.2176603227853775f,-0.38262107968330383f,0.13192829489707947f,0.41021624207496643f,-2.843594551086426f,-0.36432549357414246f,1.2759990692138672f,0.3920643627643585f}, +{-0.30922991037368774f,0.09327439963817596f,0.05971873924136162f,-0.3845849633216858f,-0.5093491673469543f,0.33769017457962036f,0.20021501183509827f,0.07002416253089905f,-0.33915144205093384f,-0.365601509809494f,-0.03443625569343567f,0.41021624207496643f,-0.2978057265281677f,0.35003378987312317f,0.26804131269454956f,-0.023121735081076622f}, {-0.39607733488082886f,-0.05481579899787903f,0.1976260244846344f,0.022423356771469116f,0.16892847418785095f,-0.27518749237060547f,0.16012099385261536f,0.3626593053340912f,-0.08640444278717041f,-0.11053556203842163f,-0.10529157519340515f,-0.31317979097366333f,-0.1530032455921173f,-0.1336749792098999f,0.22959044575691223f,0.19986507296562195f}, -{-0.37449589371681213f,-0.32177311182022095f,-0.13848188519477844f,-0.19442035257816315f,0.5686139464378357f,0.40435296297073364f,-0.18732719123363495f,0.06904307007789612f,-2.3580894470214844f,-0.49854135513305664f,-0.29749685525894165f,0.04152391850948334f,0.6664230227470398f,0.778885543346405f,1.3324100971221924f,-1.2925522327423096f}, -{0.4110594093799591f,0.044055234640836716f,-0.08168259263038635f,0.37246426939964294f,0.23470649123191833f,-0.32751786708831787f,-0.08670487999916077f,-0.25336313247680664f,-0.030661463737487793f,-0.06259563565254211f,-0.1344406008720398f,0.35313835740089417f,0.31841135025024414f,-0.1037849485874176f,0.06134301796555519f,-0.06596158444881439f}, -{-0.40892091393470764f,0.043769627809524536f,-0.3867315948009491f,0.25968697667121887f,0.3424709737300873f,-0.051169753074645996f,-0.23312048614025116f,-0.390264093875885f,0.28059282898902893f,-0.1559126079082489f,-0.14134526252746582f,-0.0003446042537689209f,-0.2742875814437866f,-0.36560842394828796f,0.07994696497917175f,0.005298197269439697f}, +{-0.37449589371681213f,1.8457472324371338f,-1.8165240287780762f,0.09289615601301193f,-1.1789792776107788f,1.3625030517578125f,-0.18732719123363495f,0.22384825348854065f,-0.5127489566802979f,-1.1904394626617432f,-0.154531329870224f,0.19005391001701355f,-0.5971469283103943f,-0.36133918166160583f,0.4544094502925873f,-0.4715000092983246f}, +{0.4110594093799591f,0.2230953872203827f,-0.48654863238334656f,0.37246426939964294f,-0.24602459371089935f,0.1548190414905548f,-0.08670487999916077f,-0.25336313247680664f,-0.030661463737487793f,0.22344467043876648f,-0.1344406008720398f,0.35313835740089417f,0.21155259013175964f,0.10930821299552917f,0.3126353323459625f,-0.3391006588935852f}, +{-0.40892091393470764f,0.04582450911402702f,-0.3875610828399658f,0.25968697667121887f,0.3424709737300873f,-0.05059037357568741f,-0.23312048614025116f,-0.390264093875885f,0.28059282898902893f,-0.15431912243366241f,-0.14134526252746582f,-0.0003446042537689209f,-0.2742875814437866f,-0.3649594783782959f,0.07994696497917175f,0.005298197269439697f}, {0.10697010159492493f,-0.12228584289550781f,-0.37870171666145325f,0.21184906363487244f,-0.37222859263420105f,-0.17138728499412537f,-0.1382003128528595f,0.3493293821811676f,-0.360889196395874f,-0.3875247836112976f,0.42142823338508606f,-0.3482915461063385f,-0.3289247751235962f,-0.2186824083328247f,0.09620395302772522f,-0.06898030638694763f}, {0.2847062647342682f,0.018552124500274658f,0.11435768008232117f,0.36562982201576233f,-0.047046810388565063f,0.30447837710380554f,0.2430230677127838f,0.2909286320209503f,-0.2802048921585083f,0.18043199181556702f,0.41849127411842346f,-0.287167489528656f,0.24394884705543518f,-0.14084559679031372f,-0.10168051719665527f,0.010465055704116821f}, -{0.15459725260734558f,0.06760230660438538f,-0.05053713917732239f,-0.20622020959854126f,0.10792963206768036f,2.0012118816375732f,-0.08742031455039978f,-0.08940897136926651f,1.7973898649215698f,-0.4718508720397949f,-0.017247267067432404f,-0.30447322130203247f,1.1298593282699585f,-2.2213985919952393f,1.614871621131897f,-1.5353620052337646f}, -{-0.408692330121994f,0.05310394987463951f,0.006142709869891405f,0.0922636091709137f,-0.06141231954097748f,-0.10681948065757751f,0.03285527229309082f,0.38763079047203064f,-0.20705322921276093f,-0.25883403420448303f,0.12809070944786072f,0.03996849060058594f,-0.5435109734535217f,-0.26423168182373047f,-0.06897956132888794f,-0.005480319261550903f}, -{-0.2991822361946106f,0.3794580399990082f,-0.03499889746308327f,-0.05932474136352539f,0.1246454045176506f,0.18244199454784393f,-0.11253207921981812f,0.34576353430747986f,0.04814547300338745f,-0.35770976543426514f,-0.044228196144104004f,-0.36229726672172546f,0.01592516526579857f,-0.17703768610954285f,0.3047117292881012f,-0.09707321226596832f}, -{-0.2675279378890991f,0.08392087370157242f,1.9263038635253906f,-0.196403369307518f,-0.642519474029541f,0.12846513092517853f,-0.32875844836235046f,-0.31893211603164673f,-0.7980329394340515f,-0.6586599349975586f,-0.5574883818626404f,-0.553442120552063f,1.8443384170532227f,-0.7449765801429749f,0.4301890730857849f,0.058003246784210205f}, -{-0.015470266342163086f,-1.6724193096160889f,-0.6594526171684265f,0.19432266056537628f,0.11945655941963196f,-1.1154193878173828f,0.05196094512939453f,-0.008358269929885864f,-0.7575642466545105f,-0.42180460691452026f,-0.10627111047506332f,-0.11511552333831787f,-0.29712188243865967f,0.42317667603492737f,-1.8194135427474976f,2.299999237060547f}, -{0.1863725483417511f,0.2846532464027405f,-0.18863269686698914f,-0.5003810524940491f,0.3160429000854492f,0.2056346833705902f,0.04860696196556091f,0.17769548296928406f,0.012768898159265518f,0.3378079831600189f,-0.3929237127304077f,0.19592127203941345f,0.34371641278266907f,0.2283545434474945f,-0.004608725663274527f,-0.08839904516935349f}, +{0.15459725260734558f,0.8427432179450989f,0.679609477519989f,-0.1838339865207672f,-0.8048290014266968f,1.4805269241333008f,-0.08742031455039978f,0.05785742402076721f,-0.4665476381778717f,0.49658796191215515f,-0.08510879427194595f,-0.309722363948822f,-0.2896781861782074f,-0.9483605027198792f,0.4396055340766907f,0.17858834564685822f}, +{-0.408692330121994f,0.15604840219020844f,-0.11896948516368866f,0.0922636091709137f,-0.1451295167207718f,0.10412421077489853f,0.03285527229309082f,0.38763079047203064f,-0.20705322921276093f,-0.07742909342050552f,0.12809070944786072f,0.03996849060058594f,-0.4220041334629059f,-0.2886850833892822f,-0.3350064158439636f,0.3153386116027832f}, +{-0.2991822361946106f,0.3794580399990082f,-0.07897943258285522f,-0.05932474136352539f,0.08582660555839539f,0.24227938055992126f,-0.11253207921981812f,0.34576353430747986f,0.04814547300338745f,-0.35770976543426514f,-0.044228196144104004f,-0.36229726672172546f,0.015840977430343628f,-0.13475483655929565f,0.36124154925346375f,-0.16869547963142395f}, +{-0.2675279378890991f,0.4225318431854248f,-1.3180500268936157f,0.011379898525774479f,1.3076831102371216f,0.03549259528517723f,-0.32875844836235046f,-0.31893211603164673f,-0.9009249806404114f,-0.3250093460083008f,-0.5623511672019958f,-0.42054229974746704f,0.48087817430496216f,2.155684232711792f,0.3168305456638336f,0.050804875791072845f}, +{-0.015470266342163086f,-0.5833328366279602f,0.6117988228797913f,0.3354269862174988f,0.33325907588005066f,-0.5840275883674622f,0.05196094512939453f,-0.008358269929885864f,-0.5232630372047424f,-0.37522807717323303f,0.06831542402505875f,-0.11511552333831787f,0.5202909708023071f,-0.2629256248474121f,-0.06220770627260208f,-0.4585099518299103f}, +{0.1863725483417511f,1.084182858467102f,-1.0181115865707397f,-0.4724007248878479f,-0.33689597249031067f,0.9457219839096069f,0.04860696196556091f,0.17769548296928406f,-0.12625347077846527f,0.3378079831600189f,-0.4645434319972992f,0.19592127203941345f,-0.12818381190299988f,1.0687506198883057f,-0.028336618095636368f,-0.11500971764326096f}, }; -const float hout[16] = { 0.45773375034332275f,0.20441627502441406f,-0.2907588481903076f,-0.009697429835796356f,-0.13994097709655762f,0.2031724900007248f,0.0030125975608825684f,0.07766560465097427f,-0.1913822889328003f,0.057547036558389664f,0.13517257571220398f,-0.26330289244651794f,-0.18393218517303467f,0.33344095945358276f,0.14132554829120636f,-0.19920329749584198f }; - -const float b1[16] = { 0.7073319554328918f,2.1660501956939697f,-1.7145336866378784f,1.7168519496917725f,1.199524998664856f,1.0270514488220215f,-0.058932315558195114f,1.1854357719421387f,0.5485185980796814f,-1.4036970138549805f,0.5711912512779236f,1.4113762378692627f,-0.36514076590538025f,-1.5963966846466064f,-1.087764859199524f,1.332677960395813f }; - -const float b2[16] = { 0.9642994403839111f,-1.7880347967147827f,-1.4564176797866821f,-0.6939772963523865f,-0.6939148902893066f,0.26103776693344116f,-0.01476240810006857f,-0.30969977378845215f,-1.20063054561615f,-1.912178635597229f,0.39619338512420654f,0.15750396251678467f,-0.3155595064163208f,1.7251747846603394f,0.4949413537979126f,0.4069630801677704f }; - -const float b3[16] = { -1.963319182395935f,0.8966529965400696f,-0.72108393907547f,-0.3776831030845642f,0.27197739481925964f,0.39454057812690735f,-0.45353031158447266f,-0.8078028559684753f,1.2238730192184448f,0.07242175191640854f,-0.39867648482322693f,-0.09921017289161682f,-1.0563924312591553f,0.7492903470993042f,-0.5671085715293884f,-0.5422713160514832f }; - -const float bout[1] = { -0.3978618383407593f }; +const float hout[16] = { 0.45773375034332275f,1.3250397443771362f,-0.4248747229576111f,-0.16762784123420715f,-0.8701521158218384f,-0.003051317995414138f,0.0030125975608825684f,0.15066689252853394f,-0.0765313059091568f,0.410363107919693f,0.11355479061603546f,-0.2710728645324707f,-1.0137888193130493f,0.31872233748435974f,0.46201157569885254f,-0.1275034099817276f }; + +const float b1[16] = { 0.34279701113700867f,1.5129735469818115f,-1.7145336866378784f,0.27451324462890625f,0.7754346132278442f,1.2727166414260864f,-0.058932315558195114f,0.9473782777786255f,1.5622917413711548f,-1.0377662181854248f,0.5732393264770508f,1.2818049192428589f,-0.37127330899238586f,-1.0851714611053467f,-1.087764859199524f,2.291581153869629f }; + +const float b2[16] = { -0.1286313831806183f,-1.2512075901031494f,-1.4564176797866821f,-0.8030261397361755f,-0.6939148902893066f,-0.16376319527626038f,0.1311706006526947f,-0.3665841221809387f,-1.20063054561615f,-1.912178635597229f,-0.45517241954803467f,0.411864310503006f,-0.07918518036603928f,1.8873447179794312f,-0.0411815345287323f,0.7242259383201599f }; + +const float b3[16] = { -1.963319182395935f,-0.7351341247558594f,0.32978370785713196f,-0.1386529505252838f,0.019260885193943977f,-0.056516703218221664f,-0.45353031158447266f,-0.6562485098838806f,-0.015211169607937336f,0.6103503704071045f,-0.34831100702285767f,-0.014407366514205933f,-0.753882646560669f,-1.2588518857955933f,-1.226777195930481f,-0.5482154488563538f }; + +const float bout[1] = { 0.2236381620168686f }; /////////////////////////////////////////////////////////////////////////////////////////////RL float input_RL[num_input_RL] = { 0.0f }; @@ -1041,9 +1041,9 @@ ind = ind + 1; for(int i=0; i<numfuture_f; i++) { // input_NN[ind] = (f_future[time_interval*i+time_interval] - torq.sen)/10000.0f * 8.0f + 0.5f; - input_NN[ind] = (f_future[time_interval*i+time_interval] - torq.sen)/10000.0f + 0.5f; +// input_NN[ind] = (f_future[time_interval*i+time_interval] - torq.sen)/10000.0f + 0.5f; // input_NN[ind] = (f_future[time_interval*i+time_interval])/10000.0f*8.0f+0.5f; -// input_NN[ind] = (f_future[time_interval*i+time_interval])/10000.0f + 0.5f; + input_NN[ind] = (f_future[time_interval*i+time_interval])/10000.0f + 0.5f; ind = ind + 1; } @@ -2534,10 +2534,10 @@ torq.err = torq.ref - torq.sen; //[N] torq.err_sum += torq.err/(float) TMR_FREQ_5k; //[N] - float k3 = 20000.0f; //2000 + float k3 = 2000.0f; //2000 //20000 float k4 = 10.0f; float rho3 = 3.2f; - float rho4 = 25000000.0f; + float rho4 = 10000000.0f; //25000000.0f; float x_4_des = (-f3 + torq_ref_dot - k3*(-torq.err))/(gamma_hat*g3_prime); if (x_4_des > 1) x_4_des = 1; else if (x_4_des < -1) x_4_des = -1; @@ -2548,15 +2548,21 @@ valve_pos.ref = x_4_des * (float)(VALVE_CENTER - VALVE_MIN_POS) + (float) VALVE_CENTER; } - float x_4_des_dot = (x_4_des - x_4_des_old)*(float) TMR_FREQ_5k; x_4_des_old = x_4_des; - + float V_input = 0.0f; V_out = (-f4 + x_4_des_dot - k4*(x_v-x_4_des)- rho3/rho4*gamma_hat*g3_prime*(-torq.err))/g4; - - float rho_gamma = 50000.0f;//5000 +// //V_out LPF +// float alpha_V_out = 1.0f/(1.0f + 5000.0f/(2.0f*3.14f*50.0f)); // f_cutoff : 50Hz +// V_out = V_out*(1.0f-alpha_V_out)+V_input*(alpha_V_out); + + float rho_gamma = 5000.0f;//5000 for change //50000 for not change float gamma_hat_dot = rho3*(-torq.err)/rho_gamma*((-f3+torq_ref_dot-k3*(-torq.err))/gamma_hat + g3_prime*(x_v-x_4_des)); gamma_hat = gamma_hat + gamma_hat_dot / (float) TMR_FREQ_5k; + + if(gamma_hat > 10000.0f) gamma_hat = 10000.0f; + else if(gamma_hat < 100.0f) gamma_hat = 100.0f; + break; } @@ -2838,8 +2844,8 @@ if (flag_data_request[4] == HIGH) { //valve position - CAN_TX_VALVE_POSITION((int16_t) pos.sen/(float)(ENC_PULSE_PER_POSITION), (int16_t) virt_pos, (int16_t) (logging2*1000.0f), (int16_t) (logging4*1000.0f)); //1600 - //CAN_TX_VALVE_POSITION((int16_t) action_array[20], (int16_t) virt_pos, (int16_t) Update_Case*1000, (int16_t) (logging4*1000.0f)); //1600 + //CAN_TX_VALVE_POSITION((int16_t) pos.sen/(float)(ENC_PULSE_PER_POSITION), (int16_t) virt_pos, (int16_t) (logging2*1000.0f), (int16_t) (logging4*1000.0f)); //1600 + CAN_TX_VALVE_POSITION((int16_t) gamma_hat, (int16_t) 0, (int16_t) 0, (int16_t) 0); //1600 } // Others : Reference position, Reference FT, PWM, Current (ID:1300)