![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
distribution-201229
Diff: main.cpp
- Revision:
- 218:066030f7951f
- Parent:
- 217:ea3ce5d72ae3
- Child:
- 219:3cb6bd063f56
diff -r ea3ce5d72ae3 -r 066030f7951f main.cpp --- a/main.cpp Thu Dec 24 14:45:19 2020 +0000 +++ b/main.cpp Sun Dec 27 12:37:18 2020 +0000 @@ -1,4 +1,4 @@ -//201224_4 +//201226_1 #include "mbed.h" #include "FastPWM.h" #include "INIT_HW.h" @@ -200,59 +200,59 @@ const float h1[num_input][16] = { {-1.3188419342041016f,1.1015946865081787f,0.1310378611087799f,0.425862580537796f,-1.3821747303009033f,1.1033618450164795f,-0.17743819952011108f,0.8947198987007141f,-0.8323164582252502f,-0.04114618897438049f,-0.003459111088886857f,-1.0934569835662842f,-0.2590428590774536f,-0.5558655261993408f,-0.2611466646194458f,0.024373603984713554f}, -{-1.044303297996521f,0.7612116932868958f,-0.3988758325576782f,0.1073291152715683f,-1.0053714513778687f,0.5248311758041382f,-0.4116867780685425f,0.35538050532341003f,-0.3489154279232025f,0.21759790182113647f,-0.11023671925067902f,-0.5993606448173523f,0.24837161600589752f,-0.7363064885139465f,-0.21292872726917267f,0.18341368436813354f}, -{-0.8023618459701538f,0.4315384030342102f,0.36955419182777405f,-0.2512732148170471f,-0.38124769926071167f,0.3337925374507904f,0.2916664779186249f,0.20207014679908752f,-0.26900148391723633f,0.22544367611408234f,-0.25711753964424133f,-0.31503909826278687f,0.0064854794181883335f,0.035251207649707794f,0.056768983602523804f,-0.18308201432228088f}, -{-0.394621878862381f,-0.1719120293855667f,0.40358296036720276f,0.42023688554763794f,0.06037278473377228f,-0.44249752163887024f,-0.11764177680015564f,0.10723409801721573f,0.0934249609708786f,0.3654900789260864f,0.11849074065685272f,0.4522974491119385f,-0.15813837945461273f,0.24657508730888367f,-0.3007376194000244f,0.027820143848657608f}, -{0.5724979639053345f,-0.48123183846473694f,-0.005224883556365967f,0.37380412220954895f,0.6026304364204407f,-0.6522341966629028f,0.13140985369682312f,-0.7390255928039551f,0.4500592052936554f,0.18186268210411072f,0.2947525978088379f,0.6649997234344482f,-0.0602697990834713f,0.8220046162605286f,-0.39249828457832336f,-0.4024631679058075f}, -{1.4929051399230957f,-1.7723467350006104f,0.22110894322395325f,0.41007909178733826f,1.5461177825927734f,-1.6431761980056763f,0.16770240664482117f,-1.7085875272750854f,1.1471062898635864f,0.1962171047925949f,-0.3956814706325531f,1.565327763557434f,-0.2601589560508728f,1.6338653564453125f,-0.4196912348270416f,-0.5275029540061951f}, -{0.16622689366340637f,0.094024159014225f,-0.2540779709815979f,-0.7612617015838623f,-0.49709346890449524f,0.39399170875549316f,0.06107431650161743f,-0.15140821039676666f,-0.42806950211524963f,-0.017373915761709213f,0.223312646150589f,-0.09082504361867905f,-0.1699696183204651f,0.21603620052337646f,-0.15860587358474731f,-0.30729222297668457f}, -{0.3740707039833069f,-0.5162192583084106f,-0.2703247666358948f,-0.21249370276927948f,-0.22460711002349854f,-0.2896941006183624f,-0.18203827738761902f,-0.4928327798843384f,0.1716698259115219f,0.05402236431837082f,0.04233044758439064f,-0.18938399851322174f,0.38246333599090576f,0.36619728803634644f,0.0436977744102478f,-0.11313924938440323f}, -{0.44147852063179016f,0.08511102199554443f,0.10406997799873352f,-0.6988250017166138f,-0.12479954212903976f,-0.014051994308829308f,-0.07359349727630615f,-0.5255224704742432f,0.26467326283454895f,0.30673301219940186f,-0.44213414192199707f,0.2275058627128601f,0.23771138489246368f,0.4562159776687622f,-0.31029027700424194f,-0.05488807335495949f}, -{0.06252124905586243f,-0.37980619072914124f,0.18748918175697327f,-0.43770161271095276f,0.0818045362830162f,0.20953527092933655f,-0.3036908507347107f,-0.10104111582040787f,0.7176201343536377f,-0.5149088501930237f,-0.18206652998924255f,-0.6509184241294861f,0.38291072845458984f,-0.058381062000989914f,0.35390153527259827f,-0.22490857541561127f}, -{0.44843414425849915f,0.07815257459878922f,0.3775894343852997f,-0.030792826786637306f,-0.1508180946111679f,0.06181186065077782f,-0.20654654502868652f,0.11699937283992767f,0.24502204358577728f,-0.0012500198790803552f,0.17670658230781555f,-0.5153126120567322f,-0.06283143907785416f,0.06424001604318619f,0.2710213363170624f,-0.5186665654182434f}, -{-0.32994866371154785f,-0.42429524660110474f,-0.40945154428482056f,-0.2757742404937744f,-0.014833655208349228f,-0.05719117075204849f,0.15575703978538513f,0.4994480609893799f,0.4656277000904083f,0.18031072616577148f,-0.5855719447135925f,-0.013890904374420643f,0.15162703394889832f,0.07344543188810349f,0.10656675696372986f,-0.24474458396434784f}, -{-0.024391446262598038f,-0.21064427495002747f,0.2015570104122162f,-0.10794585943222046f,0.19281460344791412f,0.11780568212270737f,-0.24415965378284454f,0.25574594736099243f,0.32768353819847107f,-0.22811290621757507f,-0.26534199714660645f,-0.3911608159542084f,0.0980864018201828f,0.11463749408721924f,-0.22613362967967987f,-0.5228750705718994f}, -{-0.17537148296833038f,-0.0768209844827652f,0.41918185353279114f,-0.33424243330955505f,-0.40935051441192627f,-0.2844356596469879f,-0.32497477531433105f,-0.1858813613653183f,0.2077520787715912f,-0.2599889934062958f,-0.3490596115589142f,-0.36629024147987366f,-0.3129832148551941f,0.010562135837972164f,0.04871204495429993f,-0.00758293317630887f}, -{0.10920947790145874f,0.02847476489841938f,0.20596781373023987f,-0.16273868083953857f,0.17861789464950562f,-0.1890067607164383f,0.042680561542510986f,0.39797306060791016f,0.4726075828075409f,0.05316445603966713f,-0.44276881217956543f,-0.6162247657775879f,0.10978464782238007f,-0.005044030491262674f,0.06784489750862122f,0.07384920120239258f}, -{-0.027906058356165886f,-0.4482294023036957f,-0.4106670916080475f,-0.3072645962238312f,-0.24792344868183136f,-0.1550082266330719f,-0.15809619426727295f,-0.023345662280917168f,0.36193379759788513f,-0.03558121994137764f,-0.6655545234680176f,-0.13668949902057648f,-0.27069708704948425f,0.16696994006633759f,-0.08373728394508362f,0.10844256728887558f}, + {-1.044303297996521f,0.7612116932868958f,-0.3988758325576782f,0.1073291152715683f,-1.0053714513778687f,0.5248311758041382f,-0.4116867780685425f,0.35538050532341003f,-0.3489154279232025f,0.21759790182113647f,-0.11023671925067902f,-0.5993606448173523f,0.24837161600589752f,-0.7363064885139465f,-0.21292872726917267f,0.18341368436813354f}, + {-0.8023618459701538f,0.4315384030342102f,0.36955419182777405f,-0.2512732148170471f,-0.38124769926071167f,0.3337925374507904f,0.2916664779186249f,0.20207014679908752f,-0.26900148391723633f,0.22544367611408234f,-0.25711753964424133f,-0.31503909826278687f,0.0064854794181883335f,0.035251207649707794f,0.056768983602523804f,-0.18308201432228088f}, + {-0.394621878862381f,-0.1719120293855667f,0.40358296036720276f,0.42023688554763794f,0.06037278473377228f,-0.44249752163887024f,-0.11764177680015564f,0.10723409801721573f,0.0934249609708786f,0.3654900789260864f,0.11849074065685272f,0.4522974491119385f,-0.15813837945461273f,0.24657508730888367f,-0.3007376194000244f,0.027820143848657608f}, + {0.5724979639053345f,-0.48123183846473694f,-0.005224883556365967f,0.37380412220954895f,0.6026304364204407f,-0.6522341966629028f,0.13140985369682312f,-0.7390255928039551f,0.4500592052936554f,0.18186268210411072f,0.2947525978088379f,0.6649997234344482f,-0.0602697990834713f,0.8220046162605286f,-0.39249828457832336f,-0.4024631679058075f}, + {1.4929051399230957f,-1.7723467350006104f,0.22110894322395325f,0.41007909178733826f,1.5461177825927734f,-1.6431761980056763f,0.16770240664482117f,-1.7085875272750854f,1.1471062898635864f,0.1962171047925949f,-0.3956814706325531f,1.565327763557434f,-0.2601589560508728f,1.6338653564453125f,-0.4196912348270416f,-0.5275029540061951f}, + {0.16622689366340637f,0.094024159014225f,-0.2540779709815979f,-0.7612617015838623f,-0.49709346890449524f,0.39399170875549316f,0.06107431650161743f,-0.15140821039676666f,-0.42806950211524963f,-0.017373915761709213f,0.223312646150589f,-0.09082504361867905f,-0.1699696183204651f,0.21603620052337646f,-0.15860587358474731f,-0.30729222297668457f}, + {0.3740707039833069f,-0.5162192583084106f,-0.2703247666358948f,-0.21249370276927948f,-0.22460711002349854f,-0.2896941006183624f,-0.18203827738761902f,-0.4928327798843384f,0.1716698259115219f,0.05402236431837082f,0.04233044758439064f,-0.18938399851322174f,0.38246333599090576f,0.36619728803634644f,0.0436977744102478f,-0.11313924938440323f}, + {0.44147852063179016f,0.08511102199554443f,0.10406997799873352f,-0.6988250017166138f,-0.12479954212903976f,-0.014051994308829308f,-0.07359349727630615f,-0.5255224704742432f,0.26467326283454895f,0.30673301219940186f,-0.44213414192199707f,0.2275058627128601f,0.23771138489246368f,0.4562159776687622f,-0.31029027700424194f,-0.05488807335495949f}, + {0.06252124905586243f,-0.37980619072914124f,0.18748918175697327f,-0.43770161271095276f,0.0818045362830162f,0.20953527092933655f,-0.3036908507347107f,-0.10104111582040787f,0.7176201343536377f,-0.5149088501930237f,-0.18206652998924255f,-0.6509184241294861f,0.38291072845458984f,-0.058381062000989914f,0.35390153527259827f,-0.22490857541561127f}, + {0.44843414425849915f,0.07815257459878922f,0.3775894343852997f,-0.030792826786637306f,-0.1508180946111679f,0.06181186065077782f,-0.20654654502868652f,0.11699937283992767f,0.24502204358577728f,-0.0012500198790803552f,0.17670658230781555f,-0.5153126120567322f,-0.06283143907785416f,0.06424001604318619f,0.2710213363170624f,-0.5186665654182434f}, + {-0.32994866371154785f,-0.42429524660110474f,-0.40945154428482056f,-0.2757742404937744f,-0.014833655208349228f,-0.05719117075204849f,0.15575703978538513f,0.4994480609893799f,0.4656277000904083f,0.18031072616577148f,-0.5855719447135925f,-0.013890904374420643f,0.15162703394889832f,0.07344543188810349f,0.10656675696372986f,-0.24474458396434784f}, + {-0.024391446262598038f,-0.21064427495002747f,0.2015570104122162f,-0.10794585943222046f,0.19281460344791412f,0.11780568212270737f,-0.24415965378284454f,0.25574594736099243f,0.32768353819847107f,-0.22811290621757507f,-0.26534199714660645f,-0.3911608159542084f,0.0980864018201828f,0.11463749408721924f,-0.22613362967967987f,-0.5228750705718994f}, + {-0.17537148296833038f,-0.0768209844827652f,0.41918185353279114f,-0.33424243330955505f,-0.40935051441192627f,-0.2844356596469879f,-0.32497477531433105f,-0.1858813613653183f,0.2077520787715912f,-0.2599889934062958f,-0.3490596115589142f,-0.36629024147987366f,-0.3129832148551941f,0.010562135837972164f,0.04871204495429993f,-0.00758293317630887f}, + {0.10920947790145874f,0.02847476489841938f,0.20596781373023987f,-0.16273868083953857f,0.17861789464950562f,-0.1890067607164383f,0.042680561542510986f,0.39797306060791016f,0.4726075828075409f,0.05316445603966713f,-0.44276881217956543f,-0.6162247657775879f,0.10978464782238007f,-0.005044030491262674f,0.06784489750862122f,0.07384920120239258f}, + {-0.027906058356165886f,-0.4482294023036957f,-0.4106670916080475f,-0.3072645962238312f,-0.24792344868183136f,-0.1550082266330719f,-0.15809619426727295f,-0.023345662280917168f,0.36193379759788513f,-0.03558121994137764f,-0.6655545234680176f,-0.13668949902057648f,-0.27069708704948425f,0.16696994006633759f,-0.08373728394508362f,0.10844256728887558f}, }; const float h2[16][16] = { {-0.6137141585350037f,1.4743585586547852f,-0.06966331601142883f,0.44523122906684875f,-0.21907491981983185f,1.177562952041626f,0.17531350255012512f,0.0904630720615387f,-0.43008196353912354f,-0.1415480375289917f,-0.07571391761302948f,-0.2901824414730072f,0.12968102097511292f,-1.8563700914382935f,-0.35320353507995605f,2.347154378890991f}, -{0.11523692309856415f,-0.9528547525405884f,0.057057321071624756f,-0.5944203734397888f,-0.35503754019737244f,-1.0155067443847656f,-0.3579281270503998f,-0.2990124225616455f,-0.33757925033569336f,0.2895788848400116f,-0.5133021473884583f,-0.5619229078292847f,0.19565780460834503f,1.373045563697815f,-0.07346101105213165f,-0.2817831039428711f}, -{-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.2854876220226288f,-0.2779490351676941f,-0.2894435524940491f,0.473821759223938f,0.08946844935417175f,0.3670594394207001f,-0.23805393278598785f,0.4122363030910492f,0.26211628317832947f,0.2953031361103058f,0.24802200496196747f,0.3810727596282959f,-0.404754102230072f,-0.24357056617736816f,0.18828310072422028f,0.10349465161561966f}, -{-0.6117962598800659f,-1.10486900806427f,-0.25313520431518555f,0.1484975814819336f,0.036378175020217896f,0.3806813657283783f,-0.29555338621139526f,-0.08570799231529236f,-0.024399548768997192f,-0.39465832710266113f,-0.740439236164093f,-0.6068781018257141f,-0.04600336775183678f,-1.4622244834899902f,-0.44563576579093933f,2.0960819721221924f}, -{0.20252275466918945f,2.0455241203308105f,-0.3519742488861084f,-0.13307900726795197f,-0.3015052080154419f,-1.0664831399917603f,-0.45894497632980347f,-0.019414573907852173f,-0.23047015070915222f,0.3579089343547821f,-0.4327160120010376f,-0.17152506113052368f,-0.32991352677345276f,1.1493836641311646f,0.1872640699148178f,-0.09607189148664474f}, -{-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}, -{-0.3769959509372711f,0.7894091010093689f,0.33083590865135193f,-1.434015154838562f,-0.14358049631118774f,-1.39875066280365f,-0.12520501017570496f,-0.3003333508968353f,0.2600560486316681f,-0.37898191809654236f,-0.42964687943458557f,-0.4603452980518341f,-0.3540525734424591f,1.1433944702148438f,0.5242350101470947f,0.2081318348646164f}, -{-0.6740375757217407f,0.947818398475647f,-0.11379697918891907f,-0.06858066469430923f,0.041274964809417725f,-0.545332133769989f,-0.1525300294160843f,0.0019084513187408447f,0.06103590130805969f,-0.38046833872795105f,-0.4976799190044403f,-0.5077089667320251f,-0.5060222148895264f,-0.5033490657806396f,-0.5192798376083374f,-0.37890273332595825f}, -{-0.17178326845169067f,0.5441228747367859f,-0.13502129912376404f,0.7287293076515198f,0.12987366318702698f,0.6195155382156372f,0.2711336314678192f,-0.3632148504257202f,-0.13619378209114075f,0.16938945651054382f,0.4668400287628174f,0.3686023950576782f,0.3811538517475128f,-0.6144871711730957f,-0.21053126454353333f,0.05651098117232323f}, -{-1.580880880355835f,-0.10419536381959915f,0.0457797646522522f,-0.2574945092201233f,-0.03321319818496704f,-0.6347406506538391f,0.17873415350914001f,-0.20421427488327026f,-0.050184011459350586f,0.12480869889259338f,-1.071244239807129f,0.32463788986206055f,-0.3971530497074127f,0.34406694769859314f,-0.5322715640068054f,-0.2935540974140167f}, -{0.11559143662452698f,-1.3624541759490967f,0.3954955041408539f,0.10072405636310577f,0.0033026933670043945f,-0.022512730211019516f,-0.2536891996860504f,-0.11795541644096375f,0.3487861454486847f,-0.32520344853401184f,0.002665468491613865f,-0.3433115482330322f,-0.07050289958715439f,-0.7653756141662598f,0.13200169801712036f,0.39050841331481934f}, -{-0.3031129240989685f,-0.18701240420341492f,-0.15798500180244446f,0.38361304998397827f,-0.37393757700920105f,0.3994772434234619f,0.11292675137519836f,-0.2947862446308136f,-0.3764709532260895f,0.2424570620059967f,-0.08566135168075562f,-0.2837170362472534f,0.41839322447776794f,-0.041237227618694305f,-0.14707240462303162f,0.13266873359680176f}, -{-0.11508955806493759f,-0.4854642450809479f,-0.2018718123435974f,0.3094158470630646f,0.07545611262321472f,0.021646978333592415f,-0.12517906725406647f,-0.21416273713111877f,-0.24509364366531372f,0.19522181153297424f,0.37494906783103943f,-0.44791656732559204f,-0.3139974772930145f,-0.6191354990005493f,-0.7066778540611267f,-0.5619688034057617f}, -{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.8834927678108215f,0.24794167280197144f,0.12081471085548401f,-0.17883329093456268f,0.29976895451545715f,-0.1233057752251625f,-0.112851083278656f,0.31089308857917786f,-0.3893685042858124f,-0.02222958207130432f,-0.13238534331321716f,-0.14616242051124573f,-0.19991017878055573f,0.08705843240022659f,0.25427308678627014f,0.03441285714507103f}, + {0.11523692309856415f,-0.9528547525405884f,0.057057321071624756f,-0.5944203734397888f,-0.35503754019737244f,-1.0155067443847656f,-0.3579281270503998f,-0.2990124225616455f,-0.33757925033569336f,0.2895788848400116f,-0.5133021473884583f,-0.5619229078292847f,0.19565780460834503f,1.373045563697815f,-0.07346101105213165f,-0.2817831039428711f}, + {-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.2854876220226288f,-0.2779490351676941f,-0.2894435524940491f,0.473821759223938f,0.08946844935417175f,0.3670594394207001f,-0.23805393278598785f,0.4122363030910492f,0.26211628317832947f,0.2953031361103058f,0.24802200496196747f,0.3810727596282959f,-0.404754102230072f,-0.24357056617736816f,0.18828310072422028f,0.10349465161561966f}, + {-0.6117962598800659f,-1.10486900806427f,-0.25313520431518555f,0.1484975814819336f,0.036378175020217896f,0.3806813657283783f,-0.29555338621139526f,-0.08570799231529236f,-0.024399548768997192f,-0.39465832710266113f,-0.740439236164093f,-0.6068781018257141f,-0.04600336775183678f,-1.4622244834899902f,-0.44563576579093933f,2.0960819721221924f}, + {0.20252275466918945f,2.0455241203308105f,-0.3519742488861084f,-0.13307900726795197f,-0.3015052080154419f,-1.0664831399917603f,-0.45894497632980347f,-0.019414573907852173f,-0.23047015070915222f,0.3579089343547821f,-0.4327160120010376f,-0.17152506113052368f,-0.32991352677345276f,1.1493836641311646f,0.1872640699148178f,-0.09607189148664474f}, + {-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}, + {-0.3769959509372711f,0.7894091010093689f,0.33083590865135193f,-1.434015154838562f,-0.14358049631118774f,-1.39875066280365f,-0.12520501017570496f,-0.3003333508968353f,0.2600560486316681f,-0.37898191809654236f,-0.42964687943458557f,-0.4603452980518341f,-0.3540525734424591f,1.1433944702148438f,0.5242350101470947f,0.2081318348646164f}, + {-0.6740375757217407f,0.947818398475647f,-0.11379697918891907f,-0.06858066469430923f,0.041274964809417725f,-0.545332133769989f,-0.1525300294160843f,0.0019084513187408447f,0.06103590130805969f,-0.38046833872795105f,-0.4976799190044403f,-0.5077089667320251f,-0.5060222148895264f,-0.5033490657806396f,-0.5192798376083374f,-0.37890273332595825f}, + {-0.17178326845169067f,0.5441228747367859f,-0.13502129912376404f,0.7287293076515198f,0.12987366318702698f,0.6195155382156372f,0.2711336314678192f,-0.3632148504257202f,-0.13619378209114075f,0.16938945651054382f,0.4668400287628174f,0.3686023950576782f,0.3811538517475128f,-0.6144871711730957f,-0.21053126454353333f,0.05651098117232323f}, + {-1.580880880355835f,-0.10419536381959915f,0.0457797646522522f,-0.2574945092201233f,-0.03321319818496704f,-0.6347406506538391f,0.17873415350914001f,-0.20421427488327026f,-0.050184011459350586f,0.12480869889259338f,-1.071244239807129f,0.32463788986206055f,-0.3971530497074127f,0.34406694769859314f,-0.5322715640068054f,-0.2935540974140167f}, + {0.11559143662452698f,-1.3624541759490967f,0.3954955041408539f,0.10072405636310577f,0.0033026933670043945f,-0.022512730211019516f,-0.2536891996860504f,-0.11795541644096375f,0.3487861454486847f,-0.32520344853401184f,0.002665468491613865f,-0.3433115482330322f,-0.07050289958715439f,-0.7653756141662598f,0.13200169801712036f,0.39050841331481934f}, + {-0.3031129240989685f,-0.18701240420341492f,-0.15798500180244446f,0.38361304998397827f,-0.37393757700920105f,0.3994772434234619f,0.11292675137519836f,-0.2947862446308136f,-0.3764709532260895f,0.2424570620059967f,-0.08566135168075562f,-0.2837170362472534f,0.41839322447776794f,-0.041237227618694305f,-0.14707240462303162f,0.13266873359680176f}, + {-0.11508955806493759f,-0.4854642450809479f,-0.2018718123435974f,0.3094158470630646f,0.07545611262321472f,0.021646978333592415f,-0.12517906725406647f,-0.21416273713111877f,-0.24509364366531372f,0.19522181153297424f,0.37494906783103943f,-0.44791656732559204f,-0.3139974772930145f,-0.6191354990005493f,-0.7066778540611267f,-0.5619688034057617f}, + {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.8834927678108215f,0.24794167280197144f,0.12081471085548401f,-0.17883329093456268f,0.29976895451545715f,-0.1233057752251625f,-0.112851083278656f,0.31089308857917786f,-0.3893685042858124f,-0.02222958207130432f,-0.13238534331321716f,-0.14616242051124573f,-0.19991017878055573f,0.08705843240022659f,0.25427308678627014f,0.03441285714507103f}, }; const float h3[16][16] = { {-0.36079341173171997f,0.4179607927799225f,-0.4788687825202942f,-0.943571150302887f,-0.6513329744338989f,0.45123860239982605f,0.3332441747188568f,0.3036012351512909f,-0.2405819296836853f,0.04891335964202881f,-0.11870327591896057f,0.4001283347606659f,-0.34280824661254883f,0.8033843636512756f,0.22359506785869598f,-0.4850134551525116f}, -{0.047732532024383545f,-0.0005002500838600099f,0.2062004953622818f,-0.49202707409858704f,-0.7950537204742432f,0.5808789134025574f,-0.3198729455471039f,-0.021581318229436874f,0.030888425186276436f,-0.4661758840084076f,0.3326369524002075f,-0.40172186493873596f,-0.3751802444458008f,-0.22362682223320007f,-0.36363548040390015f,-0.1590748429298401f}, -{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.005268699023872614f,0.17382051050662994f,-0.9704000353813171f,-0.3447703421115875f,0.17672207951545715f,0.20021501183509827f,0.07002416253089905f,-0.29103443026542664f,-0.39435261487960815f,0.13192829489707947f,0.41021624207496643f,-0.34153303503990173f,0.17057965695858002f,0.27040961384773254f,-0.5609870553016663f}, -{-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.04980236664414406f,-0.8650763630867004f,-0.5145219564437866f,-0.32554495334625244f,0.6611357927322388f,-0.18732719123363495f,0.22384825348854065f,-1.9989635944366455f,-0.31645265221595764f,-0.08919548988342285f,0.12389334291219711f,-0.7621546387672424f,0.4246171712875366f,0.5176900029182434f,-1.4521894454956055f}, -{0.4110594093799591f,0.2715781033039093f,-0.28422388434410095f,0.37246426939964294f,0.15203647315502167f,-0.09465086460113525f,-0.08670487999916077f,-0.25336313247680664f,-0.030661463737487793f,-0.06259563565254211f,-0.1344406008720398f,0.35313835740089417f,0.21155259013175964f,0.09161094576120377f,0.3126353323459625f,-0.3391006588935852f}, -{-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.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.3581882119178772f,0.048021938651800156f,0.001559896394610405f,-0.2978953719139099f,0.2191316783428192f,-0.08742031455039978f,0.05785742402076721f,-0.08406508713960648f,-0.34975606203079224f,0.1268840730190277f,-0.30447322130203247f,-0.10453349351882935f,-0.10472984611988068f,0.4355164170265198f,0.2022944986820221f}, -{-0.408692330121994f,-0.1563672423362732f,0.050031907856464386f,-0.0608118437230587f,-0.04799661040306091f,-0.17681097984313965f,0.03285527229309082f,0.38763079047203064f,-0.20705322921276093f,-0.25883403420448303f,0.12809070944786072f,0.03996849060058594f,-0.42210137844085693f,-0.23267120122909546f,-0.3349152207374573f,0.16666513681411743f}, -{-0.2991822361946106f,0.3794580399990082f,-0.07385820895433426f,-0.05301479622721672f,0.09207906574010849f,0.23433926701545715f,-0.11253207921981812f,0.34576353430747986f,0.04814547300338745f,-0.35770976543426514f,-0.044228196144104004f,-0.36229726672172546f,0.021879205480217934f,-0.14001017808914185f,0.36124154925346375f,-0.1589106321334839f}, -{-0.2675279378890991f,-0.2702247202396393f,-0.027820924296975136f,0.1762058138847351f,1.2094794511795044f,-0.49327564239501953f,-0.32875844836235046f,-0.9438692331314087f,-1.6906083822250366f,-0.7808446288108826f,-0.46338480710983276f,-0.49088165163993835f,0.32546529173851013f,-1.8672279119491577f,0.34107983112335205f,1.1565977334976196f}, -{-0.015470266342163086f,-0.411062091588974f,0.24327310919761658f,0.33764204382896423f,-0.04734501242637634f,-0.23505239188671112f,0.05196094512939453f,-0.008358269929885864f,-0.414988249540329f,-0.38441595435142517f,0.13179203867912292f,-0.11511552333831787f,0.14932915568351746f,0.10927555710077286f,0.07806598395109177f,-0.4222360849380493f}, -{0.1863725483417511f,-0.11428238451480865f,-0.8975226879119873f,-0.29820317029953003f,0.7560155987739563f,-2.0828094482421875f,0.04860696196556091f,0.14381852746009827f,-0.4302019774913788f,-0.03712918981909752f,-0.48258212208747864f,-0.003259873716160655f,0.0876874178647995f,0.22110247611999512f,-0.024374688044190407f,-0.4811014235019684f}, + {0.047732532024383545f,-0.0005002500838600099f,0.2062004953622818f,-0.49202707409858704f,-0.7950537204742432f,0.5808789134025574f,-0.3198729455471039f,-0.021581318229436874f,0.030888425186276436f,-0.4661758840084076f,0.3326369524002075f,-0.40172186493873596f,-0.3751802444458008f,-0.22362682223320007f,-0.36363548040390015f,-0.1590748429298401f}, + {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.005268699023872614f,0.17382051050662994f,-0.9704000353813171f,-0.3447703421115875f,0.17672207951545715f,0.20021501183509827f,0.07002416253089905f,-0.29103443026542664f,-0.39435261487960815f,0.13192829489707947f,0.41021624207496643f,-0.34153303503990173f,0.17057965695858002f,0.27040961384773254f,-0.5609870553016663f}, + {-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.04980236664414406f,-0.8650763630867004f,-0.5145219564437866f,-0.32554495334625244f,0.6611357927322388f,-0.18732719123363495f,0.22384825348854065f,-1.9989635944366455f,-0.31645265221595764f,-0.08919548988342285f,0.12389334291219711f,-0.7621546387672424f,0.4246171712875366f,0.5176900029182434f,-1.4521894454956055f}, + {0.4110594093799591f,0.2715781033039093f,-0.28422388434410095f,0.37246426939964294f,0.15203647315502167f,-0.09465086460113525f,-0.08670487999916077f,-0.25336313247680664f,-0.030661463737487793f,-0.06259563565254211f,-0.1344406008720398f,0.35313835740089417f,0.21155259013175964f,0.09161094576120377f,0.3126353323459625f,-0.3391006588935852f}, + {-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.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.3581882119178772f,0.048021938651800156f,0.001559896394610405f,-0.2978953719139099f,0.2191316783428192f,-0.08742031455039978f,0.05785742402076721f,-0.08406508713960648f,-0.34975606203079224f,0.1268840730190277f,-0.30447322130203247f,-0.10453349351882935f,-0.10472984611988068f,0.4355164170265198f,0.2022944986820221f}, + {-0.408692330121994f,-0.1563672423362732f,0.050031907856464386f,-0.0608118437230587f,-0.04799661040306091f,-0.17681097984313965f,0.03285527229309082f,0.38763079047203064f,-0.20705322921276093f,-0.25883403420448303f,0.12809070944786072f,0.03996849060058594f,-0.42210137844085693f,-0.23267120122909546f,-0.3349152207374573f,0.16666513681411743f}, + {-0.2991822361946106f,0.3794580399990082f,-0.07385820895433426f,-0.05301479622721672f,0.09207906574010849f,0.23433926701545715f,-0.11253207921981812f,0.34576353430747986f,0.04814547300338745f,-0.35770976543426514f,-0.044228196144104004f,-0.36229726672172546f,0.021879205480217934f,-0.14001017808914185f,0.36124154925346375f,-0.1589106321334839f}, + {-0.2675279378890991f,-0.2702247202396393f,-0.027820924296975136f,0.1762058138847351f,1.2094794511795044f,-0.49327564239501953f,-0.32875844836235046f,-0.9438692331314087f,-1.6906083822250366f,-0.7808446288108826f,-0.46338480710983276f,-0.49088165163993835f,0.32546529173851013f,-1.8672279119491577f,0.34107983112335205f,1.1565977334976196f}, + {-0.015470266342163086f,-0.411062091588974f,0.24327310919761658f,0.33764204382896423f,-0.04734501242637634f,-0.23505239188671112f,0.05196094512939453f,-0.008358269929885864f,-0.414988249540329f,-0.38441595435142517f,0.13179203867912292f,-0.11511552333831787f,0.14932915568351746f,0.10927555710077286f,0.07806598395109177f,-0.4222360849380493f}, + {0.1863725483417511f,-0.11428238451480865f,-0.8975226879119873f,-0.29820317029953003f,0.7560155987739563f,-2.0828094482421875f,0.04860696196556091f,0.14381852746009827f,-0.4302019774913788f,-0.03712918981909752f,-0.48258212208747864f,-0.003259873716160655f,0.0876874178647995f,0.22110247611999512f,-0.024374688044190407f,-0.4811014235019684f}, }; const float hout[16] = { 0.45773375034332275f,0.4260376989841461f,-0.28214895725250244f,-0.45515841245651245f,-0.6544750332832336f,1.6178936958312988f,0.0030125975608825684f,-0.10850305110216141f,0.40490925312042236f,-0.0290994793176651f,0.16892266273498535f,-0.16082262992858887f,-0.12769775092601776f,0.8889163732528687f,0.47501274943351746f,-1.023742914199829f }; @@ -575,7 +575,7 @@ ///////////////////////////Softplus////////////////////////////////// void update_Actor_Networks(float (*arr)[num_input_RL]) { - + float G_ha1[num_input_RL][num_hidden_unit1] = {0.0f}; float G_ba1[num_hidden_unit1] = {0.0f}; @@ -802,9 +802,8 @@ { float add = 0.0f; float result; - - for (int i=0; i<size; i++) - { + + for (int i=0; i<size; i++) { add += x[i]; } result = (float) add/size; @@ -814,15 +813,14 @@ { float sigma = 0.0f; float resultDeb = 0.0f; - - for (int k=0; k<size; k++) - { + + for (int k=0; k<size; k++) { sigma = pow((float)x[k]-mean_adv(x,size), (float)2.0f)/(size-1); resultDeb += sqrt(sigma); } return resultDeb; -} - +} + void Overwirte_Critic_Networks() { @@ -2492,11 +2490,11 @@ float Va = (1256.6f + Amm * pos.sen/(float)(ENC_PULSE_PER_POSITION)) * 0.000000001f; // 4mm pipe * 100mm + (25mm Cylinder 18mm Rod) * x, unit : m^3 float Vb = (1256.6f + Amm * (79.0f - pos.sen/(float)(ENC_PULSE_PER_POSITION))) * 0.000000001f; // 4mm pipe * 100mm + (25mm Cylinder 18mm Rod) * (79.0mm-x), unit : m^3 - + V_adapt = 1.0f / (1.0f/Va + 1.0f/Vb); //initial 0.0000053f - - float f3 = -Amm*Amm*beta*0.000001f*0.000001f/V_adapt * vel.sen/(float)(ENC_PULSE_PER_POSITION)*0.001f; // unit : N/s //xdot=10mm/s일때 -137076 + //float f3 = -Amm*Amm*beta*0.000001f*0.000001f/V_adapt * vel.sen/(float)(ENC_PULSE_PER_POSITION)*0.001f; // unit : N/s //xdot=10mm/s일때 -137076 + float f3_hat = -a_hat * vel.sen/(float)(ENC_PULSE_PER_POSITION)*0.001f; // unit : N/s //xdot=10mm/s일때 -137076 float g3_prime = 0.0f; if (torq.sen > Amm*(Ps-Pt)*0.000001f) { @@ -2537,7 +2535,7 @@ float k4 = 10.0f; float rho3 = 3.2f; float rho4 = 10000000.0f; //25000000.0f; - float x_4_des = (-f3 + torq_ref_dot - k3*(-torq.err))/(gamma_hat*g3_prime); + float x_4_des = (-f3_hat + 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; @@ -2555,13 +2553,20 @@ // 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; - +// 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; + + float rho_a = 0.00001f; + float a_hat_dot = -rho3/rho_a*vel.sen/(float)(ENC_PULSE_PER_POSITION)*0.001f*(-torq.err); + a_hat = a_hat + a_hat_dot / (float) TMR_FREQ_5k; + + if(a_hat > -3000000.0f) a_hat = -3000000.0f; + else if(a_hat < -30000000.0f) a_hat = -30000000.0f; + break; } @@ -2599,7 +2604,7 @@ virt_pos = virt_pos + (action_array[RL_timer] - 5.0f) * 1000.0f * 0.0002f; if (virt_pos > 70 ) { virt_pos = 70.0f; - }else if(virt_pos < -70) { + } else if(virt_pos < -70) { virt_pos = -70.0f; } @@ -2642,7 +2647,7 @@ virt_pos = virt_pos + (action-5.0f) * 1000.0f * 0.0002f; if (virt_pos > 70) { virt_pos = 70.0f; - }else if(virt_pos < -70) { + } else if(virt_pos < -70) { virt_pos = -70.0f; } @@ -2844,7 +2849,7 @@ 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) gamma_hat, (int16_t) 0, (int16_t) 0, (int16_t) 0); //1600 + CAN_TX_VALVE_POSITION((int16_t) (a_hat*0.0001f), (int16_t) 0, (int16_t) 0, (int16_t) 0); //1600 } // Others : Reference position, Reference FT, PWM, Current (ID:1300)