4,7 → 4,7 |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur f�r den privaten und nicht-kommerziellen Gebrauch zulässig ist. |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten und nicht-kommerziellen Gebrauch zulässig ist. |
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
// + bzgl. der Nutzungsbedingungen aufzunehmen. |
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
134,6 → 134,9 |
* 7: pp=-1,pr=1, rp=1, rr=1 // +315 degrees with pitch reversed |
*/ |
|
void rotate(int16_t* result, uint8_t quadrant, uint8_t reverse) {} |
|
/* |
void rotate(int16_t* result, uint8_t quadrant, uint8_t reverse) { |
static const int8_t rotationTab[] = {1,1,0,-1,-1,-1,0,1}; |
// Pitch to Pitch part |
158,7 → 161,7 |
result[1] = (result[1]*11) >> 4; |
} |
} |
|
*/ |
/* |
* Air pressure |
*/ |
301,6 → 304,7 |
|
void startAnalogConversionCycle(void) { |
analogDataReady = 0; |
|
// Stop the sampling. Cycle is over. |
for (uint8_t i = 0; i < 8; i++) { |
sensorInputs[i] = 0; |
340,7 → 344,6 |
debugOut.digital[0] &= ~DEBUG_SENSORLIMIT; |
for (uint8_t axis=0; axis<2; axis++) { |
tempGyro = rawGyroValue(axis); |
|
/* |
* Process the gyro data for the PID controller. |
*/ |
386,6 → 389,15 |
*/ |
rotate(tempOffsetGyro, staticParams.gyroQuadrant, staticParams.imuReversedFlags & 1); |
|
gyro_ATT[PITCH] = tempOffsetGyro[PITCH]; |
gyro_ATT[ROLL] = tempOffsetGyro[ROLL]; |
|
debugOut.analog[22 + 0] = gyro_PID[0]; |
debugOut.analog[22 + 1] = gyro_PID[1]; |
|
debugOut.analog[24 + 0] = gyro_ATT[0]; |
debugOut.analog[24 + 1] = gyro_ATT[1]; |
|
// 2) Filter. This should really be quite unnecessary. The integration should gobble up any noise anyway and the values are not used for anything else. |
// gyro_ATT[PITCH] = (gyro_ATT[PITCH] * (staticParams.attitudeGyroFilter - 1) + tempOffsetGyro[PITCH]) / staticParams.attitudeGyroFilter; |
// gyro_ATT[ROLL] = (gyro_ATT[ROLL] * (staticParams.attitudeGyroFilter - 1) + tempOffsetGyro[ROLL]) / staticParams.attitudeGyroFilter; |