![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 1 Pomógł: 0 Dołączył: 1.03.2014 Ostrzeżenie: (0%) ![]() ![]() |
Witam,
Mam nadzieję że temat nie odbiega mocno od tematyki strony. Program poniższy po debugowaniu wykonuje obliczenia. Po kilkukrotnym przejściu i otrzymaniu odpowiedzi w consoli ukazuje się następujący kod: Cytat timers.js:103 if (!process.listeners('uncaughtException').length) throw e; ^ Error: EAGAIN, no more processes To jest następujący kod programu; Cytat var b = require('bonescript'); var k = 63; var f = 174.5; var re = 130; var rf = 119.5; var sqrt3 = Math.sqrt(3); var sin120 = sqrt3/2.0; var cos120 = -0.5; var duty_min = 0.1250; b.pinMode('P9_14', b.OUTPUT); b.pinMode('P9_14', b.OUTPUT); b.pinMode('P9_14', b.OUTPUT); check(); function check(){ var analogone =(120*b.analogRead('P9_40')-60).toFixed(2); var analogtwo =(120*b.analogRead('P9_39')-60).toFixed(2); var analogthree =(80*b.analogRead('P9_38')-180).toFixed(2); console.log([analogone,analogtwo,analogthree]); calcinverse(analogone,analogtwo,analogthree); } function updateDuty(thetaone,thetatwo,thetathree) { var duty_cycleone = (thetaone*(-0.0006944))+duty_min; var duty_cycletwo = (thetatwo*(-0.0006944)) + duty_min; var duty_cyclethree = (thetathree*(-0.0006944)) + duty_min; b.analogWrite('P9_14', duty_cycleone, 60); b.analogWrite('P9_21', duty_cycletwo, 60); b.analogWrite('P8_13', duty_cyclethree, 60); console.log([duty_cycleone,duty_cycletwo,duty_cyclethree]); check(); } function theta(x0,y0,z0) { var y1 = (-0.5) * 0.57735 * f; var y2 = y0 - (0.5 * 0.57735 * k); var a = (x0*x0 + y2*y2 + z0*z0 +rf*rf - re*re - y1*y1)/(2*z0); var b = (y1-y2)/z0; var d = -(a+b*y1)*(a+b*y1)+rf*(b*b*rf+rf); if (d.value < 0) { return; } var yj = (y1 - a*b - Math.sqrt(d))/(b*b + 1); var zj = a + b*yj; var h; if (yj>y1) { h=180; } else { h=0; } var thetaa = (180.0*Math.atan(-zj/(y1 - yj))/Math.PI)+h ; return thetaa; } function calcinverse(x0, y0, z0) { var thetaone =theta(x0,y0,z0); var thetatwo= theta(x0*cos120 + y0*sin120, y0*cos120-x0*sin120, z0); var thetathree= theta(x0*cos120 - y0*sin120, y0*cos120+x0*sin120, z0); console.log([thetaone,thetatwo,thetathree]); updateDuty(thetaone,thetatwo,thetathree); } Do debugowania używam cloud9 IDE. |
|
|
![]() ![]() |
![]() |
Aktualny czas: 22.08.2025 - 00:55 |