Skip to content

Update documentation of ArticulationView, MuJoCoSolver#459

Merged
eric-heiden merged 5 commits into
newton-physics:mainfrom
eric-heiden:doc-selection-api-mjc
Jul 23, 2025
Merged

Update documentation of ArticulationView, MuJoCoSolver#459
eric-heiden merged 5 commits into
newton-physics:mainfrom
eric-heiden:doc-selection-api-mjc

Conversation

@eric-heiden

@eric-heiden eric-heiden commented Jul 22, 2025

Copy link
Copy Markdown
Member

Description

Fixes #306 and #422.

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

  • Documentation
    • Improved and expanded docstrings for several classes and methods, including enhanced usage and debugging instructions for MuJoCoSolver.
    • Updated and clarified documentation for attribute access and manipulation methods in ArticulationView.
    • Corrected references and formatting in method documentation for improved clarity.

Signed-off-by: Eric Heiden <eheiden@nvidia.com>
Signed-off-by: Eric Heiden <eheiden@nvidia.com>
Signed-off-by: Eric Heiden <eheiden@nvidia.com>
Signed-off-by: Eric Heiden <eheiden@nvidia.com>
@eric-heiden eric-heiden requested review from mmacklin and shi-eric July 22, 2025 22:50
@coderabbitai

coderabbitai Bot commented Jul 22, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Documentation was updated and expanded across several modules. The MuJoCo solver's docstring was revised to correct import paths and add a new section with debugging guidance. The selection utility received detailed docstrings for key methods, including a note about notifying the solver after modifying model attributes. A reference in a solver base method docstring was updated to point to the correct module for notification flags.

Changes

File(s) Change Summary
newton/solvers/mujoco/solver_mujoco.py Updated MuJoCoSolver docstring: corrected import path, added debugging instructions, new usage example.
newton/solvers/solver.py Updated docstring in notify_model_changed to reference notification flags from newton.sim.flags.
newton/utils/selection.py Added/expanded docstrings for get_attribute, set_attribute, set_root_transforms, and eval_fk methods in ArticulationView; noted need to notify solver after Model updates.

Estimated code review effort

1 (~5 minutes)

✨ 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.

@eric-heiden eric-heiden linked an issue Jul 22, 2025 that may be closed by this pull request

@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: 0

🧹 Nitpick comments (5)
newton/solvers/mujoco/solver_mujoco.py (1)

1027-1060: Valuable debugging section, but mention Mujoco ≥ 3 requirement

mujoco.viewer.launch_passive is only available from MuJoCo ≥ 3.0.
Add a short note to prevent confusion for users pinned to MuJoCo 2.x.

@@
-    import mujoco
-    import mujoco.viewer
+    import mujoco  # MuJoCo ≥ 3.0
+    import mujoco.viewer
newton/utils/selection.py (4)

545-554: Specify concrete return type in docstring

Returns: currently says array, which is vague and does not surface whether callers receive a plain Python list, NumPy array, or a wp.array. Using the concrete type (wp.array or wp.indexedarray) helps downstream users and Sphinx to hyperlink correctly.

-        Returns:
-            array: The attribute values (dtype matches the attribute).
+        Returns:
+            wp.array | wp.indexedarray: Attribute values (same dtype as the
+            underlying attribute).  Shape equals the number of articulations
+            selected by this view.

558-571: Docstring: clarify mask signature and cross-reference

  1. The mask parameter accepts a 1-D wp.array[bool] of shape (self.count,). Stating this up-front avoids misuse (e.g. passing Python lists of mismatched length).
  2. The Sphinx cross-reference should include the module path so that the link resolves (newton.solvers.solver.SolverBase instead of newton.solvers.SolverBase) unless an __init__.py re-export guarantees the shorter path.
-            mask (array): Mask of articulations in this ArticulationView (all by default).
+            mask (wp.array[bool], optional): Boolean mask of length
+            ``self.count`` selecting which articulations to update.  If
+            ``None`` (default) all articulations in this view are affected.

Please also double-check that the re-export exists; otherwise update the note to:

:meth:`newton.solvers.solver.SolverBase.notify_model_changed`

600-603: Use fully-qualified reference for eval_fk

Sphinx may not resolve ``:meth:eval_fk``` when multiple eval_fk` symbols exist.
Consider

Call :meth:`ArticulationView.eval_fk` …

to avoid ambiguity.


702-708: Add dtype / shape detail for mask argument

The parameter description for mask omits expected dtype and shape. Align with the pattern used elsewhere in this file.

-            mask (array): Mask of articulations in this ArticulationView (all by default).
+            mask (wp.array[bool], optional): Boolean mask of length
+            ``self.count`` specifying which articulations to process.  If
+            ``None`` (default) all articulations are updated.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e37f0d9 and a80626d.

⛔ Files ignored due to path filters (3)
  • docs/generated/core/newton.Mesh.rst is excluded by !**/generated/**
  • docs/generated/renderers/newton.utils.SimRendererOpenGL.rst is excluded by !**/generated/**
  • docs/generated/renderers/newton.utils.SimRendererUsd.rst is excluded by !**/generated/**
📒 Files selected for processing (3)
  • newton/solvers/mujoco/solver_mujoco.py (1 hunks)
  • newton/solvers/solver.py (1 hunks)
  • newton/utils/selection.py (3 hunks)
🧠 Learnings (1)
newton/solvers/mujoco/solver_mujoco.py (1)

Learnt from: Kenny-Vilella
PR: #398
File: newton/examples/example_mujoco.py:352-352
Timestamp: 2025-07-14T03:57:29.670Z
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 context used
🧠 Learnings (1)
newton/solvers/mujoco/solver_mujoco.py (1)

Learnt from: Kenny-Vilella
PR: #398
File: newton/examples/example_mujoco.py:352-352
Timestamp: 2025-07-14T03:57:29.670Z
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.

⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Run GPU Unit Tests on AWS EC2 (Pull Request)
  • GitHub Check: run-newton-tests / newton-unittests (windows-latest)
🔇 Additional comments (2)
newton/solvers/solver.py (1)

265-275: Docstring reference fixed – looks good

The module path for the NOTIFY_FLAG_* constants is now correctly documented as newton.sim.flags. No implementation changes are required.

newton/solvers/mujoco/solver_mujoco.py (1)

1020-1021: Import Path Verified

MuJoCoSolver is correctly re-exported in newton/solvers/__init__.py via:

from .mujoco import MuJoCoSolver
__all__ = [
    "FeatherstoneSolver",
    "MuJoCoSolver",
    …
]

The import newton.solvers.MuJoCoSolver will resolve as expected. No changes required.

@eric-heiden eric-heiden enabled auto-merge (squash) July 23, 2025 00:52
@eric-heiden eric-heiden merged commit d452571 into newton-physics:main Jul 23, 2025
10 checks passed
eric-heiden added a commit to eric-heiden/newton that referenced this pull request Jan 28, 2026
vidurv-nvidia pushed a commit to vidurv-nvidia/newton that referenced this pull request Mar 6, 2026
Allows cameras to be enabled when XR mode is active. By default, the
record_demos.py script will strip envs of any
cameras if xr mode is used. If `--enable_cameras` is passed as an
argument to the script, externals cameras will remain
and function.

<!--
Thank you for your interest in sending a pull request. Please make sure
to check the contribution guidelines.

Link:
https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html
-->

Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes newton-physics#2491

<!-- 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. -->

- New feature (non-breaking change which adds functionality)

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

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] 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
-->
mmacklin pushed a commit to mmacklin/newton that referenced this pull request Apr 7, 2026
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.

Add better docs on how to debug the MJWarp Integration Selection API: Document that user needs to notify the solver about model updates

2 participants