From 0ae208a2fe1d3b193d13bf0831953f452ecdc6af Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Thu, 21 May 2026 20:00:30 -0700 Subject: [PATCH 01/19] Improved Euclidean to Wheel Readability / Logic? + Fixed Tests --- src/software/physics/euclidean_to_wheel.cpp | 67 +++++++++ .../physics/euclidean_to_wheel_test.cpp | 135 ++++++++++++++---- 2 files changed, 175 insertions(+), 27 deletions(-) diff --git a/src/software/physics/euclidean_to_wheel.cpp b/src/software/physics/euclidean_to_wheel.cpp index 1b9cde8dac..46309c4fa7 100644 --- a/src/software/physics/euclidean_to_wheel.cpp +++ b/src/software/physics/euclidean_to_wheel.cpp @@ -8,6 +8,51 @@ #include "software/geom/angular_velocity.h" #include "software/geom/vector.h" +// get rid of this stupid ifdef, and then look at the issue + +// Turn this to +#if CHECK_VERSION(2026) +EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_constants) + : robot_constants_(robot_constants) +{ + // Angles [rads] + auto p = robot_constants_.front_wheel_angle_deg * M_PI / 180.; + auto t = robot_constants_.back_wheel_angle_deg * M_PI / 180.; + + // Beta is angle of wheel rolling direction relative to X-axis + // LOOK AT (software)/src/shared/robot_constants.h to see X-axis + double b_fr = -(M_PI - p); + double b_fl = -p; + double b_bl = t; + double b_br = (M_PI - t); + + // Mapped to the robot frame: +X = Forward, +Y = Left + double fr_x = 0.03485, fr_y = -0.06632; + double fl_x = 0.03485, fl_y = 0.06632; + double bl_x = -0.04985, bl_y = 0.05592; + double br_x = -0.04985, br_y = -0.05592; + + + // Assuming that CCW when looking end of shaft into motor is the positive direction. + // Formula is u_1 = v_x * cos(B_1) + v_y * sin(B_1) + W * (x_1 * sin(B_1) - y_1 * cos(B_1)) + + // clang-format off + euclidean_to_wheel_velocity_D_ << + std::cos(b_fr), std::sin(b_fr), (fr_x * std::sin(b_fr) - fr_y * std::cos(b_fr)), + std::cos(b_fl), std::sin(b_fl), (fl_x * std::sin(b_fl) - fl_y * std::cos(b_fl)), + std::cos(b_bl), std::sin(b_bl), (bl_x * std::sin(b_bl) - bl_y * std::cos(b_bl)), + std::cos(b_br), std::sin(b_br), (br_x * std::sin(b_br) - br_y * std::cos(b_br)); + // clang-format on + + // Calculate Pseudo-inverse dynamically + wheel_to_euclidean_velocity_D_inverse_ = + (euclidean_to_wheel_velocity_D_.transpose() * euclidean_to_wheel_velocity_D_) + .inverse() * + euclidean_to_wheel_velocity_D_.transpose(); +} + +#else + EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_constants) : robot_constants_(robot_constants) { @@ -56,6 +101,27 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ // clang-format on } +#endif + +// Why was this DEBUG_WHEEL +#if CHECK_VERSION(2026) +WheelSpace_t EuclideanToWheel::getWheelVelocity(EuclideanSpace_t euclidean_velocity) const +{ + // The generalized D matrix natively handles the w -> tangential velocity + // conversion because its third column already represents the lever arm in meters. + return euclidean_to_wheel_velocity_D_ * euclidean_velocity; +} + + +EuclideanSpace_t EuclideanToWheel::getEuclideanVelocity( + const WheelSpace_t& wheel_velocity) const +{ + // The D inverse matrix natively outputs w in rad/s. + return wheel_to_euclidean_velocity_D_inverse_ * wheel_velocity; +} + +#else + WheelSpace_t EuclideanToWheel::getWheelVelocity(EuclideanSpace_t euclidean_velocity) const { // need to multiply the angular velocity by the robot radius to @@ -80,6 +146,7 @@ EuclideanSpace_t EuclideanToWheel::getEuclideanVelocity( return euclidean_velocity; } +#endif WheelSpace_t EuclideanToWheel::rampWheelVelocity( const WheelSpace_t& current_wheel_velocity, const WheelSpace_t& target_wheel_velocity, diff --git a/src/software/physics/euclidean_to_wheel_test.cpp b/src/software/physics/euclidean_to_wheel_test.cpp index b546c9f01f..556a22d764 100644 --- a/src/software/physics/euclidean_to_wheel_test.cpp +++ b/src/software/physics/euclidean_to_wheel_test.cpp @@ -40,73 +40,151 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_zero) // velocity, and vise-versa. TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_x) { - // Test +x/right + // Test +x/forward target_euclidean_velocity = {1, 0, 0}; calculated_wheel_speeds = euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); - // Front wheels must be - velocity, back wheels must be + velocity. + // Right wheels must be - velocity, left wheels must be + velocity. EXPECT_LT(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], 0); - EXPECT_LT(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX], 0); + EXPECT_GT(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX], 0); EXPECT_GT(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], 0); - EXPECT_GT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); + EXPECT_LT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); + + + // Right wheels must have same velocity magnitude as left wheels, but opposite sign. + EXPECT_DOUBLE_EQ(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], + -calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]); + EXPECT_DOUBLE_EQ(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], + -calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]); } TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_x) { - // Test -x/left + // Test -x/backward target_euclidean_velocity = {-1, 0, 0}; calculated_wheel_speeds = euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); - // Front wheels must be + velocity, back wheels must be - velocity. + // Right wheels must be + velocity, left wheels must be - velocity. EXPECT_GT(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], 0); - EXPECT_GT(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX], 0); + EXPECT_LT(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX], 0); EXPECT_LT(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], 0); - EXPECT_LT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); + EXPECT_GT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); + + // Right wheels must have same velocity magnitude as left wheels, but opposite sign. + EXPECT_DOUBLE_EQ(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], + -calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]); + EXPECT_DOUBLE_EQ(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], + -calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]); } TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_y) { - // Test +y/forwards + // Test +y/left target_euclidean_velocity = {0, 1, 0}; calculated_wheel_speeds = euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); - // Right wheels must be + velocity, Left wheels must be - velocity. - EXPECT_GT(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], 0); + // Back wheels must be + velocity, front wheels must be - velocity. + EXPECT_LT(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], 0); EXPECT_LT(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX], 0); - EXPECT_LT(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], 0); + EXPECT_GT(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], 0); EXPECT_GT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); - - // Right wheels must have same velocity magnitude as left wheels, but opposite sign. - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], - -calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]); - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], - -calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]); } TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_y) { - // Test -y/backwards + // Test -y/right target_euclidean_velocity = {0, -1, 0}; calculated_wheel_speeds = euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); + // Back wheels must be - velocity, front wheels must be + velocity. + EXPECT_GT(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], 0); + EXPECT_GT(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX], 0); + EXPECT_LT(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], 0); + EXPECT_LT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); +} + +TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_sign) +{ + // Test w / counter-clockwise + target_euclidean_velocity = {0, 0, 1}; + calculated_wheel_speeds = + euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); + // Right wheels must be + velocity, Left wheels must be - velocity. EXPECT_LT(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], 0); + EXPECT_LT(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX], 0); + EXPECT_LT(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], 0); + EXPECT_LT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); +} + +TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_sign) +{ + // Test w / clockwise + target_euclidean_velocity = {0, 0, -1}; + calculated_wheel_speeds = + euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); + + // Right wheels must be + velocity, Left wheels must be - velocity. + EXPECT_GT(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], 0); EXPECT_GT(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX], 0); EXPECT_GT(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], 0); - EXPECT_LT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); + EXPECT_GT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); +} - // Right wheels must have same velocity magnitude as left wheels, but opposite sign. - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], - -calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]); - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], - -calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]); +// #ifdef DEBUG_WHEEL +#if CHECK_VERSION(2026) +TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) +{ + // Test +w/counter-clockwise + target_euclidean_velocity = {0, 0, 1}; + calculated_wheel_speeds = + euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); + + // Because the wheels are offset, their speed at 1 rad/s equals their + // exact physical lever arm (in meters), NOT the nominal robot_radius. + + // i have no idea what it's yapping about above but i ignored it lol + + // Based on the physical offsets, the lever arm evaluates to 0.0749 meters. + double expected_lever_arm = 0.0749; + + EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX]), + expected_lever_arm, 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]), expected_lever_arm, + 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX]), expected_lever_arm, + 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]), expected_lever_arm, + 0.001); } -TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w) +TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_magnitude) +{ + // Test -w/clockwise + target_euclidean_velocity = {0, 0, -1}; + calculated_wheel_speeds = + euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); + + // Because the wheels are offset, their speed at -1 rad/s equals their + // exact physical lever arm (in meters) multiplied by the negative velocity. + double expected_lever_arm = 0.0749; + + EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX]), + expected_lever_arm, 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]), expected_lever_arm, + 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX]), expected_lever_arm, + 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]), expected_lever_arm, + 0.001); +} +#else + +TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) { // Test +w/counter-clockwise target_euclidean_velocity = {0, 0, 1}; @@ -123,7 +201,8 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w) EXPECT_DOUBLE_EQ(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], robot_radius); } -TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w) + +TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_magnitude) { // Test -w/clockwise target_euclidean_velocity = {0, 0, -1}; @@ -143,6 +222,8 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w) -robot_radius); } +#endif + TEST_F(EuclideanToWheelTest, test_conversion_is_linear) { target_euclidean_velocity = {3, 1, 5}; From 3cc10dd8a53f5752a9c9aac2f21a8c3b01e54537 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Fri, 22 May 2026 03:17:36 +0000 Subject: [PATCH 02/19] [pre-commit.ci lite] apply automatic fixes --- src/software/physics/euclidean_to_wheel.cpp | 13 +++++----- .../physics/euclidean_to_wheel_test.cpp | 24 +++++++++---------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/software/physics/euclidean_to_wheel.cpp b/src/software/physics/euclidean_to_wheel.cpp index 46309c4fa7..b06e9ffb84 100644 --- a/src/software/physics/euclidean_to_wheel.cpp +++ b/src/software/physics/euclidean_to_wheel.cpp @@ -8,9 +8,9 @@ #include "software/geom/angular_velocity.h" #include "software/geom/vector.h" -// get rid of this stupid ifdef, and then look at the issue +// get rid of this stupid ifdef, and then look at the issue -// Turn this to +// Turn this to #if CHECK_VERSION(2026) EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_constants) : robot_constants_(robot_constants) @@ -27,14 +27,15 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ double b_br = (M_PI - t); // Mapped to the robot frame: +X = Forward, +Y = Left - double fr_x = 0.03485, fr_y = -0.06632; - double fl_x = 0.03485, fl_y = 0.06632; - double bl_x = -0.04985, bl_y = 0.05592; + double fr_x = 0.03485, fr_y = -0.06632; + double fl_x = 0.03485, fl_y = 0.06632; + double bl_x = -0.04985, bl_y = 0.05592; double br_x = -0.04985, br_y = -0.05592; // Assuming that CCW when looking end of shaft into motor is the positive direction. - // Formula is u_1 = v_x * cos(B_1) + v_y * sin(B_1) + W * (x_1 * sin(B_1) - y_1 * cos(B_1)) + // Formula is u_1 = v_x * cos(B_1) + v_y * sin(B_1) + W * (x_1 * sin(B_1) - y_1 * + // cos(B_1)) // clang-format off euclidean_to_wheel_velocity_D_ << diff --git a/src/software/physics/euclidean_to_wheel_test.cpp b/src/software/physics/euclidean_to_wheel_test.cpp index 556a22d764..cbe4ce4f72 100644 --- a/src/software/physics/euclidean_to_wheel_test.cpp +++ b/src/software/physics/euclidean_to_wheel_test.cpp @@ -154,12 +154,12 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX]), expected_lever_arm, 0.001); - EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]), expected_lever_arm, - 0.001); - EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX]), expected_lever_arm, - 0.001); - EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]), expected_lever_arm, - 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]), + expected_lever_arm, 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX]), + expected_lever_arm, 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]), + expected_lever_arm, 0.001); } TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_magnitude) @@ -175,12 +175,12 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_magnitude) EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX]), expected_lever_arm, 0.001); - EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]), expected_lever_arm, - 0.001); - EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX]), expected_lever_arm, - 0.001); - EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]), expected_lever_arm, - 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]), + expected_lever_arm, 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX]), + expected_lever_arm, 0.001); + EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]), + expected_lever_arm, 0.001); } #else From 65eaac335caed586df779e2fe221ed89bb86b669 Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Thu, 21 May 2026 20:18:11 -0700 Subject: [PATCH 03/19] Fixed some formatting --- src/software/physics/euclidean_to_wheel.cpp | 4 ---- src/software/physics/euclidean_to_wheel_test.cpp | 11 ++++------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/software/physics/euclidean_to_wheel.cpp b/src/software/physics/euclidean_to_wheel.cpp index 46309c4fa7..eb7501d0b0 100644 --- a/src/software/physics/euclidean_to_wheel.cpp +++ b/src/software/physics/euclidean_to_wheel.cpp @@ -8,9 +8,6 @@ #include "software/geom/angular_velocity.h" #include "software/geom/vector.h" -// get rid of this stupid ifdef, and then look at the issue - -// Turn this to #if CHECK_VERSION(2026) EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_constants) : robot_constants_(robot_constants) @@ -103,7 +100,6 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ #endif -// Why was this DEBUG_WHEEL #if CHECK_VERSION(2026) WheelSpace_t EuclideanToWheel::getWheelVelocity(EuclideanSpace_t euclidean_velocity) const { diff --git a/src/software/physics/euclidean_to_wheel_test.cpp b/src/software/physics/euclidean_to_wheel_test.cpp index 556a22d764..b0991d8680 100644 --- a/src/software/physics/euclidean_to_wheel_test.cpp +++ b/src/software/physics/euclidean_to_wheel_test.cpp @@ -36,8 +36,7 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_zero) euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity), 0.001)); } -// Note: The tests below assume that counter-clockwise motor rotation is positive -// velocity, and vise-versa. +// Note: The tests below assume that counter-clockwise motor rotation is positive velocity, and vise-versa. TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_x) { // Test +x/forward @@ -109,7 +108,7 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_y) TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_sign) { - // Test w / counter-clockwise + // Test +w / counter-clockwise target_euclidean_velocity = {0, 0, 1}; calculated_wheel_speeds = euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); @@ -123,7 +122,7 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_sign) TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_sign) { - // Test w / clockwise + // Test -w / clockwise target_euclidean_velocity = {0, 0, -1}; calculated_wheel_speeds = euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); @@ -135,7 +134,6 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_sign) EXPECT_GT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); } -// #ifdef DEBUG_WHEEL #if CHECK_VERSION(2026) TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) { @@ -147,8 +145,6 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) // Because the wheels are offset, their speed at 1 rad/s equals their // exact physical lever arm (in meters), NOT the nominal robot_radius. - // i have no idea what it's yapping about above but i ignored it lol - // Based on the physical offsets, the lever arm evaluates to 0.0749 meters. double expected_lever_arm = 0.0749; @@ -182,6 +178,7 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_magnitude) EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]), expected_lever_arm, 0.001); } + #else TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) From 7f7fb0feeac556f07db15e96a68603ff5c333619 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Fri, 22 May 2026 03:47:52 +0000 Subject: [PATCH 04/19] [pre-commit.ci lite] apply automatic fixes --- .../physics/euclidean_to_wheel_test.cpp | 3 +- .../thunderscope/requirements_lock.txt | 135 ------------------ 2 files changed, 2 insertions(+), 136 deletions(-) diff --git a/src/software/physics/euclidean_to_wheel_test.cpp b/src/software/physics/euclidean_to_wheel_test.cpp index 6b1332936e..38f2d151d2 100644 --- a/src/software/physics/euclidean_to_wheel_test.cpp +++ b/src/software/physics/euclidean_to_wheel_test.cpp @@ -36,7 +36,8 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_zero) euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity), 0.001)); } -// Note: The tests below assume that counter-clockwise motor rotation is positive velocity, and vise-versa. +// Note: The tests below assume that counter-clockwise motor rotation is positive +// velocity, and vise-versa. TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_x) { // Test +x/forward diff --git a/src/software/thunderscope/requirements_lock.txt b/src/software/thunderscope/requirements_lock.txt index 1b4d0632ee..e69de29bb2 100644 --- a/src/software/thunderscope/requirements_lock.txt +++ b/src/software/thunderscope/requirements_lock.txt @@ -1,135 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.12 -# by the following command: -# -# bazel run //software/thunderscope:requirements.update -# -colorama==0.4.6 \ - --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ - --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 - # via -r software/thunderscope/requirements.in -darkdetect==0.7.1 \ - --hash=sha256:3efe69f8ecd5f1b7f4fbb0d1d93f656b0e493c45cc49222380ffe2a529cbc866 \ - --hash=sha256:47be3cf5134432ddb616bbffc927237718407914993c82809983e7ccebf49013 - # via pyqtdarktheme-fork -evdev==1.7.0 ; sys_platform == "linux" \ - --hash=sha256:95bd2a1e0c6ce2cd7a2ecc6e6cd9736ff794b3ad5cb54d81d8cbc2e414d0b870 - # via -r software/thunderscope/requirements.in -netifaces==0.11.0 \ - --hash=sha256:043a79146eb2907edf439899f262b3dfe41717d34124298ed281139a8b93ca32 \ - --hash=sha256:08e3f102a59f9eaef70948340aeb6c89bd09734e0dca0f3b82720305729f63ea \ - --hash=sha256:0f6133ac02521270d9f7c490f0c8c60638ff4aec8338efeff10a1b51506abe85 \ - --hash=sha256:18917fbbdcb2d4f897153c5ddbb56b31fa6dd7c3fa9608b7e3c3a663df8206b5 \ - --hash=sha256:2479bb4bb50968089a7c045f24d120f37026d7e802ec134c4490eae994c729b5 \ - --hash=sha256:2650beee182fed66617e18474b943e72e52f10a24dc8cac1db36c41ee9c041b7 \ - --hash=sha256:28f4bf3a1361ab3ed93c5ef360c8b7d4a4ae060176a3529e72e5e4ffc4afd8b0 \ - --hash=sha256:3ecb3f37c31d5d51d2a4d935cfa81c9bc956687c6f5237021b36d6fdc2815b2c \ - --hash=sha256:469fc61034f3daf095e02f9f1bbac07927b826c76b745207287bc594884cfd05 \ - --hash=sha256:48324183af7f1bc44f5f197f3dad54a809ad1ef0c78baee2c88f16a5de02c4c9 \ - --hash=sha256:50721858c935a76b83dd0dd1ab472cad0a3ef540a1408057624604002fcfb45b \ - --hash=sha256:54ff6624eb95b8a07e79aa8817288659af174e954cca24cdb0daeeddfc03c4ff \ - --hash=sha256:5be83986100ed1fdfa78f11ccff9e4757297735ac17391b95e17e74335c2047d \ - --hash=sha256:5f9ca13babe4d845e400921973f6165a4c2f9f3379c7abfc7478160e25d196a4 \ - --hash=sha256:73ff21559675150d31deea8f1f8d7e9a9a7e4688732a94d71327082f517fc6b4 \ - --hash=sha256:7dbb71ea26d304e78ccccf6faccef71bb27ea35e259fb883cfd7fd7b4f17ecb1 \ - --hash=sha256:815eafdf8b8f2e61370afc6add6194bd5a7252ae44c667e96c4c1ecf418811e4 \ - --hash=sha256:841aa21110a20dc1621e3dd9f922c64ca64dd1eb213c47267a2c324d823f6c8f \ - --hash=sha256:84e4d2e6973eccc52778735befc01638498781ce0e39aa2044ccfd2385c03246 \ - --hash=sha256:8f7da24eab0d4184715d96208b38d373fd15c37b0dafb74756c638bd619ba150 \ - --hash=sha256:96c0fe9696398253f93482c84814f0e7290eee0bfec11563bd07d80d701280c3 \ - --hash=sha256:aab1dbfdc55086c789f0eb37affccf47b895b98d490738b81f3b2360100426be \ - --hash=sha256:c03fb2d4ef4e393f2e6ffc6376410a22a3544f164b336b3a355226653e5efd89 \ - --hash=sha256:c37a1ca83825bc6f54dddf5277e9c65dec2f1b4d0ba44b8fd42bc30c91aa6ea1 \ - --hash=sha256:c92ff9ac7c2282009fe0dcb67ee3cd17978cffbe0c8f4b471c00fe4325c9b4d4 \ - --hash=sha256:c9a3a47cd3aaeb71e93e681d9816c56406ed755b9442e981b07e3618fb71d2ac \ - --hash=sha256:cb925e1ca024d6f9b4f9b01d83215fd00fe69d095d0255ff3f64bffda74025c8 \ - --hash=sha256:d07b01c51b0b6ceb0f09fc48ec58debd99d2c8430b09e56651addeaf5de48048 \ - --hash=sha256:e76c7f351e0444721e85f975ae92718e21c1f361bda946d60a214061de1f00a1 \ - --hash=sha256:eb4813b77d5df99903af4757ce980a98c4d702bbcb81f32a0b305a1537bdf0b1 - # via -r software/thunderscope/requirements.in -numpy==1.26.4 \ - --hash=sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b \ - --hash=sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818 \ - --hash=sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20 \ - --hash=sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0 \ - --hash=sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010 \ - --hash=sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a \ - --hash=sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea \ - --hash=sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c \ - --hash=sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71 \ - --hash=sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110 \ - --hash=sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be \ - --hash=sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a \ - --hash=sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a \ - --hash=sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5 \ - --hash=sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed \ - --hash=sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd \ - --hash=sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c \ - --hash=sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e \ - --hash=sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0 \ - --hash=sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c \ - --hash=sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a \ - --hash=sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b \ - --hash=sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0 \ - --hash=sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6 \ - --hash=sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2 \ - --hash=sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a \ - --hash=sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30 \ - --hash=sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218 \ - --hash=sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5 \ - --hash=sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07 \ - --hash=sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2 \ - --hash=sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4 \ - --hash=sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764 \ - --hash=sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef \ - --hash=sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3 \ - --hash=sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f - # via - # -r software/thunderscope/requirements.in - # pyqtgraph -packaging==24.2 \ - --hash=sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759 \ - --hash=sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f - # via qtpy -protobuf==6.31.1 \ - --hash=sha256:0414e3aa5a5f3ff423828e1e6a6e907d6c65c1d5b7e6e975793d5590bdeecc16 \ - --hash=sha256:426f59d2964864a1a366254fa703b8632dcec0790d8862d30034d8245e1cd447 \ - --hash=sha256:4ee898bf66f7a8b0bd21bce523814e6fbd8c6add948045ce958b73af7e8878c6 \ - --hash=sha256:6f1227473dc43d44ed644425268eb7c2e488ae245d51c6866d19fe158e207402 \ - --hash=sha256:720a6c7e6b77288b85063569baae8536671b39f15cc22037ec7045658d80489e \ - --hash=sha256:7fa17d5a29c2e04b7d90e5e32388b8bfd0e7107cd8e616feef7ed3fa6bdab5c9 \ - --hash=sha256:8764cf4587791e7564051b35524b72844f845ad0bb011704c3736cce762d8fe9 \ - --hash=sha256:a40fc12b84c154884d7d4c4ebd675d5b3b5283e155f324049ae396b95ddebc39 \ - --hash=sha256:d8cac4c982f0b957a4dc73a80e2ea24fab08e679c0de9deb835f4a12d69aca9a - # via -r software/thunderscope/requirements.in -pyqt-toast-notification==1.3.2 \ - --hash=sha256:135736ec0f16bff41104dee3c60ac318e5d55ae3378bf26892c6d08c36088ae6 \ - --hash=sha256:82688101202737736d51ab6c74a573b32266ecb7c8b0002f913407bd369737d9 - # via -r software/thunderscope/requirements.in -pyqt6-qt6==6.8.1 \ - --hash=sha256:006d786693d0511fbcf184a862edbd339c6ed1bb3bd9de363d73a19ed4b23dff \ - --hash=sha256:08065d595f1e6fc2dde9f4450eeff89082f4bad26f600a8e9b9cc5966716bfcf \ - --hash=sha256:1eb8460a1fdb38d0b2458c2974c01d471c1e59e4eb19ea63fc447aaba3ad530e \ - --hash=sha256:20843cb86bd94942d1cd99e39bf1aeabb875b241a35a8ab273e4bbbfa63776db \ - --hash=sha256:9f3790c4ce4dc576e48b8718d55fb8743057e6cbd53a6ca1dd253ffbac9b7287 \ - --hash=sha256:a8bc2ed4ee5e7c6ff4dd1c7db0b27705d151fee5dc232bbd1bf17618f937f515 \ - --hash=sha256:d6ca5d2b9d2ec0ee4a814b2175f641a5c4299cb80b45e0f5f8356632663f89b3 - # via -r software/thunderscope/requirements.in -pyqtdarktheme-fork==2.3.2 \ - --hash=sha256:3ea94fed5df262d960378409357c63032639f749794d766f41a45ad8558b2523 \ - --hash=sha256:d96ee64f0884678fad9b6bc352d5e37d84ca786fa60ed32ffaa7e6c6bc67e964 - # via -r software/thunderscope/requirements.in -pyqtgraph==0.13.7 \ - --hash=sha256:64f84f1935c6996d0e09b1ee66fe478a7771e3ca6f3aaa05f00f6e068321d9e3 \ - --hash=sha256:7754edbefb6c367fa0dfb176e2d0610da3ada20aa7a5318516c74af5fb72bf7a - # via -r software/thunderscope/requirements.in -qtawesome==1.4.0 \ - --hash=sha256:783e414d1317f3e978bf67ea8e8a1b1498bad9dbd305dec814027e3b50521be6 \ - --hash=sha256:a4d689fa071c595aa6184171ce1f0f847677cb8d2db45382c43129f1d72a3d93 - # via -r software/thunderscope/requirements.in -qtpy==2.4.2 \ - --hash=sha256:5a696b1dd7a354cb330657da1d17c20c2190c72d4888ba923f8461da67aa1a1c \ - --hash=sha256:9d6ec91a587cc1495eaebd23130f7619afa5cdd34a277acb87735b4ad7c65156 - # via - # pyqt-toast-notification - # qtawesome From 167f5893128b6a7364ca7706738ac18bb7c103a1 Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Fri, 22 May 2026 12:17:00 -0700 Subject: [PATCH 05/19] Revert "[pre-commit.ci lite] apply automatic fixes" Formatting accidentally deleted a requirements_lock This reverts commit 7f7fb0feeac556f07db15e96a68603ff5c333619. --- .../physics/euclidean_to_wheel_test.cpp | 3 +- .../thunderscope/requirements_lock.txt | 135 ++++++++++++++++++ 2 files changed, 136 insertions(+), 2 deletions(-) diff --git a/src/software/physics/euclidean_to_wheel_test.cpp b/src/software/physics/euclidean_to_wheel_test.cpp index 38f2d151d2..6b1332936e 100644 --- a/src/software/physics/euclidean_to_wheel_test.cpp +++ b/src/software/physics/euclidean_to_wheel_test.cpp @@ -36,8 +36,7 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_zero) euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity), 0.001)); } -// Note: The tests below assume that counter-clockwise motor rotation is positive -// velocity, and vise-versa. +// Note: The tests below assume that counter-clockwise motor rotation is positive velocity, and vise-versa. TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_x) { // Test +x/forward diff --git a/src/software/thunderscope/requirements_lock.txt b/src/software/thunderscope/requirements_lock.txt index e69de29bb2..1b4d0632ee 100644 --- a/src/software/thunderscope/requirements_lock.txt +++ b/src/software/thunderscope/requirements_lock.txt @@ -0,0 +1,135 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# bazel run //software/thunderscope:requirements.update +# +colorama==0.4.6 \ + --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ + --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 + # via -r software/thunderscope/requirements.in +darkdetect==0.7.1 \ + --hash=sha256:3efe69f8ecd5f1b7f4fbb0d1d93f656b0e493c45cc49222380ffe2a529cbc866 \ + --hash=sha256:47be3cf5134432ddb616bbffc927237718407914993c82809983e7ccebf49013 + # via pyqtdarktheme-fork +evdev==1.7.0 ; sys_platform == "linux" \ + --hash=sha256:95bd2a1e0c6ce2cd7a2ecc6e6cd9736ff794b3ad5cb54d81d8cbc2e414d0b870 + # via -r software/thunderscope/requirements.in +netifaces==0.11.0 \ + --hash=sha256:043a79146eb2907edf439899f262b3dfe41717d34124298ed281139a8b93ca32 \ + --hash=sha256:08e3f102a59f9eaef70948340aeb6c89bd09734e0dca0f3b82720305729f63ea \ + --hash=sha256:0f6133ac02521270d9f7c490f0c8c60638ff4aec8338efeff10a1b51506abe85 \ + --hash=sha256:18917fbbdcb2d4f897153c5ddbb56b31fa6dd7c3fa9608b7e3c3a663df8206b5 \ + --hash=sha256:2479bb4bb50968089a7c045f24d120f37026d7e802ec134c4490eae994c729b5 \ + --hash=sha256:2650beee182fed66617e18474b943e72e52f10a24dc8cac1db36c41ee9c041b7 \ + --hash=sha256:28f4bf3a1361ab3ed93c5ef360c8b7d4a4ae060176a3529e72e5e4ffc4afd8b0 \ + --hash=sha256:3ecb3f37c31d5d51d2a4d935cfa81c9bc956687c6f5237021b36d6fdc2815b2c \ + --hash=sha256:469fc61034f3daf095e02f9f1bbac07927b826c76b745207287bc594884cfd05 \ + --hash=sha256:48324183af7f1bc44f5f197f3dad54a809ad1ef0c78baee2c88f16a5de02c4c9 \ + --hash=sha256:50721858c935a76b83dd0dd1ab472cad0a3ef540a1408057624604002fcfb45b \ + --hash=sha256:54ff6624eb95b8a07e79aa8817288659af174e954cca24cdb0daeeddfc03c4ff \ + --hash=sha256:5be83986100ed1fdfa78f11ccff9e4757297735ac17391b95e17e74335c2047d \ + --hash=sha256:5f9ca13babe4d845e400921973f6165a4c2f9f3379c7abfc7478160e25d196a4 \ + --hash=sha256:73ff21559675150d31deea8f1f8d7e9a9a7e4688732a94d71327082f517fc6b4 \ + --hash=sha256:7dbb71ea26d304e78ccccf6faccef71bb27ea35e259fb883cfd7fd7b4f17ecb1 \ + --hash=sha256:815eafdf8b8f2e61370afc6add6194bd5a7252ae44c667e96c4c1ecf418811e4 \ + --hash=sha256:841aa21110a20dc1621e3dd9f922c64ca64dd1eb213c47267a2c324d823f6c8f \ + --hash=sha256:84e4d2e6973eccc52778735befc01638498781ce0e39aa2044ccfd2385c03246 \ + --hash=sha256:8f7da24eab0d4184715d96208b38d373fd15c37b0dafb74756c638bd619ba150 \ + --hash=sha256:96c0fe9696398253f93482c84814f0e7290eee0bfec11563bd07d80d701280c3 \ + --hash=sha256:aab1dbfdc55086c789f0eb37affccf47b895b98d490738b81f3b2360100426be \ + --hash=sha256:c03fb2d4ef4e393f2e6ffc6376410a22a3544f164b336b3a355226653e5efd89 \ + --hash=sha256:c37a1ca83825bc6f54dddf5277e9c65dec2f1b4d0ba44b8fd42bc30c91aa6ea1 \ + --hash=sha256:c92ff9ac7c2282009fe0dcb67ee3cd17978cffbe0c8f4b471c00fe4325c9b4d4 \ + --hash=sha256:c9a3a47cd3aaeb71e93e681d9816c56406ed755b9442e981b07e3618fb71d2ac \ + --hash=sha256:cb925e1ca024d6f9b4f9b01d83215fd00fe69d095d0255ff3f64bffda74025c8 \ + --hash=sha256:d07b01c51b0b6ceb0f09fc48ec58debd99d2c8430b09e56651addeaf5de48048 \ + --hash=sha256:e76c7f351e0444721e85f975ae92718e21c1f361bda946d60a214061de1f00a1 \ + --hash=sha256:eb4813b77d5df99903af4757ce980a98c4d702bbcb81f32a0b305a1537bdf0b1 + # via -r software/thunderscope/requirements.in +numpy==1.26.4 \ + --hash=sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b \ + --hash=sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818 \ + --hash=sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20 \ + --hash=sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0 \ + --hash=sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010 \ + --hash=sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a \ + --hash=sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea \ + --hash=sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c \ + --hash=sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71 \ + --hash=sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110 \ + --hash=sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be \ + --hash=sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a \ + --hash=sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a \ + --hash=sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5 \ + --hash=sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed \ + --hash=sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd \ + --hash=sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c \ + --hash=sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e \ + --hash=sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0 \ + --hash=sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c \ + --hash=sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a \ + --hash=sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b \ + --hash=sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0 \ + --hash=sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6 \ + --hash=sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2 \ + --hash=sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a \ + --hash=sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30 \ + --hash=sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218 \ + --hash=sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5 \ + --hash=sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07 \ + --hash=sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2 \ + --hash=sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4 \ + --hash=sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764 \ + --hash=sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef \ + --hash=sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3 \ + --hash=sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f + # via + # -r software/thunderscope/requirements.in + # pyqtgraph +packaging==24.2 \ + --hash=sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759 \ + --hash=sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f + # via qtpy +protobuf==6.31.1 \ + --hash=sha256:0414e3aa5a5f3ff423828e1e6a6e907d6c65c1d5b7e6e975793d5590bdeecc16 \ + --hash=sha256:426f59d2964864a1a366254fa703b8632dcec0790d8862d30034d8245e1cd447 \ + --hash=sha256:4ee898bf66f7a8b0bd21bce523814e6fbd8c6add948045ce958b73af7e8878c6 \ + --hash=sha256:6f1227473dc43d44ed644425268eb7c2e488ae245d51c6866d19fe158e207402 \ + --hash=sha256:720a6c7e6b77288b85063569baae8536671b39f15cc22037ec7045658d80489e \ + --hash=sha256:7fa17d5a29c2e04b7d90e5e32388b8bfd0e7107cd8e616feef7ed3fa6bdab5c9 \ + --hash=sha256:8764cf4587791e7564051b35524b72844f845ad0bb011704c3736cce762d8fe9 \ + --hash=sha256:a40fc12b84c154884d7d4c4ebd675d5b3b5283e155f324049ae396b95ddebc39 \ + --hash=sha256:d8cac4c982f0b957a4dc73a80e2ea24fab08e679c0de9deb835f4a12d69aca9a + # via -r software/thunderscope/requirements.in +pyqt-toast-notification==1.3.2 \ + --hash=sha256:135736ec0f16bff41104dee3c60ac318e5d55ae3378bf26892c6d08c36088ae6 \ + --hash=sha256:82688101202737736d51ab6c74a573b32266ecb7c8b0002f913407bd369737d9 + # via -r software/thunderscope/requirements.in +pyqt6-qt6==6.8.1 \ + --hash=sha256:006d786693d0511fbcf184a862edbd339c6ed1bb3bd9de363d73a19ed4b23dff \ + --hash=sha256:08065d595f1e6fc2dde9f4450eeff89082f4bad26f600a8e9b9cc5966716bfcf \ + --hash=sha256:1eb8460a1fdb38d0b2458c2974c01d471c1e59e4eb19ea63fc447aaba3ad530e \ + --hash=sha256:20843cb86bd94942d1cd99e39bf1aeabb875b241a35a8ab273e4bbbfa63776db \ + --hash=sha256:9f3790c4ce4dc576e48b8718d55fb8743057e6cbd53a6ca1dd253ffbac9b7287 \ + --hash=sha256:a8bc2ed4ee5e7c6ff4dd1c7db0b27705d151fee5dc232bbd1bf17618f937f515 \ + --hash=sha256:d6ca5d2b9d2ec0ee4a814b2175f641a5c4299cb80b45e0f5f8356632663f89b3 + # via -r software/thunderscope/requirements.in +pyqtdarktheme-fork==2.3.2 \ + --hash=sha256:3ea94fed5df262d960378409357c63032639f749794d766f41a45ad8558b2523 \ + --hash=sha256:d96ee64f0884678fad9b6bc352d5e37d84ca786fa60ed32ffaa7e6c6bc67e964 + # via -r software/thunderscope/requirements.in +pyqtgraph==0.13.7 \ + --hash=sha256:64f84f1935c6996d0e09b1ee66fe478a7771e3ca6f3aaa05f00f6e068321d9e3 \ + --hash=sha256:7754edbefb6c367fa0dfb176e2d0610da3ada20aa7a5318516c74af5fb72bf7a + # via -r software/thunderscope/requirements.in +qtawesome==1.4.0 \ + --hash=sha256:783e414d1317f3e978bf67ea8e8a1b1498bad9dbd305dec814027e3b50521be6 \ + --hash=sha256:a4d689fa071c595aa6184171ce1f0f847677cb8d2db45382c43129f1d72a3d93 + # via -r software/thunderscope/requirements.in +qtpy==2.4.2 \ + --hash=sha256:5a696b1dd7a354cb330657da1d17c20c2190c72d4888ba923f8461da67aa1a1c \ + --hash=sha256:9d6ec91a587cc1495eaebd23130f7619afa5cdd34a277acb87735b4ad7c65156 + # via + # pyqt-toast-notification + # qtawesome From 835c2ac6536754fcd5bd4278880f1900e9d9efc4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Fri, 22 May 2026 19:23:48 +0000 Subject: [PATCH 06/19] [pre-commit.ci lite] apply automatic fixes --- src/software/physics/euclidean_to_wheel_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/software/physics/euclidean_to_wheel_test.cpp b/src/software/physics/euclidean_to_wheel_test.cpp index 6b1332936e..38f2d151d2 100644 --- a/src/software/physics/euclidean_to_wheel_test.cpp +++ b/src/software/physics/euclidean_to_wheel_test.cpp @@ -36,7 +36,8 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_zero) euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity), 0.001)); } -// Note: The tests below assume that counter-clockwise motor rotation is positive velocity, and vise-versa. +// Note: The tests below assume that counter-clockwise motor rotation is positive +// velocity, and vise-versa. TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_x) { // Test +x/forward From e541f5d1118bbf71d0c40f75eb19244e80268835 Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Fri, 22 May 2026 12:29:10 -0700 Subject: [PATCH 07/19] Delete silly comment --- src/software/physics/euclidean_to_wheel.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/software/physics/euclidean_to_wheel.cpp b/src/software/physics/euclidean_to_wheel.cpp index b5ebc8a2fd..c45767e5ef 100644 --- a/src/software/physics/euclidean_to_wheel.cpp +++ b/src/software/physics/euclidean_to_wheel.cpp @@ -8,9 +8,6 @@ #include "software/geom/angular_velocity.h" #include "software/geom/vector.h" -// get rid of this stupid ifdef, and then look at the issue - -// Turn this to #if CHECK_VERSION(2026) EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_constants) : robot_constants_(robot_constants) From f4c6cd784419b041b09bf3e434ee83cc31d16e8c Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Fri, 22 May 2026 15:47:28 -0700 Subject: [PATCH 08/19] Removed magic numbers and removed old code in preprocessor directives --- src/shared/robot_constants.h | 24 ++++- src/software/physics/euclidean_to_wheel.cpp | 99 +++---------------- .../physics/euclidean_to_wheel_test.cpp | 46 +-------- 3 files changed, 37 insertions(+), 132 deletions(-) diff --git a/src/shared/robot_constants.h b/src/shared/robot_constants.h index 93ceb390cd..18eac3998f 100644 --- a/src/shared/robot_constants.h +++ b/src/shared/robot_constants.h @@ -41,6 +41,18 @@ struct RobotConstants // The angle between y-axis of the robot and the rear wheel axles [degrees] float back_wheel_angle_deg; + // X position of centre of front wheel + float front_wheel_x_mag; + + // Y position of centre of front wheel + float front_wheel_y_mag; + + // X position of centre of rear wheel + float back_wheel_x_mag; + + // Y position of centre of rear wheel + float back_wheel_y_mag; + // The total width of the entire flat face on the front of the robot [meters] float front_of_robot_width_meters; @@ -74,6 +86,8 @@ struct RobotConstants // The radius of the wheel, in meters float wheel_radius_meters; + + float expected_lever_arm; }; /** @@ -89,6 +103,11 @@ constexpr RobotConstants createRobotConstants() .front_wheel_angle_deg = 32.0f, .back_wheel_angle_deg = 44.0f, + .front_wheel_x_mag = 0.03485f, + .front_wheel_y_mag = 0.06632f, + .back_wheel_x_mag = 0.04985f, + .back_wheel_y_mag = 0.05592f, + .front_of_robot_width_meters = 0.11f, .dribbler_width_meters = 0.07825f, @@ -108,7 +127,10 @@ constexpr RobotConstants createRobotConstants() .robot_max_ang_speed_rad_per_s = 10.0f, .robot_max_ang_acceleration_rad_per_s_2 = 30.0f, - .wheel_radius_meters = 0.03f}; + .wheel_radius_meters = 0.03f, + + .expected_lever_arm = 0.0749f + }; } #elif CHECK_VERSION(2021) constexpr RobotConstants createRobotConstants() diff --git a/src/software/physics/euclidean_to_wheel.cpp b/src/software/physics/euclidean_to_wheel.cpp index c45767e5ef..3359e8db13 100644 --- a/src/software/physics/euclidean_to_wheel.cpp +++ b/src/software/physics/euclidean_to_wheel.cpp @@ -8,7 +8,6 @@ #include "software/geom/angular_velocity.h" #include "software/geom/vector.h" -#if CHECK_VERSION(2026) EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_constants) : robot_constants_(robot_constants) { @@ -24,10 +23,14 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ double b_br = (M_PI - t); // Mapped to the robot frame: +X = Forward, +Y = Left - double fr_x = 0.03485, fr_y = -0.06632; - double fl_x = 0.03485, fl_y = 0.06632; - double bl_x = -0.04985, bl_y = 0.05592; - double br_x = -0.04985, br_y = -0.05592; + double fr_x = robot_constants_.front_wheel_x_mag; + double fr_y = robot_constants_.front_wheel_y_mag * -1.0; + double fl_x = robot_constants_.front_wheel_x_mag; + double fl_y = robot_constants_.front_wheel_y_mag; + double bl_x = robot_constants_.back_wheel_x_mag * -1.0; + double bl_y = robot_constants_.back_wheel_y_mag; + double br_x = robot_constants_.back_wheel_x_mag * -1.0; + double br_y = robot_constants_.back_wheel_y_mag * -1.0; // Assuming that CCW when looking end of shaft into motor is the positive direction. @@ -42,66 +45,19 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ std::cos(b_br), std::sin(b_br), (br_x * std::sin(b_br) - br_y * std::cos(b_br)); // clang-format on - // Calculate Pseudo-inverse dynamically - wheel_to_euclidean_velocity_D_inverse_ = - (euclidean_to_wheel_velocity_D_.transpose() * euclidean_to_wheel_velocity_D_) - .inverse() * - euclidean_to_wheel_velocity_D_.transpose(); -} - -#else - -EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_constants) - : robot_constants_(robot_constants) -{ - // Phi, the angle between the hemisphere line of the robot and the front wheel axles - // [rads] - auto p = robot_constants_.front_wheel_angle_deg * M_PI / 180.; - - // Theta, the angle between the hemisphere line of the robot and the rear wheel axles - // [rads] - auto t = robot_constants_.back_wheel_angle_deg * M_PI / 180.; - - // Caching repeated calculations - auto cos_p = std::cos(p); - auto cos_t = std::cos(t); - auto sin_p = std::sin(p); - auto sin_t = std::sin(t); - - // clang-format off - euclidean_to_wheel_velocity_D_ << - -sin_p, cos_p, 1, - -sin_p, -cos_p, 1, - sin_t, -cos_t, 1, - sin_t, cos_t, 1; - // clang-format on - // Inverse of euclidean to wheel matrix (D) for converting wheel velocity to euclidean // velocity. // NOTE: The pseudoinverse given in the paper // (http://robocup.mi.fu-berlin.de/buch/omnidrive.pdf pg 17) is incorrect. The inverse // was calculated using Wolfram Alpha: https://bit.ly/3A08BJX - auto i = 1 / (2 * sin_p + 2 * sin_t); - - auto j_denom = 2 * cos_p * cos_p + 2 * cos_t * cos_t; - auto j1 = cos_p / j_denom; - auto j2 = cos_t / j_denom; - auto k_denom = 2 * sin_p + 2 * sin_t; - auto k1 = sin_t / k_denom; - auto k2 = sin_p / k_denom; - - // clang-format off - wheel_to_euclidean_velocity_D_inverse_ << - -i, -i, i, i, - j1, -j1, -j2, j2, - k1, k1, k2, k2; - // clang-format on + // Calculate Pseudo-inverse dynamically + wheel_to_euclidean_velocity_D_inverse_ = + (euclidean_to_wheel_velocity_D_.transpose() * euclidean_to_wheel_velocity_D_) + .inverse() * + euclidean_to_wheel_velocity_D_.transpose(); } -#endif - -#if CHECK_VERSION(2026) WheelSpace_t EuclideanToWheel::getWheelVelocity(EuclideanSpace_t euclidean_velocity) const { // The generalized D matrix natively handles the w -> tangential velocity @@ -109,7 +65,6 @@ WheelSpace_t EuclideanToWheel::getWheelVelocity(EuclideanSpace_t euclidean_veloc return euclidean_to_wheel_velocity_D_ * euclidean_velocity; } - EuclideanSpace_t EuclideanToWheel::getEuclideanVelocity( const WheelSpace_t& wheel_velocity) const { @@ -117,34 +72,6 @@ EuclideanSpace_t EuclideanToWheel::getEuclideanVelocity( return wheel_to_euclidean_velocity_D_inverse_ * wheel_velocity; } -#else - -WheelSpace_t EuclideanToWheel::getWheelVelocity(EuclideanSpace_t euclidean_velocity) const -{ - // need to multiply the angular velocity by the robot radius to - // calculate the wheel velocity (robot tangential velocity) - // ref: http://robocup.mi.fu-berlin.de/buch/omnidrive.pdf pg 8 - euclidean_velocity[2] = euclidean_velocity[2] * robot_constants_.robot_radius_m; - - return euclidean_to_wheel_velocity_D_ * euclidean_velocity; -} - -EuclideanSpace_t EuclideanToWheel::getEuclideanVelocity( - const WheelSpace_t& wheel_velocity) const -{ - EuclideanSpace_t euclidean_velocity = - wheel_to_euclidean_velocity_D_inverse_ * wheel_velocity; - - // The above multiplication will calculate the tangential robot - // velocity. This can be divided by the robot radius to calculate - // the angular velocity - // ref: http://robocup.mi.fu-berlin.de/buch/omnidrive.pdf pg 8 - euclidean_velocity[2] = euclidean_velocity[2] / robot_constants_.robot_radius_m; - - return euclidean_velocity; -} -#endif - WheelSpace_t EuclideanToWheel::rampWheelVelocity( const WheelSpace_t& current_wheel_velocity, const WheelSpace_t& target_wheel_velocity, const double& time_to_ramp) diff --git a/src/software/physics/euclidean_to_wheel_test.cpp b/src/software/physics/euclidean_to_wheel_test.cpp index 38f2d151d2..95d7ba2e23 100644 --- a/src/software/physics/euclidean_to_wheel_test.cpp +++ b/src/software/physics/euclidean_to_wheel_test.cpp @@ -1,7 +1,6 @@ #include "software/physics/euclidean_to_wheel.h" #include - #include "proto/primitive/primitive_msg_factory.h" #include "software/test_util/test_util.h" @@ -15,6 +14,7 @@ class EuclideanToWheelTest : public ::testing::Test robot_constants::RobotConstants robot_constants = robot_constants::createRobotConstants(); double robot_radius = robot_constants::createRobotConstants().robot_radius_m; + double expected_lever_arm = robot_constants::createRobotConstants().expected_lever_arm; WheelSpace_t target_wheel_velocity{}; WheelSpace_t current_wheel_velocity{}; @@ -135,7 +135,6 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_sign) EXPECT_GT(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], 0); } -#if CHECK_VERSION(2026) TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) { // Test +w/counter-clockwise @@ -147,7 +146,6 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) // exact physical lever arm (in meters), NOT the nominal robot_radius. // Based on the physical offsets, the lever arm evaluates to 0.0749 meters. - double expected_lever_arm = 0.0749; EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX]), expected_lever_arm, 0.001); @@ -168,7 +166,6 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_magnitude) // Because the wheels are offset, their speed at -1 rad/s equals their // exact physical lever arm (in meters) multiplied by the negative velocity. - double expected_lever_arm = 0.0749; EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX]), expected_lever_arm, 0.001); @@ -180,47 +177,6 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_magnitude) expected_lever_arm, 0.001); } -#else - -TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) -{ - // Test +w/counter-clockwise - target_euclidean_velocity = {0, 0, 1}; - calculated_wheel_speeds = - euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); - - // Formula for the length of a segment: length = radius * angle - // Since angle = 1rad, the length of the segment is equal to the radius. - // Therefore, all wheel speeds must be equal to the robot radius. - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], - robot_radius); - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX], robot_radius); - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], robot_radius); - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], robot_radius); -} - - -TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_magnitude) -{ - // Test -w/clockwise - target_euclidean_velocity = {0, 0, -1}; - calculated_wheel_speeds = - euclidean_to_four_wheel.getWheelVelocity(target_euclidean_velocity); - - // Formula for the length of a segment: length = radius * angle - // Since angle = -1rad, the length of the segment is equal to the -radius. - // Therefore, all wheel speeds (=length of segment/sec) must be equal to the robot - // radius. - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX], - -robot_radius); - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX], - -robot_radius); - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX], -robot_radius); - EXPECT_DOUBLE_EQ(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX], - -robot_radius); -} - -#endif TEST_F(EuclideanToWheelTest, test_conversion_is_linear) { From 61c9e5d6841f2c546e4404f813a94069565a80ea Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Fri, 22 May 2026 16:08:52 -0700 Subject: [PATCH 09/19] Another magic number is now labelled --- .../physics/euclidean_to_wheel_test.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/software/physics/euclidean_to_wheel_test.cpp b/src/software/physics/euclidean_to_wheel_test.cpp index 95d7ba2e23..9910bdddaf 100644 --- a/src/software/physics/euclidean_to_wheel_test.cpp +++ b/src/software/physics/euclidean_to_wheel_test.cpp @@ -15,6 +15,7 @@ class EuclideanToWheelTest : public ::testing::Test robot_constants::createRobotConstants(); double robot_radius = robot_constants::createRobotConstants().robot_radius_m; double expected_lever_arm = robot_constants::createRobotConstants().expected_lever_arm; + const float EQUALITY_COMPARISON = 0.001f; WheelSpace_t target_wheel_velocity{}; WheelSpace_t current_wheel_velocity{}; @@ -148,13 +149,13 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) // Based on the physical offsets, the lever arm evaluates to 0.0749 meters. EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX]), - expected_lever_arm, 0.001); + expected_lever_arm, EQUALITY_COMPARISON); EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]), - expected_lever_arm, 0.001); + expected_lever_arm, EQUALITY_COMPARISON); EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX]), - expected_lever_arm, 0.001); + expected_lever_arm, EQUALITY_COMPARISON); EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]), - expected_lever_arm, 0.001); + expected_lever_arm, EQUALITY_COMPARISON); } TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_magnitude) @@ -168,13 +169,13 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_negative_w_magnitude) // exact physical lever arm (in meters) multiplied by the negative velocity. EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX]), - expected_lever_arm, 0.001); + expected_lever_arm, EQUALITY_COMPARISON); EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]), - expected_lever_arm, 0.001); + expected_lever_arm, EQUALITY_COMPARISON); EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_LEFT_WHEEL_SPACE_INDEX]), - expected_lever_arm, 0.001); + expected_lever_arm, EQUALITY_COMPARISON); EXPECT_NEAR(std::abs(calculated_wheel_speeds[BACK_RIGHT_WHEEL_SPACE_INDEX]), - expected_lever_arm, 0.001); + expected_lever_arm, EQUALITY_COMPARISON); } From 86a81d3d84b68c055bf29fe1110f0d92909bec6d Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Fri, 22 May 2026 16:21:39 -0700 Subject: [PATCH 10/19] Changed auto type to static --- src/software/physics/euclidean_to_wheel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/software/physics/euclidean_to_wheel.cpp b/src/software/physics/euclidean_to_wheel.cpp index 3359e8db13..2a9fef5fac 100644 --- a/src/software/physics/euclidean_to_wheel.cpp +++ b/src/software/physics/euclidean_to_wheel.cpp @@ -12,8 +12,8 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ : robot_constants_(robot_constants) { // Angles [rads] - auto p = robot_constants_.front_wheel_angle_deg * M_PI / 180.; - auto t = robot_constants_.back_wheel_angle_deg * M_PI / 180.; + double p = robot_constants_.front_wheel_angle_deg * M_PI / 180.; + double t = robot_constants_.back_wheel_angle_deg * M_PI / 180.; // Beta is angle of wheel rolling direction relative to X-axis // LOOK AT (software)/src/shared/robot_constants.h to see X-axis From 72622007e89c9b558e9d3a8cd0e3187046fa660a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Fri, 22 May 2026 23:28:09 +0000 Subject: [PATCH 11/19] [pre-commit.ci lite] apply automatic fixes --- src/shared/robot_constants.h | 9 ++++----- src/software/physics/euclidean_to_wheel_test.cpp | 4 +++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/shared/robot_constants.h b/src/shared/robot_constants.h index 18eac3998f..8707791e10 100644 --- a/src/shared/robot_constants.h +++ b/src/shared/robot_constants.h @@ -105,8 +105,8 @@ constexpr RobotConstants createRobotConstants() .front_wheel_x_mag = 0.03485f, .front_wheel_y_mag = 0.06632f, - .back_wheel_x_mag = 0.04985f, - .back_wheel_y_mag = 0.05592f, + .back_wheel_x_mag = 0.04985f, + .back_wheel_y_mag = 0.05592f, .front_of_robot_width_meters = 0.11f, .dribbler_width_meters = 0.07825f, @@ -128,9 +128,8 @@ constexpr RobotConstants createRobotConstants() .robot_max_ang_acceleration_rad_per_s_2 = 30.0f, .wheel_radius_meters = 0.03f, - - .expected_lever_arm = 0.0749f - }; + + .expected_lever_arm = 0.0749f}; } #elif CHECK_VERSION(2021) constexpr RobotConstants createRobotConstants() diff --git a/src/software/physics/euclidean_to_wheel_test.cpp b/src/software/physics/euclidean_to_wheel_test.cpp index 9910bdddaf..4c57d9ed47 100644 --- a/src/software/physics/euclidean_to_wheel_test.cpp +++ b/src/software/physics/euclidean_to_wheel_test.cpp @@ -1,6 +1,7 @@ #include "software/physics/euclidean_to_wheel.h" #include + #include "proto/primitive/primitive_msg_factory.h" #include "software/test_util/test_util.h" @@ -14,7 +15,8 @@ class EuclideanToWheelTest : public ::testing::Test robot_constants::RobotConstants robot_constants = robot_constants::createRobotConstants(); double robot_radius = robot_constants::createRobotConstants().robot_radius_m; - double expected_lever_arm = robot_constants::createRobotConstants().expected_lever_arm; + double expected_lever_arm = + robot_constants::createRobotConstants().expected_lever_arm; const float EQUALITY_COMPARISON = 0.001f; WheelSpace_t target_wheel_velocity{}; From 5b55d1c1eef1c7a26ffecba94fc038f374ddb8a4 Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Sat, 23 May 2026 15:03:48 -0700 Subject: [PATCH 12/19] updated ascii --- src/shared/robot_constants.h | 48 +++++++++++---------- src/software/physics/euclidean_to_wheel.cpp | 16 +++---- 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/shared/robot_constants.h b/src/shared/robot_constants.h index 8707791e10..bb5764e378 100644 --- a/src/shared/robot_constants.h +++ b/src/shared/robot_constants.h @@ -19,21 +19,22 @@ struct RobotConstants // // The angles are assumed to be symmetric for the left and right sides of the robot. // - // y - // ▲ - // | - // Back wheel │ Front wheel - // └────────► , - │ - , ◄───────┘ - // , '\ │ /' , - // , \ B │ A / │ - // , \ │ / │ - // , \ │ / │ - // , └────────┼───────► x Front of robot - // , │ - // , │ - // , │ - // , .' - // ' - , _ , ' + // FRONT OF ROBOT + // | ▲ X-Axis + // | / -------+--------- \ eric + // |A / .' │ '. \ ◄─── Front wheel + // | /.' │ .'.\ grayson + // |// │ . \\ samuel + // ; │ . Lever ; + // | │ . Arm | + // ◄─────┼──────────────┼ | + // Y-Axis| | + // ; ; + // |\\ // + // | \'. .'/ + // |B \ '. .' / ◄─── Back wheel + // | \ '-. _.-' / + // | ''------'' // The angle between y-axis of the robot and the front wheel axles [degrees] float front_wheel_angle_deg; @@ -42,16 +43,16 @@ struct RobotConstants float back_wheel_angle_deg; // X position of centre of front wheel - float front_wheel_x_mag; + float front_wheel_x_magnitude_meters; // Y position of centre of front wheel - float front_wheel_y_mag; + float front_wheel_y_magnitude_meters; // X position of centre of rear wheel - float back_wheel_x_mag; + float back_wheel_x_magnitude_meters; // Y position of centre of rear wheel - float back_wheel_y_mag; + float back_wheel_y_magnitude_meters; // The total width of the entire flat face on the front of the robot [meters] float front_of_robot_width_meters; @@ -87,6 +88,7 @@ struct RobotConstants // The radius of the wheel, in meters float wheel_radius_meters; + // Computed by finding sqrt(x^2 + y^2) of front and rear wheels. Both equal float expected_lever_arm; }; @@ -103,10 +105,10 @@ constexpr RobotConstants createRobotConstants() .front_wheel_angle_deg = 32.0f, .back_wheel_angle_deg = 44.0f, - .front_wheel_x_mag = 0.03485f, - .front_wheel_y_mag = 0.06632f, - .back_wheel_x_mag = 0.04985f, - .back_wheel_y_mag = 0.05592f, + .front_wheel_x_magnitude_meters = 0.03485f, + .front_wheel_y_magnitude_meters = 0.06632f, + .back_wheel_x_magnitude_meters = 0.04985f, + .back_wheel_y_magnitude_meters = 0.05592f, .front_of_robot_width_meters = 0.11f, .dribbler_width_meters = 0.07825f, diff --git a/src/software/physics/euclidean_to_wheel.cpp b/src/software/physics/euclidean_to_wheel.cpp index 2a9fef5fac..9028054ebf 100644 --- a/src/software/physics/euclidean_to_wheel.cpp +++ b/src/software/physics/euclidean_to_wheel.cpp @@ -23,14 +23,14 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ double b_br = (M_PI - t); // Mapped to the robot frame: +X = Forward, +Y = Left - double fr_x = robot_constants_.front_wheel_x_mag; - double fr_y = robot_constants_.front_wheel_y_mag * -1.0; - double fl_x = robot_constants_.front_wheel_x_mag; - double fl_y = robot_constants_.front_wheel_y_mag; - double bl_x = robot_constants_.back_wheel_x_mag * -1.0; - double bl_y = robot_constants_.back_wheel_y_mag; - double br_x = robot_constants_.back_wheel_x_mag * -1.0; - double br_y = robot_constants_.back_wheel_y_mag * -1.0; + double fr_x = robot_constants_.front_wheel_x_magnitude_meters; + double fr_y = robot_constants_.front_wheel_y_magnitude_meters * -1.0; + double fl_x = robot_constants_.front_wheel_x_magnitude_meters; + double fl_y = robot_constants_.front_wheel_y_magnitude_meters; + double bl_x = robot_constants_.back_wheel_x_magnitude_meters * -1.0; + double bl_y = robot_constants_.back_wheel_y_magnitude_meters; + double br_x = robot_constants_.back_wheel_x_magnitude_meters * -1.0; + double br_y = robot_constants_.back_wheel_y_magnitude_meters * -1.0; // Assuming that CCW when looking end of shaft into motor is the positive direction. From 2fc875cb5dbc4257b6f9a8e2ee16a19fe1fd689e Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Sat, 23 May 2026 15:04:48 -0700 Subject: [PATCH 13/19] clang formatting --- src/shared/robot_constants.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shared/robot_constants.h b/src/shared/robot_constants.h index bb5764e378..39296b7199 100644 --- a/src/shared/robot_constants.h +++ b/src/shared/robot_constants.h @@ -7,6 +7,7 @@ namespace robot_constants struct RobotConstants { + // The radius of the robot [m] float robot_radius_m; @@ -16,7 +17,8 @@ struct RobotConstants // In the ASCII diagram below: // - front_wheel_angle_deg = A // - back_wheel_angle_deg = B - // + + // clang-format off // The angles are assumed to be symmetric for the left and right sides of the robot. // // FRONT OF ROBOT @@ -35,6 +37,7 @@ struct RobotConstants // |B \ '. .' / ◄─── Back wheel // | \ '-. _.-' / // | ''------'' + // clang-format on // The angle between y-axis of the robot and the front wheel axles [degrees] float front_wheel_angle_deg; From 1f2f5ac6a7d61333be7072082a5193dfa603263c Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Sat, 23 May 2026 15:05:30 -0700 Subject: [PATCH 14/19] clang formatting part 2 --- src/shared/robot_constants.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shared/robot_constants.h b/src/shared/robot_constants.h index 39296b7199..494866f9b7 100644 --- a/src/shared/robot_constants.h +++ b/src/shared/robot_constants.h @@ -11,14 +11,14 @@ struct RobotConstants // The radius of the robot [m] float robot_radius_m; + // clang-format off + // The front_wheel_angle_deg and back_wheel_angle_deg are measured as absolute // angles from the robot's y-axis to each wheel axle. // // In the ASCII diagram below: // - front_wheel_angle_deg = A // - back_wheel_angle_deg = B - - // clang-format off // The angles are assumed to be symmetric for the left and right sides of the robot. // // FRONT OF ROBOT @@ -37,6 +37,7 @@ struct RobotConstants // |B \ '. .' / ◄─── Back wheel // | \ '-. _.-' / // | ''------'' + // clang-format on // The angle between y-axis of the robot and the front wheel axles [degrees] From 501ab8906db7641047b8ad17689a7de1a0887636 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sat, 23 May 2026 22:12:19 +0000 Subject: [PATCH 15/19] [pre-commit.ci lite] apply automatic fixes --- src/shared/robot_constants.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/shared/robot_constants.h b/src/shared/robot_constants.h index 494866f9b7..4488385754 100644 --- a/src/shared/robot_constants.h +++ b/src/shared/robot_constants.h @@ -7,7 +7,6 @@ namespace robot_constants struct RobotConstants { - // The radius of the robot [m] float robot_radius_m; @@ -37,7 +36,7 @@ struct RobotConstants // |B \ '. .' / ◄─── Back wheel // | \ '-. _.-' / // | ''------'' - + // clang-format on // The angle between y-axis of the robot and the front wheel axles [degrees] From 78245e1b7446bfb5f769a3e5caaa8b949435e5dc Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Sat, 23 May 2026 19:17:45 -0700 Subject: [PATCH 16/19] Const Declarations, Inverse Rewritten --- src/software/physics/euclidean_to_wheel.cpp | 34 ++++++++++----------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/software/physics/euclidean_to_wheel.cpp b/src/software/physics/euclidean_to_wheel.cpp index 9028054ebf..ea92987f57 100644 --- a/src/software/physics/euclidean_to_wheel.cpp +++ b/src/software/physics/euclidean_to_wheel.cpp @@ -12,25 +12,25 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ : robot_constants_(robot_constants) { // Angles [rads] - double p = robot_constants_.front_wheel_angle_deg * M_PI / 180.; - double t = robot_constants_.back_wheel_angle_deg * M_PI / 180.; + const double p = robot_constants_.front_wheel_angle_deg * M_PI / 180.; + const double t = robot_constants_.back_wheel_angle_deg * M_PI / 180.; // Beta is angle of wheel rolling direction relative to X-axis // LOOK AT (software)/src/shared/robot_constants.h to see X-axis - double b_fr = -(M_PI - p); - double b_fl = -p; - double b_bl = t; - double b_br = (M_PI - t); + const double b_fr = -(M_PI - p); + const double b_fl = -p; + const double b_bl = t; + const double b_br = (M_PI - t); // Mapped to the robot frame: +X = Forward, +Y = Left - double fr_x = robot_constants_.front_wheel_x_magnitude_meters; - double fr_y = robot_constants_.front_wheel_y_magnitude_meters * -1.0; - double fl_x = robot_constants_.front_wheel_x_magnitude_meters; - double fl_y = robot_constants_.front_wheel_y_magnitude_meters; - double bl_x = robot_constants_.back_wheel_x_magnitude_meters * -1.0; - double bl_y = robot_constants_.back_wheel_y_magnitude_meters; - double br_x = robot_constants_.back_wheel_x_magnitude_meters * -1.0; - double br_y = robot_constants_.back_wheel_y_magnitude_meters * -1.0; + const double fr_x = robot_constants_.front_wheel_x_magnitude_meters; + const double fr_y = robot_constants_.front_wheel_y_magnitude_meters * -1.0; + const double fl_x = robot_constants_.front_wheel_x_magnitude_meters; + const double fl_y = robot_constants_.front_wheel_y_magnitude_meters; + const double bl_x = robot_constants_.back_wheel_x_magnitude_meters * -1.0; + const double bl_y = robot_constants_.back_wheel_y_magnitude_meters; + const double br_x = robot_constants_.back_wheel_x_magnitude_meters * -1.0; + const double br_y = robot_constants_.back_wheel_y_magnitude_meters * -1.0; // Assuming that CCW when looking end of shaft into motor is the positive direction. @@ -52,10 +52,8 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ // was calculated using Wolfram Alpha: https://bit.ly/3A08BJX // Calculate Pseudo-inverse dynamically - wheel_to_euclidean_velocity_D_inverse_ = - (euclidean_to_wheel_velocity_D_.transpose() * euclidean_to_wheel_velocity_D_) - .inverse() * - euclidean_to_wheel_velocity_D_.transpose(); + + wheel_to_euclidean_velocity_D_inverse_ = euclidean_to_wheel_velocity_D_.completeOrthogonalDecomposition().pseudoInverse(); } WheelSpace_t EuclideanToWheel::getWheelVelocity(EuclideanSpace_t euclidean_velocity) const From 6455b485fad5ee91470467c8eb5d63847ac8eb7a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 02:23:15 +0000 Subject: [PATCH 17/19] [pre-commit.ci lite] apply automatic fixes --- src/software/physics/euclidean_to_wheel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/software/physics/euclidean_to_wheel.cpp b/src/software/physics/euclidean_to_wheel.cpp index ea92987f57..cb9a3d01b3 100644 --- a/src/software/physics/euclidean_to_wheel.cpp +++ b/src/software/physics/euclidean_to_wheel.cpp @@ -53,7 +53,8 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ // Calculate Pseudo-inverse dynamically - wheel_to_euclidean_velocity_D_inverse_ = euclidean_to_wheel_velocity_D_.completeOrthogonalDecomposition().pseudoInverse(); + wheel_to_euclidean_velocity_D_inverse_ = + euclidean_to_wheel_velocity_D_.completeOrthogonalDecomposition().pseudoInverse(); } WheelSpace_t EuclideanToWheel::getWheelVelocity(EuclideanSpace_t euclidean_velocity) const From 68b301af7b0afc85720d4d70c99ce028411da972 Mon Sep 17 00:00:00 2001 From: sunghyuneun Date: Tue, 26 May 2026 13:32:39 -0700 Subject: [PATCH 18/19] Finishing touches --- src/shared/robot_constants.h | 50 +++++++++++++------ src/software/physics/euclidean_to_wheel.cpp | 16 +++--- .../physics/euclidean_to_wheel_test.cpp | 2 - 3 files changed, 42 insertions(+), 26 deletions(-) diff --git a/src/shared/robot_constants.h b/src/shared/robot_constants.h index 4488385754..d050ff0562 100644 --- a/src/shared/robot_constants.h +++ b/src/shared/robot_constants.h @@ -45,22 +45,34 @@ struct RobotConstants // The angle between y-axis of the robot and the rear wheel axles [degrees] float back_wheel_angle_deg; - // X position of centre of front wheel - float front_wheel_x_magnitude_meters; + // X position of centre of front right wheel + float fr_x_pos_meters; - // Y position of centre of front wheel - float front_wheel_y_magnitude_meters; + // Y position of centre of front right wheel + float fr_y_pos_meters; - // X position of centre of rear wheel - float back_wheel_x_magnitude_meters; + // X position of centre of front left wheel + float fl_x_pos_meters; - // Y position of centre of rear wheel - float back_wheel_y_magnitude_meters; + // Y position of centre of front left wheel + float fl_y_pos_meters; - // The total width of the entire flat face on the front of the robot [meters] + // X position of centre of back left wheel + float bl_x_pos_meters; + + // Y position of centre of back left wheel + float bl_y_pos_meters; + + // X position of centre of back right wheel + float br_x_pos_meters; + + // Y position of centre of back right wheel + float br_y_pos_meters; + + // The total width of the entire flat face on the front of the robot [metres] float front_of_robot_width_meters; - // The distance from one end of the dribbler to the other [meters] + // The distance from one end of the dribbler to the other [metres] float dribbler_width_meters; // Indefinite dribbler mode sets a speed that can be maintained indefinitely [rpm] @@ -88,10 +100,12 @@ struct RobotConstants // The maximum angular acceleration achievable by our robots [rad/s^2] float robot_max_ang_acceleration_rad_per_s_2; - // The radius of the wheel, in meters + // The radius of the wheel, in metres float wheel_radius_meters; - // Computed by finding sqrt(x^2 + y^2) of front and rear wheels. Both equal + // Distance [metres] from centre of robot to centre of wheel. + // Found by sqrt(x^2 + y^2) of a wheel. + // Front wheel arm = Rear wheel arm. See ASCII image above. float expected_lever_arm; }; @@ -108,10 +122,14 @@ constexpr RobotConstants createRobotConstants() .front_wheel_angle_deg = 32.0f, .back_wheel_angle_deg = 44.0f, - .front_wheel_x_magnitude_meters = 0.03485f, - .front_wheel_y_magnitude_meters = 0.06632f, - .back_wheel_x_magnitude_meters = 0.04985f, - .back_wheel_y_magnitude_meters = 0.05592f, + .fr_x_pos_meters = 0.03485f, + .fr_y_pos_meters = -0.06632f, + .fl_x_pos_meters = 0.03485f, + .fl_y_pos_meters = 0.06632f, + .bl_x_pos_meters = -0.04985f, + .bl_y_pos_meters = 0.05592f, + .br_x_pos_meters = -0.04985f, + .br_y_pos_meters = -0.05592f, .front_of_robot_width_meters = 0.11f, .dribbler_width_meters = 0.07825f, diff --git a/src/software/physics/euclidean_to_wheel.cpp b/src/software/physics/euclidean_to_wheel.cpp index ea92987f57..8dfe65b2d2 100644 --- a/src/software/physics/euclidean_to_wheel.cpp +++ b/src/software/physics/euclidean_to_wheel.cpp @@ -23,14 +23,14 @@ EuclideanToWheel::EuclideanToWheel(const robot_constants::RobotConstants& robot_ const double b_br = (M_PI - t); // Mapped to the robot frame: +X = Forward, +Y = Left - const double fr_x = robot_constants_.front_wheel_x_magnitude_meters; - const double fr_y = robot_constants_.front_wheel_y_magnitude_meters * -1.0; - const double fl_x = robot_constants_.front_wheel_x_magnitude_meters; - const double fl_y = robot_constants_.front_wheel_y_magnitude_meters; - const double bl_x = robot_constants_.back_wheel_x_magnitude_meters * -1.0; - const double bl_y = robot_constants_.back_wheel_y_magnitude_meters; - const double br_x = robot_constants_.back_wheel_x_magnitude_meters * -1.0; - const double br_y = robot_constants_.back_wheel_y_magnitude_meters * -1.0; + const double fr_x = robot_constants_.fr_x_pos_meters; + const double fr_y = robot_constants_.fr_y_pos_meters; + const double fl_x = robot_constants_.fl_x_pos_meters; + const double fl_y = robot_constants_.fl_y_pos_meters; + const double bl_x = robot_constants_.bl_x_pos_meters; + const double bl_y = robot_constants_.bl_y_pos_meters; + const double br_x = robot_constants_.br_x_pos_meters; + const double br_y = robot_constants_.br_y_pos_meters; // Assuming that CCW when looking end of shaft into motor is the positive direction. diff --git a/src/software/physics/euclidean_to_wheel_test.cpp b/src/software/physics/euclidean_to_wheel_test.cpp index 4c57d9ed47..0890f6cde9 100644 --- a/src/software/physics/euclidean_to_wheel_test.cpp +++ b/src/software/physics/euclidean_to_wheel_test.cpp @@ -148,8 +148,6 @@ TEST_F(EuclideanToWheelTest, test_target_wheel_speeds_positive_w_magnitude) // Because the wheels are offset, their speed at 1 rad/s equals their // exact physical lever arm (in meters), NOT the nominal robot_radius. - // Based on the physical offsets, the lever arm evaluates to 0.0749 meters. - EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_RIGHT_WHEEL_SPACE_INDEX]), expected_lever_arm, EQUALITY_COMPARISON); EXPECT_NEAR(std::abs(calculated_wheel_speeds[FRONT_LEFT_WHEEL_SPACE_INDEX]), From 32d0eec303eade32a9854312d747994e5694655e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Tue, 26 May 2026 21:24:37 +0000 Subject: [PATCH 19/19] [pre-commit.ci lite] apply automatic fixes --- src/shared/robot_constants.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/robot_constants.h b/src/shared/robot_constants.h index d050ff0562..00a77c94da 100644 --- a/src/shared/robot_constants.h +++ b/src/shared/robot_constants.h @@ -103,7 +103,7 @@ struct RobotConstants // The radius of the wheel, in metres float wheel_radius_meters; - // Distance [metres] from centre of robot to centre of wheel. + // Distance [metres] from centre of robot to centre of wheel. // Found by sqrt(x^2 + y^2) of a wheel. // Front wheel arm = Rear wheel arm. See ASCII image above. float expected_lever_arm;