1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

HEADFREE true 3D (second edition)...

reduced memory footprint ...
	rebased squashed cleanup
This commit is contained in:
Adrian Miriuta 2017-09-22 18:56:45 +02:00
parent 36a6cfc2b1
commit 7146c40ca8
11 changed files with 181 additions and 92 deletions

View file

@ -96,7 +96,8 @@ cms_unittest_SRC := \
common_filter_unittest_SRC := \
$(USER_DIR)/common/filter.c
$(USER_DIR)/common/filter.c \
$(USER_DIR)/common/maths.c
encoding_unittest_SRC := \

View file

@ -404,4 +404,5 @@ extern "C" {
void changePidProfile(uint8_t) {}
void dashboardEnablePageCycling(void) {}
void dashboardDisablePageCycling(void) {}
bool imuQuaternionHeadfreeOffsetSet(void) { return true; }
}

View file

@ -56,7 +56,7 @@ extern "C" {
void imuComputeRotationMatrix(void);
void imuUpdateEulerAngles(void);
extern float q0, q1, q2, q3;
extern quaternion q;
extern float rMat[3][3];
PG_REGISTER(rcControlsConfig_t, rcControlsConfig, PG_RC_CONTROLS_CONFIG, 0);
@ -79,10 +79,10 @@ TEST(FlightImuTest, TestCalculateRotationMatrix)
#define TOL 1e-6
// No rotation
q0 = 1.0f;
q1 = 0.0f;
q2 = 0.0f;
q3 = 0.0f;
q.w = 1.0f;
q.x = 0.0f;
q.y = 0.0f;
q.z = 0.0f;
imuComputeRotationMatrix();
@ -97,10 +97,10 @@ TEST(FlightImuTest, TestCalculateRotationMatrix)
EXPECT_FLOAT_EQ(1.0f, rMat[2][2]);
// 90 degrees around Z axis
q0 = sqrt2over2;
q1 = 0.0f;
q2 = 0.0f;
q3 = sqrt2over2;
q.w = sqrt2over2;
q.x = 0.0f;
q.y = 0.0f;
q.z = sqrt2over2;
imuComputeRotationMatrix();
@ -115,10 +115,10 @@ TEST(FlightImuTest, TestCalculateRotationMatrix)
EXPECT_NEAR(1.0f, rMat[2][2], TOL);
// 60 degrees around X axis
q0 = 0.866f;
q1 = 0.5f;
q2 = 0.0f;
q3 = 0.0f;
q.w = 0.866f;
q.x = 0.5f;
q.y = 0.0f;
q.z = 0.0f;
imuComputeRotationMatrix();