Document maximal vs. generalized coordinates, update overview page#859
Conversation
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughDocumentation-focused updates: added a "Generalized and maximal coordinates" section under Articulations, multiple guide/API doc edits (overview, solver docs, version bump), autosummary additions for utils, generator tweak to include full module docstrings, and small module/docstring additions in builder and solver modules. No behavioral or public API changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/concepts/articulations.rst (1)
207-229: Variable-name mixup (joint_index vs joint_id) and base index.You introduce
joint_indexbut then usejoint_id. Pick one consistently. Also explicitly state that axis arrays are indexed in the same order asjoint_qd_start.- num_linear_dofs = Model.joint_dof_dim[joint_index, 0] - num_angular_dofs = Model.joint_dof_dim[joint_index, 1] - # the joint axes for each joint start at this index: - axis_start = Model.joint_qd_start[joint_id] + num_linear_dofs = Model.joint_dof_dim[joint_index, 0] + num_angular_dofs = Model.joint_dof_dim[joint_index, 1] + # the per‑axis arrays follow the same ordering as joint velocities; start at: + axis_start = Model.joint_qd_start[joint_index]
♻️ Duplicate comments (1)
docs/concepts/articulations.rst (1)
14-18: Clarify fixed-base vs floating-base in the first example sentence.As written, “two generalized coordinates … corresponding to the two joint angles and velocities” mixes positions and velocities and implicitly assumes a fixed base. Suggest being explicit and separating positions from velocities.
- Generalized (sometimes also called "reduced") coordinates describe the configuration of an articulation in terms of joint positions and velocities. - That means, if an articulation has three bodies connected by two revolute joints, the articulation has two generalized coordinates corresponding to the two joint angles (:attr:`newton.State.joint_q`) and joint velocities (:attr:`newton.State.joint_qd`). + Generalized (sometimes also called "reduced") coordinates describe the configuration of an articulation in terms of joint positions (:attr:`newton.State.joint_q`) and joint velocities (:attr:`newton.State.joint_qd`). + For a fixed‑base articulation with three bodies connected by two revolute joints, there are two positional generalized coordinates (the two joint angles) and two velocity coordinates (the two joint angular velocities).
🧹 Nitpick comments (4)
docs/concepts/articulations.rst (4)
32-48: Doctest robustness: add imports and tolerant float checks.These doctests rely on
newton,wp, and exact float equality. Make the block self‑contained and usenp.isclose/allclose... testcode:: - builder = newton.ModelBuilder() + import numpy as np + import warp as wp + import newton + + builder = newton.ModelBuilder() builder.add_articulation() body = builder.add_body() builder.add_shape_box(body) # add a shape to the body to add some inertia builder.add_joint_revolute(parent=-1, child=body, axis=wp.vec3(0.0, 0.0, 1.0)) # add a revolute joint to the body builder.joint_q[-1] = 0.5 builder.joint_qd[-1] = 10.0 model = builder.finalize() state = model.state() # The generalized coordinates have been initialized by the revolute joint: - assert all(state.joint_q.numpy() == [0.5]) - assert all(state.joint_qd.numpy() == [10.0]) + assert np.allclose(state.joint_q.numpy(), [0.5]) + assert np.allclose(state.joint_qd.numpy(), [10.0])
101-107: Use tolerant comparison for joint_q vs transform.Same flattening/equality concerns as above; compare pos/quat with tolerance.
- assert len(state.joint_q) == 7 - assert all(state.joint_q.numpy() == [*tf]) + import numpy as np + assert len(state.joint_q) == 7 + pos = wp.transform_get_translation(tf); quat = wp.transform_get_rotation(tf) + assert np.allclose(state.joint_q.numpy(), [pos[0], pos[1], pos[2], quat[0], quat[1], quat[2], quat[3]])
167-178: Minor consistency: qualify Model/State in examples or add a preface.Elsewhere you use fully qualified names. Consider either
from newton import Model, Statein a setup block or qualify here for consistency.
83-98: Remove invalid slice assignment in free joint example.
add_joint_free(body)already binds to the world by default (parent=-1), so no change needed.- The commented
is invalid (and references non-existent helpers). Either remove it or replace it with a valid example using the actual API for extracting the translation and quaternion from the# builder.joint_q[-7:] = *tftftransform.
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/concepts/articulations.rst(1 hunks)newton/_src/sim/builder.py(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- newton/_src/sim/builder.py
⏰ 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). (3)
- GitHub Check: Run GPU Unit Tests on AWS EC2 (Pull Request)
- GitHub Check: Run GPU Benchmarks (Pull Request)
- GitHub Check: run-newton-tests / newton-unittests (windows-latest)
🔇 Additional comments (4)
docs/concepts/articulations.rst (4)
53-61: Good: FK guidance for maximal-coordinate solvers.Clear call‑out that generalized solvers don’t require eval_fk; this addresses earlier confusion.
231-273: Kinematics section looks solid.Notation, variable table, and FK equation are clear and consistent.
120-160: Remove incorrect distance DOF recheck. The docs table matches the implementation in sim/joints.py (forJointType.DISTANCE,coord_count = 7anddof_count = 6with one constraint axis), so no changes needed.Likely an incorrect or invalid review comment.
26-28: Coordinate conventions confirmed
SolverFeatherstone and SolverMuJoCo operate on generalized coordinates (State.joint_q/joint_qd), while SolverXPBD and SolverSemiImplicit operate on maximal coordinates (State.body_q/body_qd). Class names and modules are correct.
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
newton/solvers.py (1)
16-18: LGTM! Consider optionally expanding the docstring.The module docstring is clear and accurate. Since this module re-exports multiple solver types, you might optionally enhance it to briefly mention the available solvers or link to the documentation.
For example:
""" -Solvers are used to integrate the dynamics of a Newton model. +Solvers are used to integrate the dynamics of a Newton model. + +Available solvers include Featherstone, Semi-Implicit, XPBD, VBD, and others. +See the documentation for details on each solver type and usage examples. """
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
docs/api/newton.rst(1 hunks)docs/api/newton_solvers.rst(1 hunks)docs/concepts/articulations.rst(1 hunks)newton/solvers.py(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- docs/api/newton.rst
- docs/concepts/articulations.rst
- docs/api/newton_solvers.rst
⏰ 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 Benchmarks (Pull Request)
- GitHub Check: Run GPU Unit Tests on AWS EC2 (Pull Request)
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
|
@preist-nvidia, @adenzler-nvidia I've just updated the docs again, let me know if you have any more comments. |
preist-nvidia
left a comment
There was a problem hiding this comment.
Thank you @eric-heiden !
Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
…ewton-physics#859) Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
…ewton-physics#859) Signed-off-by: Eric Heiden <eric-heiden@outlook.com>
Description
ModelBuilder.add_articulation()Newton Migration Guide
Please ensure the migration guide for warp.sim users is up-to-date with the changes made in this PR.
docs/migration.rstis up-to dateBefore your PR is "Ready for review"
newton/tests/test_examples.py)pre-commit run -aSummary by CodeRabbit