fix(cuda): align prismatic joint limit distance coordinate - #460
Conversation
Use the prismatic joint distance coordinate directly for limit penalties so user-facing lower and upper bounds match the reported distance semantics. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Code Review
This pull request refactors the affine body prismatic joint limit implementation to utilize absolute distance calculations and their derivatives, replacing the previous incremental method. The updates span the CUDA backend, symbol calculation scripts, and documentation. Test cases for prismatic and revolute joint limits were also updated to include logging for distances and angles. A review comment identifies unused variables lb and rb in the CUDA implementation that should be removed to clean up the code.
| Vector6 lb; | ||
| lb.segment<3>(0) = rest_c.segment<3>(0); | ||
| lb.segment<3>(3) = rest_t.segment<3>(0); | ||
| lb.segment<3>(0) = C_bar.segment<3>(0); | ||
| lb.segment<3>(3) = t_bar.segment<3>(0); | ||
| Vector6 rb; | ||
| rb.segment<3>(0) = rest_c.segment<3>(3); | ||
| rb.segment<3>(3) = rest_t.segment<3>(3); | ||
| rb.segment<3>(0) = C_bar.segment<3>(3); | ||
| rb.segment<3>(3) = t_bar.segment<3>(3); | ||
|
|
There was a problem hiding this comment.
The variables lb and rb are constructed by repacking C_bar and t_bar, but they are no longer used in this function after the refactoring to use compute_absolute_distance and its derivatives. These lines, along with the following empty line, should be removed to clean up the code and avoid unnecessary operations.
Drop stale lb/rb packing left after switching prismatic limits to absolute distance helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
distancesemantics.Test plan
XMAKE_ROOT=y xmake build sim_caseXMAKE_ROOT=y xmake run sim_case 51_abd_prismatic_joint_limitXMAKE_ROOT=y xmake run sim_case 52_abd_revolute_joint_limit