Skip to content

fixed toi < 0.0 crash in AL-IPC#406

Merged
MuGdxy merged 2 commits intospiriMirror:mainfrom
wiso-enoji:pr-fix-crash
Mar 26, 2026
Merged

fixed toi < 0.0 crash in AL-IPC#406
MuGdxy merged 2 commits intospiriMirror:mainfrom
wiso-enoji:pr-fix-crash

Conversation

@wiso-enoji
Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical stability issue within the AL-IPC solver, specifically targeting a crash scenario where the time of impact (toi) becomes negative or extremely small. The change introduces a robust conditional check, preventing an operation from being executed with an invalid alpha value, thereby significantly enhancing the reliability and robustness of the simulation engine.

Highlights

  • Crash Fix: Implemented a safeguard to prevent crashes caused by toi < 0.0 in the AL-IPC system by ensuring the alpha parameter is positive before advancing non-penetration positions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

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

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 introduces a conditional check before calling advance_non_penetrate_positions, ensuring it's only executed when alpha exceeds a certain threshold. The review suggests replacing the magic number 1e-6 with a named constant, ideally m_global_active_set_manager->toi_threshold(), to enhance code readability, maintainability, and consistency.

m_global_active_set_manager->post_ccd();

m_global_active_set_manager->advance_non_penetrate_positions(alpha);
if(alpha > 1e-6)
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

Using a magic number like 1e-6 can make the code harder to understand and maintain. It's better to define it as a named constant to clarify its purpose. Consider using the existing configurable toi_threshold from GlobalActiveSetManager, as it seems to serve a similar purpose of defining a tolerance for the time of impact. This would improve consistency and make the threshold configurable without code changes.

                    if(alpha > m_global_active_set_manager->toi_threshold())

…und in AL-IPC

Introduce `contact/al-ipc/alpha_lower_bound` (default 1e-6) to replace the hardcoded threshold guarding `advance_non_penetrate_positions`.

Made-with: Cursor
@MuGdxy MuGdxy merged commit 2659804 into spiriMirror:main Mar 26, 2026
10 of 12 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