From ba3325ffd3c225450957c8aef46d2e8a3dd8df43 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Mon, 28 Dec 2015 16:23:18 -0200 Subject: [PATCH] AP_Math: rename rotation The rotations are supposed to follow the name of the enum, in order. The ROTATION_YAW_293_PITCH_68_ROLL_90 was added with the name of an intrinsic 321 rotation, but the matrix is actually a 123 rotation, following the other rotations already present. Change the name to follow the other names. --- libraries/AP_Math/examples/rotations/rotations.cpp | 2 +- libraries/AP_Math/rotations.h | 2 +- libraries/AP_Math/tests/test_vectors.cpp | 2 +- libraries/AP_Math/vector3.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/AP_Math/examples/rotations/rotations.cpp b/libraries/AP_Math/examples/rotations/rotations.cpp index 3a16d35dbf..4277a961d6 100644 --- a/libraries/AP_Math/examples/rotations/rotations.cpp +++ b/libraries/AP_Math/examples/rotations/rotations.cpp @@ -140,7 +140,7 @@ static void test_eulers(void) test_euler(ROTATION_ROLL_270_PITCH_270,270,270, 0); test_euler(ROTATION_ROLL_90_PITCH_180_YAW_90, 90, 180, 90); test_euler(ROTATION_ROLL_90_YAW_270, 90, 0, 270); - test_euler(ROTATION_YAW_293_PITCH_68_ROLL_90,90,68.8,293.3); + test_euler(ROTATION_ROLL_90_PITCH_68_YAW_293,90,68.8,293.3); } static bool have_rotation(const Matrix3f &m) diff --git a/libraries/AP_Math/rotations.h b/libraries/AP_Math/rotations.h index 404f31dc5c..b327d03532 100644 --- a/libraries/AP_Math/rotations.h +++ b/libraries/AP_Math/rotations.h @@ -64,7 +64,7 @@ enum Rotation { ROTATION_ROLL_270_PITCH_270 = 35, ROTATION_ROLL_90_PITCH_180_YAW_90 = 36, ROTATION_ROLL_90_YAW_270 = 37, - ROTATION_YAW_293_PITCH_68_ROLL_90 = 38, + ROTATION_ROLL_90_PITCH_68_YAW_293 = 38, ROTATION_MAX }; /* diff --git a/libraries/AP_Math/tests/test_vectors.cpp b/libraries/AP_Math/tests/test_vectors.cpp index 94a20021be..01ec43b5a7 100644 --- a/libraries/AP_Math/tests/test_vectors.cpp +++ b/libraries/AP_Math/tests/test_vectors.cpp @@ -53,7 +53,7 @@ TEST(VectorTest, Rotations) TEST_ROTATION(ROTATION_ROLL_270_PITCH_270, 1, 1, 1); TEST_ROTATION(ROTATION_ROLL_90_PITCH_180_YAW_90, 1, -1, -1); TEST_ROTATION(ROTATION_ROLL_90_YAW_270, -1, -1, 1); - TEST_ROTATION(ROTATION_YAW_293_PITCH_68_ROLL_90, -0.4118548f, -1.58903555f, -0.55257726f); + TEST_ROTATION(ROTATION_ROLL_90_PITCH_68_YAW_293, -0.4118548f, -1.58903555f, -0.55257726f); EXPECT_EQ(ROTATION_MAX, rotation_count) << "All rotations are expect to be tested"; } diff --git a/libraries/AP_Math/vector3.cpp b/libraries/AP_Math/vector3.cpp index be95f6380b..b909511760 100644 --- a/libraries/AP_Math/vector3.cpp +++ b/libraries/AP_Math/vector3.cpp @@ -223,7 +223,7 @@ void Vector3::rotate(enum Rotation rotation) tmp = x; x = y; y = -tmp; return; } - case ROTATION_YAW_293_PITCH_68_ROLL_90: { + case ROTATION_ROLL_90_PITCH_68_YAW_293: { float tmpx = x; float tmpy = y; float tmpz = z;