Skip to content

Add missing parameters for Mujoco Solver#424

Merged
eric-heiden merged 6 commits into
newton-physics:mainfrom
jvonmuralt:add_missing_parameters
Jul 16, 2025
Merged

Add missing parameters for Mujoco Solver#424
eric-heiden merged 6 commits into
newton-physics:mainfrom
jvonmuralt:add_missing_parameters

Conversation

@jvonmuralt

@jvonmuralt jvonmuralt commented Jul 16, 2025

Copy link
Copy Markdown
Member

Description

Newton Migration Guide

Please ensure the migration guide for warp.sim users is up-to-date with the changes made in this MR.

  • The migration guide in docs/migration.rst is up-to date

Before your PR is "Ready for review"

  • All commits are signed-off to indicate that your contribution adheres to the Developer Certificate of Origin requirements
  • Necessary tests have been added and new examples are tested (see newton/tests/test_examples.py)
  • Documentation is up-to-date
  • Code passes formatting and linting checks with pre-commit run -a

Summary by CodeRabbit

  • New Features
    • Added new options to configure the contact friction cone type and frictional-to-normal constraint impedance ratio in the solver settings.
    • Users can now specify the friction cone as either "pyramidal" or "elliptic", or by integer value, for greater flexibility in contact modeling.

@coderabbitai

coderabbitai Bot commented Jul 16, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The changes add two new parameters, cone and impratio, to the MuJoCoSolver class and its convert_to_mjc method. These parameters allow configuration of the contact friction cone type and the frictional-to-normal constraint impedance ratio. The new options are integrated into the solver initialization and MuJoCo model setup.

Changes

File(s) Change Summary
newton/solvers/mujoco/solver_mujoco.py Added cone and impratio parameters to MuJoCoSolver constructor and convert_to_mjc; mapped string cone values to MuJoCo constants; assigned these options to MuJoCo model spec and compiled model; updated method and constructor signatures.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MuJoCoSolver
    participant MuJoCoModel

    User->>MuJoCoSolver: Initialize(cone, impratio, ...)
    MuJoCoSolver->>MuJoCoSolver: convert_to_mjc(cone, impratio, ...)
    MuJoCoSolver->>MuJoCoModel: Set option.cone and option.impratio
    MuJoCoSolver->>MuJoCoModel: Compile model
    MuJoCoSolver->>MuJoCoModel: Set opt.cone and opt.impratio
Loading

📜 Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48865d7373f1db9dd182cc52298c33f71049eb40 and ada1ac6.

📒 Files selected for processing (1)
  • newton/solvers/mujoco/solver_mujoco.py (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • newton/solvers/mujoco/solver_mujoco.py
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 399d549 and 48865d7373f1db9dd182cc52298c33f71049eb40.

📒 Files selected for processing (1)
  • newton/solvers/mujoco/solver_mujoco.py (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: Kenny-Vilella
PR: newton-physics/newton#398
File: newton/examples/example_mujoco.py:352-352
Timestamp: 2025-07-14T03:57:29.659Z
Learning: The use_mujoco option in newton/examples/example_mujoco.py is currently unsupported and causes crashes. The code automatically disables this option with a warning message when users attempt to enable it. This is intentionally kept as a placeholder for future implementation.
🔇 Additional comments (6)
newton/solvers/mujoco/solver_mujoco.py (6)

756-757: Parameter additions look good.

The new parameters are properly typed and have sensible default values. The cone parameter accepts both integer and string values, and impratio is a float with a default of 1.0.


779-780: Documentation is clear and informative.

The parameter descriptions accurately explain the purpose of each parameter - contact friction cone type and frictional-to-normal constraint impedance ratio.


816-817: Parameters correctly passed to convert_to_mjc method.

The constructor properly forwards the new parameters to the convert_to_mjc method for processing.


1179-1183: String to constant conversion logic is correct.

The mapping from string values to MuJoCo constants is properly implemented with appropriate fallback to mjCONE_PYRAMIDAL for unknown strings.


1201-1202: MuJoCo spec options correctly configured.

The cone and impratio parameters are properly set in the MuJoCo specification object, ensuring they will be used during model compilation.


1694-1700: Model options correctly applied after compilation.

The parameters are properly set on the compiled model's options, ensuring they take effect during simulation. The assignment to both cone and impratio is correct.

Comment thread newton/solvers/mujoco/solver_mujoco.py Outdated
@jvonmuralt jvonmuralt had a problem deploying to external-pr-approval July 16, 2025 13:30 — with GitHub Actions Error
jvonmuralt and others added 5 commits July 16, 2025 15:30
Signed-off-by: Julia von Muralt <jvonmuralt@nvidia.com>
Signed-off-by: Julia von Muralt <jvonmuralt@nvidia.com>
Signed-off-by: Julia von Muralt <jvonmuralt@nvidia.com>
Signed-off-by: Julia von Muralt <jvonmuralt@nvidia.com>
Signed-off-by: Julia von Muralt <jvonmuralt@nvidia.com>
@jvonmuralt jvonmuralt force-pushed the add_missing_parameters branch from a844eec to ada1ac6 Compare July 16, 2025 13:30
@jvonmuralt jvonmuralt temporarily deployed to external-pr-approval July 16, 2025 13:31 — with GitHub Actions Inactive

@eric-heiden eric-heiden left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, looks good!

@eric-heiden eric-heiden enabled auto-merge (squash) July 16, 2025 15:26
@eric-heiden eric-heiden temporarily deployed to external-pr-approval July 16, 2025 15:26 — with GitHub Actions Inactive
@eric-heiden eric-heiden merged commit e649ced into newton-physics:main Jul 16, 2025
10 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Oct 20, 2025
4 tasks
eric-heiden pushed a commit to eric-heiden/newton that referenced this pull request Jan 28, 2026
Signed-off-by: Julia von Muralt <jvonmuralt@nvidia.com>
vidurv-nvidia pushed a commit to vidurv-nvidia/newton that referenced this pull request Mar 6, 2026
A few fixes and hacks to fix recent failures in unit tests:

- TODO: enable ground plane again in tiled_camera and multi_tiled_camera
tests
- TODO: enable factory mesh insertion task when fixed in physics
- TODO: enable teddy bear environment in test_environments.py
- TODO: check if scipy test threshold makes sense

<!-- As a practice, it is recommended to open an issue to have
discussions on the proposed pull request.
This makes it easier for the community to keep track of what is being
developed or added, and if a given feature
is demanded by more than one party. -->

<!-- As you go through the list, delete the ones that are not
applicable. -->

- Bug fix (non-breaking change which fixes an issue)

Please attach before and after screenshots of the change if applicable.

<!--
Example:

| Before | After |
| ------ | ----- |
| _gif/png before_ | _gif/png after_ |

To upload images to a PR -- simply drag and drop an image while in edit
mode and it should upload the image directly. You can then paste that
source into the above before/after sections.
-->

- [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->

---------

Co-authored-by: Rafael Wiltz <rwiltz@nvidia.com>
mmacklin pushed a commit to mmacklin/newton that referenced this pull request Apr 7, 2026
Signed-off-by: Julia von Muralt <jvonmuralt@nvidia.com>
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