I am a beginner of MultiWii and now studying it with my poor programming
1. The data of the attitude and acceleration is collected and computed like:
Code: Select all
PTerm -= ((int32_t)gyroData[axis]*dynP8[axis])>>6; // 32 bits is needed for calculation
Could anyone tell me what is the physical unit for the gyroData? Degrees or 0.1 degrees or what?
2. If my understanding is right, both the function: angle[axis] and gyroData[axis] indicating the attitude of the flight. But why don't we use only gyroData[axis] to be computed as attitude?
I see the program using both angle[axis] and gyroData to derive PTerm :
Code: Select all
errorAngle = constrain((rcCommand[axis]<<1) + GPS_angle[axis],-500,+500) - angle[axis] + conf.angleTrim[axis]; //16 bits is ok here
PTermACC = ((int32_t)errorAngle*conf.P8[PIDLEVEL])>>7; // 32 bits is needed for calculation: errorAngle*P8[PIDLEVEL] could exceed 32768 16 bits is ok for result
PTermACC = constrain(PTermACC,-conf.D8[PIDLEVEL]*5,+conf.D8[PIDLEVEL]*5);
Code: Select all
PTerm -= ((int32_t)gyroData[axis]*dynP8[axis])>>6; // 32 bits is needed for calculation
What is the difference between these two?
Thank you guys for all your help!!!