test refactoring
This commit is contained in:
parent
7f47cff1ed
commit
1d7f6045ec
|
|
@ -12,6 +12,28 @@ class BNO08xTestHelper
|
|||
static const constexpr char* TAG = "BNO08xTestHelper";
|
||||
|
||||
public:
|
||||
typedef struct imu_report_data_t
|
||||
{
|
||||
uint32_t time_stamp;
|
||||
|
||||
float quat_I;
|
||||
float quat_J;
|
||||
float quat_K;
|
||||
float quat_real;
|
||||
IMUAccuracy raw_quat_radian_accuracy;
|
||||
IMUAccuracy quat_accuracy;
|
||||
|
||||
float gyro_vel_x;
|
||||
float gyro_vel_y;
|
||||
float gyro_vel_z;
|
||||
|
||||
float accel_x;
|
||||
float accel_y;
|
||||
float accel_z;
|
||||
IMUAccuracy accel_accuracy;
|
||||
|
||||
} imu_report_data_t;
|
||||
|
||||
static void print_test_start_banner(const char* TEST_TAG)
|
||||
{
|
||||
printf("------------------------ BEGIN TEST: %s ------------------------\n\r", TEST_TAG);
|
||||
|
|
@ -93,4 +115,93 @@ class BNO08xTestHelper
|
|||
|
||||
return test_imu->launch_tasks();
|
||||
}
|
||||
|
||||
static bool rotation_vector_data_is_default(imu_report_data_t* report_data)
|
||||
{
|
||||
bool new_data = false;
|
||||
|
||||
if (report_data->quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->quat_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->raw_quat_radian_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
|
||||
return new_data;
|
||||
}
|
||||
|
||||
static bool gyro_integrated_rotation_vector_data_is_default(imu_report_data_t* report_data)
|
||||
{
|
||||
bool new_data = false;
|
||||
|
||||
if (report_data->quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->gyro_vel_x != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->gyro_vel_y != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->gyro_vel_z != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
return new_data;
|
||||
}
|
||||
|
||||
static bool accelerometer_data_is_default(imu_report_data_t* report_data)
|
||||
{
|
||||
bool new_data = false;
|
||||
|
||||
if (report_data->accel_x != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->accel_y != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->accel_z != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data->accel_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
|
||||
return new_data;
|
||||
}
|
||||
|
||||
static void update_report_data(imu_report_data_t* report_data, BNO08x* imu)
|
||||
{
|
||||
uint8_t accel_accuracy = 0;
|
||||
|
||||
report_data->quat_I = imu->get_quat_I();
|
||||
report_data->quat_J = imu->get_quat_J();
|
||||
report_data->quat_K = imu->get_quat_K();
|
||||
report_data->quat_real = imu->get_quat_real();
|
||||
report_data->raw_quat_radian_accuracy = static_cast<IMUAccuracy>(imu->get_raw_quat_radian_accuracy());
|
||||
report_data->quat_accuracy = static_cast<IMUAccuracy>(imu->get_quat_accuracy());
|
||||
|
||||
imu->get_gyro_velocity(report_data->gyro_vel_x, report_data->gyro_vel_y, report_data->gyro_vel_z);
|
||||
|
||||
imu->get_accel(report_data->accel_x, report_data->accel_y, report_data->accel_z, accel_accuracy);
|
||||
report_data->accel_accuracy = static_cast<IMUAccuracy>(accel_accuracy);
|
||||
}
|
||||
};
|
||||
|
|
@ -35,7 +35,7 @@ class BNO08xTestSuite
|
|||
print_begin_tests_banner("init_denit_tests");
|
||||
|
||||
UNITY_BEGIN();
|
||||
unity_run_tests_by_tag("[Init]", false);
|
||||
unity_run_tests_by_tag("[InitComprehensive]", false);
|
||||
unity_run_tests_by_tag("[InitDenit]", false);
|
||||
UNITY_END();
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ class BNO08xTestSuite
|
|||
print_begin_tests_banner("report_tests");
|
||||
|
||||
UNITY_BEGIN();
|
||||
unity_run_tests_by_tag("[ReportEnableDisable]", false);
|
||||
unity_run_tests_by_tag("[SingleReportEnableDisable]", false);
|
||||
UNITY_END();
|
||||
|
||||
print_end_tests_banner("report_tests");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "unity.h"
|
||||
#include "../include/BNO08xTestHelper.hpp"
|
||||
|
||||
TEST_CASE("Init Config Args", "[Init]")
|
||||
TEST_CASE("Init Config Args", "[InitComprehensive]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Init Config Args";
|
||||
BNO08x* imu = nullptr;
|
||||
|
|
@ -17,7 +17,7 @@ TEST_CASE("Init Config Args", "[Init]")
|
|||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
||||
TEST_CASE("Init GPIO", "[Init]")
|
||||
TEST_CASE("Init GPIO", "[InitComprehensive]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Init GPIO";
|
||||
BNO08x* imu = nullptr;
|
||||
|
|
@ -31,7 +31,7 @@ TEST_CASE("Init GPIO", "[Init]")
|
|||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
||||
TEST_CASE("Init HINT ISR", "[Init]")
|
||||
TEST_CASE("Init HINT ISR", "[InitComprehensive]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Init HINT_ISR";
|
||||
BNO08x* imu = nullptr;
|
||||
|
|
@ -45,7 +45,7 @@ TEST_CASE("Init HINT ISR", "[Init]")
|
|||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
||||
TEST_CASE("Init SPI", "[Init]")
|
||||
TEST_CASE("Init SPI", "[InitComprehensive]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Init SPI";
|
||||
BNO08x* imu = nullptr;
|
||||
|
|
@ -59,7 +59,7 @@ TEST_CASE("Init SPI", "[Init]")
|
|||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
||||
TEST_CASE("Init Tasks", "[Init]")
|
||||
TEST_CASE("InitComprehensive Tasks", "[InitComprehensive]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Init Tasks";
|
||||
BNO08x* imu = nullptr;
|
||||
|
|
@ -73,7 +73,7 @@ TEST_CASE("Init Tasks", "[Init]")
|
|||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
||||
TEST_CASE("Finish Init", "[Init]")
|
||||
TEST_CASE("Finish Init", "[InitComprehensive]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Finish Init";
|
||||
BNO08x* imu = nullptr;
|
||||
|
|
|
|||
|
|
@ -3,50 +3,11 @@
|
|||
|
||||
static const constexpr uint8_t RX_REPORT_TRIAL_CNT = 5;
|
||||
|
||||
typedef struct imu_report_data_t
|
||||
{
|
||||
uint32_t time_stamp;
|
||||
|
||||
float quat_I;
|
||||
float quat_J;
|
||||
float quat_K;
|
||||
float quat_real;
|
||||
IMUAccuracy raw_quat_radian_accuracy;
|
||||
IMUAccuracy quat_accuracy;
|
||||
|
||||
float gyro_vel_x;
|
||||
float gyro_vel_y;
|
||||
float gyro_vel_z;
|
||||
|
||||
float accel_x;
|
||||
float accel_y;
|
||||
float accel_z;
|
||||
IMUAccuracy accel_accuracy;
|
||||
|
||||
} imu_report_data_t;
|
||||
|
||||
void update_report_data(imu_report_data_t* report_data, BNO08x* imu)
|
||||
{
|
||||
uint8_t accel_accuracy = 0;
|
||||
|
||||
report_data->quat_I = imu->get_quat_I();
|
||||
report_data->quat_J = imu->get_quat_J();
|
||||
report_data->quat_K = imu->get_quat_K();
|
||||
report_data->quat_real = imu->get_quat_real();
|
||||
report_data->raw_quat_radian_accuracy = static_cast<IMUAccuracy>(imu->get_raw_quat_radian_accuracy());
|
||||
report_data->quat_accuracy = static_cast<IMUAccuracy>(imu->get_quat_accuracy());
|
||||
|
||||
imu->get_gyro_velocity(report_data->gyro_vel_x, report_data->gyro_vel_y, report_data->gyro_vel_z);
|
||||
|
||||
imu->get_accel(report_data->accel_x, report_data->accel_y, report_data->accel_z, accel_accuracy);
|
||||
report_data->accel_accuracy = static_cast<IMUAccuracy>(accel_accuracy);
|
||||
}
|
||||
|
||||
TEST_CASE("Enable/Disable Rotation Vector", "[ReportEnableDisable]")
|
||||
TEST_CASE("Enable/Disable Rotation Vector", "[SingleReportEnableDisable]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Enable/Disable Rotation Vector";
|
||||
BNO08x* imu = nullptr;
|
||||
imu_report_data_t report_data;
|
||||
BNO08xTestHelper::imu_report_data_t report_data;
|
||||
bool new_data = false;
|
||||
char msg_buff[200] = {};
|
||||
|
||||
|
|
@ -61,7 +22,7 @@ TEST_CASE("Enable/Disable Rotation Vector", "[ReportEnableDisable]")
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
|
||||
/*enable respective report to test and ensure it reports new data */
|
||||
|
|
@ -73,30 +34,13 @@ TEST_CASE("Enable/Disable Rotation Vector", "[ReportEnableDisable]")
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
// if the accuracy still contains its default value, something has gone wrong, a defined accuracy should be received with every report
|
||||
if (report_data.quat_accuracy == IMUAccuracy::UNDEFINED)
|
||||
new_data = false;
|
||||
|
||||
if (report_data.raw_quat_radian_accuracy == IMUAccuracy::UNDEFINED)
|
||||
new_data = false;
|
||||
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert whether new data was received or not
|
||||
// assert that new data from respective report has been received
|
||||
TEST_ASSERT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff, "Enabled Report Rx Data Trial %d Success: I: %.2lf J: %.2lf K: %.2lf real: %.2lf", (i + 1), report_data.quat_I,
|
||||
|
|
@ -105,7 +49,7 @@ TEST_CASE("Enable/Disable Rotation Vector", "[ReportEnableDisable]")
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
|
||||
|
|
@ -117,33 +61,15 @@ TEST_CASE("Enable/Disable Rotation Vector", "[ReportEnableDisable]")
|
|||
{
|
||||
new_data = false;
|
||||
|
||||
// use "true" argument to force wait for data even if no reports are enabled
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
// if the accuracy does not contain its default value, something has gone wrong, respective report should be disabled
|
||||
if (report_data.quat_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.raw_quat_radian_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert that no new data from this report has been received
|
||||
// assert that no new data from respective report has been received
|
||||
TEST_ASSERT_NOT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff, "Disabled Report No Rx Data Trial %d Success", (i + 1));
|
||||
|
|
@ -151,7 +77,7 @@ TEST_CASE("Enable/Disable Rotation Vector", "[ReportEnableDisable]")
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
|
||||
|
|
@ -159,11 +85,11 @@ TEST_CASE("Enable/Disable Rotation Vector", "[ReportEnableDisable]")
|
|||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
||||
TEST_CASE("Enable/Disable Game Rotation Vector", "[ReportEnableDisable]")
|
||||
TEST_CASE("Enable/Disable Game Rotation Vector", "[SingleReportEnableDisable]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Enable/Disable Game Rotation Vector";
|
||||
BNO08x* imu = nullptr;
|
||||
imu_report_data_t report_data;
|
||||
BNO08xTestHelper::imu_report_data_t report_data;
|
||||
bool new_data = false;
|
||||
char msg_buff[200] = {};
|
||||
|
||||
|
|
@ -173,7 +99,7 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[ReportEnableDisable]")
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
|
||||
/*enable respective report to test and ensure it reports new data */
|
||||
|
|
@ -185,30 +111,13 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[ReportEnableDisable]")
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
// if the accuracy still contains its default value, something has gone wrong, a defined accuracy should be received with every report
|
||||
if (report_data.quat_accuracy == IMUAccuracy::UNDEFINED)
|
||||
new_data = false;
|
||||
|
||||
if (report_data.raw_quat_radian_accuracy == IMUAccuracy::UNDEFINED)
|
||||
new_data = false;
|
||||
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert whether new data was received or not
|
||||
// assert that new data from respective report has been received
|
||||
TEST_ASSERT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff, "Enabled Report Rx Data Trial %d Success: I: %.2lf J: %.2lf K: %.2lf real: %.2lf", (i + 1), report_data.quat_I,
|
||||
|
|
@ -217,7 +126,7 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[ReportEnableDisable]")
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
|
||||
|
|
@ -231,30 +140,13 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[ReportEnableDisable]")
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
// if the accuracy does not contain its default value, something has gone wrong, respective report should be disabled
|
||||
if (report_data.quat_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.raw_quat_radian_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert that no new data from this report has been received
|
||||
// assert that no new data from respective report has been received
|
||||
TEST_ASSERT_NOT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff, "Disabled Report No Rx Data Trial %d Success", (i + 1));
|
||||
|
|
@ -262,7 +154,7 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[ReportEnableDisable]")
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
|
||||
|
|
@ -270,11 +162,11 @@ TEST_CASE("Enable/Disable Game Rotation Vector", "[ReportEnableDisable]")
|
|||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
||||
TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[ReportEnableDisable]")
|
||||
TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[SingleReportEnableDisable]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Enable/Disable ARVR Stabilized Rotation Vector";
|
||||
BNO08x* imu = nullptr;
|
||||
imu_report_data_t report_data;
|
||||
BNO08xTestHelper::imu_report_data_t report_data;
|
||||
bool new_data = false;
|
||||
char msg_buff[200] = {};
|
||||
|
||||
|
|
@ -284,7 +176,7 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[ReportEnableDisabl
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
|
||||
/*enable respective report to test and ensure it reports new data */
|
||||
|
|
@ -296,30 +188,13 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[ReportEnableDisabl
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
// if the accuracy still contains its default value, something has gone wrong, a defined accuracy should be received with every report
|
||||
if (report_data.quat_accuracy == IMUAccuracy::UNDEFINED)
|
||||
new_data = false;
|
||||
|
||||
if (report_data.raw_quat_radian_accuracy == IMUAccuracy::UNDEFINED)
|
||||
new_data = false;
|
||||
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert whether new data was received or not
|
||||
// assert that new data from respective report has been received
|
||||
TEST_ASSERT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff, "Enabled Report Rx Data Trial %d Success: I: %.2lf J: %.2lf K: %.2lf real: %.2lf", (i + 1), report_data.quat_I,
|
||||
|
|
@ -328,7 +203,7 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[ReportEnableDisabl
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
|
||||
|
|
@ -342,30 +217,14 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[ReportEnableDisabl
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
// if the accuracy does not contain its default value, something has gone wrong, respective report should be disabled
|
||||
if (report_data.quat_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.raw_quat_radian_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert that no new data from this report has been received
|
||||
// assert that no new data from respective report has been received
|
||||
TEST_ASSERT_NOT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff, "Disabled Report No Rx Data Trial %d Success", (i + 1));
|
||||
|
|
@ -373,7 +232,7 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[ReportEnableDisabl
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
|
||||
|
|
@ -381,11 +240,11 @@ TEST_CASE("Enable/Disable ARVR Stabilized Rotation Vector", "[ReportEnableDisabl
|
|||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
||||
TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[ReportEnableDisable]")
|
||||
TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[SingleReportEnableDisable]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Enable/Disable ARVR Stabilized Game Rotation Vector";
|
||||
BNO08x* imu = nullptr;
|
||||
imu_report_data_t report_data;
|
||||
BNO08xTestHelper::imu_report_data_t report_data;
|
||||
bool new_data = false;
|
||||
char msg_buff[200] = {};
|
||||
|
||||
|
|
@ -395,7 +254,7 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[ReportEnableD
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
|
||||
/*enable respective report to test and ensure it reports new data */
|
||||
|
|
@ -407,30 +266,13 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[ReportEnableD
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
// if the accuracy still contains its default value, something has gone wrong, a defined accuracy should be received with every report
|
||||
if (report_data.quat_accuracy == IMUAccuracy::UNDEFINED)
|
||||
new_data = false;
|
||||
|
||||
if (report_data.raw_quat_radian_accuracy == IMUAccuracy::UNDEFINED)
|
||||
new_data = false;
|
||||
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert whether new data was received or not
|
||||
// assert that new data from respective report has been received
|
||||
TEST_ASSERT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff, "Enabled Report Rx Data Trial %d Success: I: %.2lf J: %.2lf K: %.2lf real: %.2lf", (i + 1), report_data.quat_I,
|
||||
|
|
@ -439,7 +281,7 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[ReportEnableD
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
|
||||
|
|
@ -453,30 +295,13 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[ReportEnableD
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
// if the accuracy does not contain its default value, something has gone wrong, respective report should be disabled
|
||||
if (report_data.quat_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.raw_quat_radian_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
new_data = BNO08xTestHelper::rotation_vector_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert that no new data from this report has been received
|
||||
// assert that no new data from respective report has been received
|
||||
TEST_ASSERT_NOT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff, "Disabled Report No Rx Data Trial %d Success", (i + 1));
|
||||
|
|
@ -484,7 +309,7 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[ReportEnableD
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
|
||||
|
|
@ -492,11 +317,11 @@ TEST_CASE("Enable/Disable ARVR Stabilized Game Rotation Vector", "[ReportEnableD
|
|||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
||||
TEST_CASE("Enable/Disable Gyro Integrated Roation Vector", "[ReportEnableDisable]")
|
||||
TEST_CASE("Enable/Disable Gyro Integrated Roation Vector", "[SingleReportEnableDisable]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Enable/Disable Gyro Integrated Roation Vector";
|
||||
BNO08x* imu = nullptr;
|
||||
imu_report_data_t report_data;
|
||||
BNO08xTestHelper::imu_report_data_t report_data;
|
||||
bool new_data = false;
|
||||
char msg_buff[200] = {};
|
||||
|
||||
|
|
@ -506,7 +331,7 @@ TEST_CASE("Enable/Disable Gyro Integrated Roation Vector", "[ReportEnableDisable
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
|
||||
/*enable respective report to test and ensure it reports new data */
|
||||
|
|
@ -518,32 +343,13 @@ TEST_CASE("Enable/Disable Gyro Integrated Roation Vector", "[ReportEnableDisable
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.gyro_vel_x != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.gyro_vel_y != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.gyro_vel_z != 0.0f)
|
||||
new_data = true;
|
||||
new_data = BNO08xTestHelper::gyro_integrated_rotation_vector_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert whether new data was received or not
|
||||
// assert that new data from respective report has been received
|
||||
TEST_ASSERT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff,
|
||||
|
|
@ -555,7 +361,7 @@ TEST_CASE("Enable/Disable Gyro Integrated Roation Vector", "[ReportEnableDisable
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
|
||||
|
|
@ -569,32 +375,13 @@ TEST_CASE("Enable/Disable Gyro Integrated Roation Vector", "[ReportEnableDisable
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.quat_I != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_J != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_K != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.quat_real != 1.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.gyro_vel_x != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.gyro_vel_y != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.gyro_vel_z != 0.0f)
|
||||
new_data = true;
|
||||
new_data = BNO08xTestHelper::gyro_integrated_rotation_vector_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert that no new data from this report has been received
|
||||
// assert that no new data from respective report has been received
|
||||
TEST_ASSERT_NOT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff, "Disabled Report No Rx Data Trial %d Success", (i + 1));
|
||||
|
|
@ -602,7 +389,7 @@ TEST_CASE("Enable/Disable Gyro Integrated Roation Vector", "[ReportEnableDisable
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
|
||||
|
|
@ -610,11 +397,11 @@ TEST_CASE("Enable/Disable Gyro Integrated Roation Vector", "[ReportEnableDisable
|
|||
BNO08xTestHelper::print_test_end_banner(TEST_TAG);
|
||||
}
|
||||
|
||||
TEST_CASE("Enable/Disable Accelerometer", "[ReportEnableDisable]")
|
||||
TEST_CASE("Enable/Disable Accelerometer", "[SingleReportEnableDisable]")
|
||||
{
|
||||
const constexpr char* TEST_TAG = "Enable/Disable Accelerometer";
|
||||
BNO08x* imu = nullptr;
|
||||
imu_report_data_t report_data;
|
||||
BNO08xTestHelper::imu_report_data_t report_data;
|
||||
bool new_data = false;
|
||||
char msg_buff[200] = {};
|
||||
|
||||
|
|
@ -624,7 +411,7 @@ TEST_CASE("Enable/Disable Accelerometer", "[ReportEnableDisable]")
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase started.");
|
||||
/*enable respective report to test and ensure it reports new data */
|
||||
|
|
@ -636,24 +423,13 @@ TEST_CASE("Enable/Disable Accelerometer", "[ReportEnableDisable]")
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.accel_x != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.accel_y != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.accel_z != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
// if the accuracy still contains its default value, something has gone wrong, a defined accuracy should be received with every report
|
||||
if (report_data.accel_accuracy == IMUAccuracy::UNDEFINED)
|
||||
new_data = false;
|
||||
new_data = BNO08xTestHelper::accelerometer_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert whether new data was received or not
|
||||
// assert that new data from respective report has been received
|
||||
TEST_ASSERT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff,
|
||||
|
|
@ -664,7 +440,7 @@ TEST_CASE("Enable/Disable Accelerometer", "[ReportEnableDisable]")
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report enabled testing phase completed.");
|
||||
|
|
@ -678,24 +454,13 @@ TEST_CASE("Enable/Disable Accelerometer", "[ReportEnableDisable]")
|
|||
|
||||
if (imu->data_available())
|
||||
{
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
|
||||
// check if any default values have been overwritten, implying new data from respective report
|
||||
if (report_data.accel_x != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.accel_y != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
if (report_data.accel_z != 0.0f)
|
||||
new_data = true;
|
||||
|
||||
// if the accuracy does not contain its default value, something has gone wrong, respective report should be disabled
|
||||
if (report_data.accel_accuracy != IMUAccuracy::UNDEFINED)
|
||||
new_data = true;
|
||||
new_data = BNO08xTestHelper::accelerometer_data_is_default(&report_data);
|
||||
}
|
||||
|
||||
// assert that no new data from this report has been received
|
||||
// assert that no new data from respective report has been received
|
||||
TEST_ASSERT_NOT_EQUAL(true, new_data);
|
||||
|
||||
sprintf(msg_buff, "Disabled Report No Rx Data Trial %d Success", (i + 1));
|
||||
|
|
@ -703,7 +468,7 @@ TEST_CASE("Enable/Disable Accelerometer", "[ReportEnableDisable]")
|
|||
|
||||
// reset all data used in report test
|
||||
imu->reset_all_data();
|
||||
update_report_data(&report_data, imu);
|
||||
BNO08xTestHelper::update_report_data(&report_data, imu);
|
||||
}
|
||||
|
||||
BNO08xTestHelper::print_test_msg(TEST_TAG, "Report disabled testing phase completed.");
|
||||
Loading…
Reference in New Issue