AP_Math: examples: rotations: add test for duplicate rotations.

This commit is contained in:
Iampete1 2021-07-23 20:46:43 +01:00 committed by Andrew Tridgell
parent f8220a8adf
commit 080f6c295c

View File

@ -297,6 +297,19 @@ static void test_rotate_matrix(void)
hal.console->printf("test_rotate_matrix passed\n");
}
static void test_rotation_duplicates(void)
{
for (enum Rotation r = (enum Rotation)((uint8_t)ROTATION_MAX-1); r > ROTATION_NONE; r = (enum Rotation)((uint8_t)r-1)) {
for (enum Rotation r2 = ROTATION_NONE; r2 < r; r2 = (enum Rotation)((uint8_t)r2+1)) {
if (rotation_equal(r,r2)) {
hal.console->printf("Rotation %i same as %i\n", r, r2);
}
}
}
hal.console->printf("test_rotation_duplicates done\n");
}
/*
* rotation tests
@ -305,12 +318,28 @@ void setup(void)
{
hal.console->begin(115200);
hal.console->printf("rotation unit tests\n\n");
test_rotation_accuracy();
hal.console->printf("\n\n");
test_eulers();
hal.console->printf("\n\n");
missing_rotations();
hal.console->printf("\n\n");
test_rotate_inverse();
hal.console->printf("\n\n");
test_rotate_matrix();
hal.console->printf("\n\n");
test_rotation_duplicates();
hal.console->printf("\n\n");
hal.console->printf("rotation unit tests done\n\n");
return;
}
void loop(void) {}