/branches/dongfang_FC_rewrite/TODO-list.txt |
---|
0,0 → 1,2 |
- Check that yaw attitude mesaurement (excl. compass) and control (with the difference that H H can be turned off) are working just about as in H&I code. |
- Check that acc. mode looping is still complete and "safe" to use. |
/branches/dongfang_FC_rewrite/attitude.c |
---|
120,8 → 120,9 |
uint16_t badCompassHeading = 500; |
int32_t yawGyroHeading; // Yaw Gyro Integral supported by compass |
int32_t turnOver180 = GYRO_DEG_FACTOR_PITCHROLL * 180L; |
int32_t turnOver360 = GYRO_DEG_FACTOR_PITCHROLL * 360L; |
#define PITCHROLLOVER180 (GYRO_DEG_FACTOR_PITCHROLL * 180L) |
#define PITCHROLLOVER360 (GYRO_DEG_FACTOR_PITCHROLL * 360L) |
#define YAWOVER360 (GYRO_DEG_FACTOR_YAW * 360L) |
int32_t pitchCorrectionSum = 0, rollCorrectionSum = 0; |
137,8 → 138,8 |
* Set inclination angles from the acc. sensor data. |
* If acc. sensors are not used, set to zero. |
* TODO: One could use inverse sine to calculate the angles more |
* accurately, but sinc: 1) the angles are rather at times when it |
* makes sense to set the integrals (standing on ground, or flying at |
* accurately, but since: 1) the angles are rather small at times when |
* it makes sense to set the integrals (standing on ground, or flying at |
* constant speed, and 2) at small angles a, sin(a) ~= constant * a, |
* it is hardly worth the trouble. |
************************************************************************/ |
207,7 → 208,6 |
yawRate = yawGyro + dynamicOffsetYaw; |
// We are done reading variables from the analog module. Interrupt-driven sensor reading may restart. |
// TODO: Is that not a little early to measure for next control invocation? |
analogDataReady = 0; |
analog_start(); |
} |
307,17 → 307,17 |
*/ |
yawGyroHeading += ACYawRate; |
yawAngle += ACYawRate; |
if(yawGyroHeading >= (360L * GYRO_DEG_FACTOR_YAW)) yawGyroHeading -= 360L * GYRO_DEG_FACTOR_YAW; // 360 deg. wrap |
if(yawGyroHeading < 0) yawGyroHeading += 360L * GYRO_DEG_FACTOR_YAW; |
if(yawGyroHeading >= YAWOVER360) yawGyroHeading -= YAWOVER360; // 360 deg. wrap |
else if(yawGyroHeading < 0) yawGyroHeading += YAWOVER360; |
/* |
* Pitch axis integration and range boundary wrap. |
*/ |
pitchAngle += ACPitchRate; |
if(pitchAngle > turnOver180) { |
pitchAngle -= turnOver360; |
} else if (pitchAngle <= -turnOver180) { |
pitchAngle += turnOver360; |
if(pitchAngle > PITCHROLLOVER180) { |
pitchAngle -= PITCHROLLOVER360; |
} else if (pitchAngle <= -PITCHROLLOVER180) { |
pitchAngle += PITCHROLLOVER360; |
} |
/* |
324,10 → 324,10 |
* Pitch axis integration and range boundary wrap. |
*/ |
rollAngle += ACRollRate; |
if(rollAngle > turnOver180) { |
rollAngle -= turnOver360; |
} else if (rollAngle <= -turnOver180) { |
rollAngle += turnOver360; |
if(rollAngle > PITCHROLLOVER180) { |
rollAngle -= PITCHROLLOVER360; |
} else if (rollAngle <= -PITCHROLLOVER180) { |
rollAngle += PITCHROLLOVER360; |
} |
} |
/branches/dongfang_FC_rewrite/control.h |
---|
2,6 → 2,7 |
Stick control interface |
#######################################################################################*/ |
/* |
OBSOLETED BY controlMixer.h. But this is how it looked - maybe somebody will find it simpler? |
#ifndef _CONTROL_H |
#define _CONTROL_H |
/branches/dongfang_FC_rewrite/flight.h |
---|
12,7 → 12,7 |
extern uint8_t RequiredMotors; |
// looping params |
extern long TurnOver180Nick, TurnOver180Roll; |
// extern long TurnOver180Nick, TurnOver180Roll; |
// external control |
extern int16_t ExternStickNick, ExternStickRoll, ExternStickYaw; |
/branches/dongfang_FC_rewrite/readme.txt |
---|
5,6 → 5,7 |
Goal: |
- To be the preferred hacker-friendly FC firmware. |
- To use H&Is design experience but make the code clearer and easier to extend+modify. |
Non-goal: |
- To follow up on all changes and all new features in the H&I firmware. |
16,6 → 17,13 |
Global variables are (almost) only written to by one module each. |
- New or experimental hardware is easy to incorporate. Gyro and acc. meter axes are reversible, |
and resetting the sensitivity actually works. |
- New or experiemental controls are easy to incorporate. All controls (eg. R/C, external |
serial, NC, automatic emergency landing pilot and automatic altitude controller pilot) |
are potentially abstractable to one interface. |
- Reversal of gyro or accelerometer axes is easy. It is easy to adapt the firmware for |
upside down installation of the FC too. |
- The firmware is compatible with MK-Tool. This may be changed, if somebody writes a new |
MK-Tool which is easy to adapt for addition of / removal of features. |
Non-features (currently): |
- Navi support temporarily removed (should be added again later). |
27,4 → 35,11 |
- Automatic board detection removed. This firmware is for compiling yourself, possibly |
with nonstandard or experimental hardware. That conflicts with automatically switching |
between standard hardware versions, so the feature was removed. Instead, is was made |
easy to choose gyro types etc. in the makefile. |
easy to choose gyro types etc. in the makefile. |
How to build: |
- Choose a gyro definition, depending on your hardware, and enable it in the makefile |
and (GYRO=.....) and #include its header file in analog.h (how to make that follow the |
makefile automatically?). Currently, ENC-03_FC1.3, ADXRS610_FC2.0 and invenSense are |
supported (each has a .c and a .h file). |
- make all |