Skip to content

fix(cuda): align prismatic joint limit distance coordinate - #460

Merged
MuGdxy merged 2 commits into
spiriMirror:mainfrom
Ligo04:fix/prismatic-joint-limit-distance
May 19, 2026
Merged

fix(cuda): align prismatic joint limit distance coordinate#460
MuGdxy merged 2 commits into
spiriMirror:mainfrom
Ligo04:fix/prismatic-joint-limit-distance

Conversation

@Ligo04

@Ligo04 Ligo04 commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Align prismatic joint limit evaluation with the base joint's raw distance coordinate so user-facing lower/upper bounds match the reported distance semantics.
  • Add generated distance derivative/Hessian helpers used by the absolute-distance limit path.
  • Update prismatic joint limit documentation and simulation cases for the new coordinate behavior.

Test plan

  • XMAKE_ROOT=y xmake build sim_case
  • XMAKE_ROOT=y xmake run sim_case 51_abd_prismatic_joint_limit
  • XMAKE_ROOT=y xmake run sim_case 52_abd_revolute_joint_limit

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>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 1351 to 1357
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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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>
@MuGdxy
MuGdxy merged commit 292c98c into spiriMirror:main May 19, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants