I am measuring acceleration continuously using keil mcbstm32f4 development kit and calculating the time dt for integrating acceleration to get velocity. Velocity= summation of a*dt.Since dt is very small=8.3us between 2 acceleration measurements.The code for calculation is attached . I am performing these calculations in a loop continuosly but in real time the velocity is not showing correct, for example in z axis for 9.8 m/s2 or 1g it should show 9.8x1=9.8m/s velocity but it is increasing very slowly as the stm32f400 is not able to do that many calculations (1/8.3us=1000000/8.3 =calculations) fastly in 1 s. So i want to know how to increase the speed of operation by utilizing all the cores.
while (1) { float x1=(acc.x * 25/1000)/2.4489;///2.4489; float angx1=(ang.x * 25/1250); float y1=(acc.y * 25/1000)/2.4489;///2.4489; float angy1=(ang.y * 25/1250); float z1=(acc.z * 25/1000)/2.4489;///2.4489; float angz1=(ang.z * 25/1250); float x2=(acc.x * 25/1000)/2.4489; float y2=(acc.y * 25/1000)/2.4489; float z2=(acc.z * 25/1000)/2.4489; float x3=(acc.x * 25/1000)/2.4489; float y3=(acc.y * 25/1000)/2.4489; float z3=(acc.z * 25/1000)/2.4489; // float navgx=0; navgx=(x1+x2+x3)/6; float navgy=0; navgy=(y1+y2+y3)/3; float navgz=0; navgz=(z1+z2+z3)/3; velx=velx+(navgx*0.000083); vely=vely+(navgy*0.000083); velz=velz+((navgz-9.81)*0.000083); }
Yeah thanks for resolving my doubts but still the main problem needs unsolved that is how to speed up calcultions.If the while (superloop) take 0.1s for execution for example it should be able to do 1/0.1 =10 calculations in 1sec.Please refer to the initial post for more details.