AP_Math: examples: rotations: add test for duplicate rotations.
This commit is contained in:
parent
f8220a8adf
commit
080f6c295c
@ -297,6 +297,19 @@ static void test_rotate_matrix(void)
|
|||||||
hal.console->printf("test_rotate_matrix passed\n");
|
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
|
* rotation tests
|
||||||
@ -305,12 +318,28 @@ void setup(void)
|
|||||||
{
|
{
|
||||||
hal.console->begin(115200);
|
hal.console->begin(115200);
|
||||||
hal.console->printf("rotation unit tests\n\n");
|
hal.console->printf("rotation unit tests\n\n");
|
||||||
|
|
||||||
test_rotation_accuracy();
|
test_rotation_accuracy();
|
||||||
|
hal.console->printf("\n\n");
|
||||||
|
|
||||||
test_eulers();
|
test_eulers();
|
||||||
|
hal.console->printf("\n\n");
|
||||||
|
|
||||||
missing_rotations();
|
missing_rotations();
|
||||||
|
hal.console->printf("\n\n");
|
||||||
|
|
||||||
test_rotate_inverse();
|
test_rotate_inverse();
|
||||||
|
hal.console->printf("\n\n");
|
||||||
|
|
||||||
test_rotate_matrix();
|
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");
|
hal.console->printf("rotation unit tests done\n\n");
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop(void) {}
|
void loop(void) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user