Euclidean Debug#3731
Conversation
Formatting accidentally deleted a requirements_lock This reverts commit 7f7fb0f.
Andrewyx
left a comment
There was a problem hiding this comment.
Nice work! Left some comments
| 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; |
There was a problem hiding this comment.
- We should store these constants in
robot_constants.halongside and also update the diagram for the wheel orientations in the meantime
| euclidean_to_wheel_velocity_D_.transpose(); | ||
| } | ||
|
|
||
| #else |
There was a problem hiding this comment.
- Either delete the legacy code or add a TODO & issue for removing this old code in the future.
| 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 |
There was a problem hiding this comment.
We know all of these values statically, is there some way to compute everything before runtime in this case? Can this entire constructor be constexpr?
| 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); |
There was a problem hiding this comment.
|
|
||
| // 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; |
| auto p = robot_constants_.front_wheel_angle_deg * M_PI / 180.; | ||
| auto t = robot_constants_.back_wheel_angle_deg * M_PI / 180.; |
There was a problem hiding this comment.
No need for auto here, and also statically known values
Andrewyx
left a comment
There was a problem hiding this comment.
Almost there, left some comments!
| // 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; | ||
|
|
There was a problem hiding this comment.
what is mag? Note that we should ideally keep units in the name too e.g. front_wheel_x_meters -> // X position of centre of front wheel relative to the center of the robot.
There was a problem hiding this comment.
nit: we should replace magnitude with pos, because I think position is more specific than just magnitude.
| .wheel_radius_meters = 0.03f}; | ||
| .wheel_radius_meters = 0.03f, | ||
|
|
||
| .expected_lever_arm = 0.0749f}; |
There was a problem hiding this comment.
How is this computed? Also can you label this somewhere in the ASCII diagram or something to better explain what this value points to?
StarrryNight
left a comment
There was a problem hiding this comment.
nice work. Left some comment on code quality and inversing matrices.
| .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, | ||
|
|
| // Computed by finding sqrt(x^2 + y^2) of front and rear wheels. Both equal | ||
| float expected_lever_arm; | ||
| }; |
There was a problem hiding this comment.
perhaps link some sort of graphic or wiki link here? I am still a bit confused as to what this is referring to wrt the geometry of the robot
|
Nice work! This looks basically done, I left two very minor comments regarding docs, but otherwise, I think this is ready to go 🚀 |
…hyuneun/tb-software into sunghyuneun/euclidean_debug
GrayHoang
left a comment
There was a problem hiding this comment.
Looks good, good work on this
| // FRONT OF ROBOT | ||
| // | ▲ X-Axis | ||
| // | / -------+--------- \ eric | ||
| // |A / .' │ '. \ ◄─── Front wheel | ||
| // | /.' │ .'.\ grayson | ||
| // |// │ . \\ samuel | ||
| // ; │ . Lever ; | ||
| // | │ . Arm | | ||
| // ◄─────┼──────────────┼ | | ||
| // Y-Axis| | | ||
| // ; ; | ||
| // |\\ // | ||
| // | \'. .'/ | ||
| // |B \ '. .' / ◄─── Back wheel | ||
| // | \ '-. _.-' / | ||
| // | ''------'' | ||
|
|
||
| // clang-format on |
There was a problem hiding this comment.
this ASCII art is ass-key. Make better? :)
| float robot_max_ang_acceleration_rad_per_s_2; | ||
|
|
||
| // The radius of the wheel, in meters | ||
| // The radius of the wheel, in metres |
There was a problem hiding this comment.
WHAT THE FUCK IS A MILE
Description
Rewrote the inverse kinematics logic for increased readability and correctness.
Revised wrong tests to be correct.
Testing Done
Also edited
euclidean_to_wheel_test.cpp, and passed all tests in it.Resolved Issues
Resolves #3722
Length Justification and Key Files to Review
Review Checklist
It is the reviewers responsibility to also make sure every item here has been covered
.hfile) should have a javadoc style comment at the start of them. For examples, see the functions defined inthunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.TODO(or similar) statements should either be completed or associated with a github issue