From 5b549b2c222b4b0f5bd2f5f504de6ee27dba6395 Mon Sep 17 00:00:00 2001 From: Grace Lu Date: Sat, 20 Jan 2024 01:15:32 -0500 Subject: [PATCH 1/5] Updated Imu::is_calibrating function --- src/devices/vdml_imu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/vdml_imu.cpp b/src/devices/vdml_imu.cpp index 948c1294f..f4eddf3f3 100644 --- a/src/devices/vdml_imu.cpp +++ b/src/devices/vdml_imu.cpp @@ -62,7 +62,7 @@ pros::c::imu_status_e_t Imu::get_status() const { } bool Imu::is_calibrating() const { - return get_status() & pros::c::E_IMU_STATUS_CALIBRATING; + return get_status() == pros::c::E_IMU_STATUS_CALIBRATING; } std::int32_t Imu::tare_heading() const { From f703407a0ab5965ac5b565e8d94ee39bd78018d6 Mon Sep 17 00:00:00 2001 From: Grace Lu Date: Thu, 25 Jan 2024 20:30:47 -0500 Subject: [PATCH 2/5] Update main.cpp --- src/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index c2fbbf539..8a3372592 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -88,6 +88,21 @@ void opcontrol() { left_mtr = left; right_mtr = right; + // Instantiate the IMU on port where is not connected + printf("Imu 1: \n"); + pros::Imu imu(3); + // Call Imu::is_calibrating() to check if function is working + // Will return true if calibrating, false if not + printf("Imu::is_calibrating() = %d\n", imu.is_calibrating()); + // Instantiate the IMU on port where is connected + printf("Imu 2: \n"); + pros::Imu imu2(11); + // Calibrate the IMU, no blocking + imu2.reset(); + // Call Imu::is_calibrating() to check if function is working + // Will return true if calibrating, false if not + printf("Imu::is_calibrating() = %d\n", imu2.is_calibrating()); + pros::delay(20); } } From b50699d2f4ab9b18371a795f2eb85862da7c8b0c Mon Sep 17 00:00:00 2001 From: Grace Lu Date: Thu, 1 Feb 2024 20:54:38 -0500 Subject: [PATCH 3/5] Updated enum for imu_status_e Update to properly reflect what get_status returns --- include/pros/imu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/pros/imu.h b/include/pros/imu.h index f5a1cdc3d..c38d9b8c8 100644 --- a/include/pros/imu.h +++ b/include/pros/imu.h @@ -29,7 +29,8 @@ namespace c { #endif typedef enum imu_status_e { - E_IMU_STATUS_CALIBRATING = 0x01, + E_IMU_STATUS_READY = 0, + E_IMU_STATUS_CALIBRATING = 19, E_IMU_STATUS_ERROR = 0xFF, // NOTE: used for returning an error from the get_status function, not that the IMU is // necessarily in an error state } imu_status_e_t; From 9f12ef5e248f192e99978206859ffbb2f273ac66 Mon Sep 17 00:00:00 2001 From: Grace Lu Date: Sat, 3 Feb 2024 22:41:02 -0500 Subject: [PATCH 4/5] Added comments to imu.h Elaborating on imu_status_e value types --- include/pros/imu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pros/imu.h b/include/pros/imu.h index c38d9b8c8..9b8aedf65 100644 --- a/include/pros/imu.h +++ b/include/pros/imu.h @@ -29,8 +29,8 @@ namespace c { #endif typedef enum imu_status_e { - E_IMU_STATUS_READY = 0, - E_IMU_STATUS_CALIBRATING = 19, + E_IMU_STATUS_READY = 0, // IMU is connected but not currently calibrating + E_IMU_STATUS_CALIBRATING = 19, // IMU is calibrating E_IMU_STATUS_ERROR = 0xFF, // NOTE: used for returning an error from the get_status function, not that the IMU is // necessarily in an error state } imu_status_e_t; From 2858a5236a8e946dfe612a7c7a429325ac081ccc Mon Sep 17 00:00:00 2001 From: Grace Lu Date: Thu, 22 Feb 2024 19:30:57 -0500 Subject: [PATCH 5/5] Reverted main.cpp --- src/main.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8a3372592..c2fbbf539 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -88,21 +88,6 @@ void opcontrol() { left_mtr = left; right_mtr = right; - // Instantiate the IMU on port where is not connected - printf("Imu 1: \n"); - pros::Imu imu(3); - // Call Imu::is_calibrating() to check if function is working - // Will return true if calibrating, false if not - printf("Imu::is_calibrating() = %d\n", imu.is_calibrating()); - // Instantiate the IMU on port where is connected - printf("Imu 2: \n"); - pros::Imu imu2(11); - // Calibrate the IMU, no blocking - imu2.reset(); - // Call Imu::is_calibrating() to check if function is working - // Will return true if calibrating, false if not - printf("Imu::is_calibrating() = %d\n", imu2.is_calibrating()); - pros::delay(20); } }