-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Newton gear insertion #6833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Newton gear insertion #6833
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -734,7 +734,41 @@ First, launch the training with a small number of environments and visualization | |
| --num_envs 4 \ | ||
| --visualizer kit | ||
|
|
||
| This will open the Isaac Sim viewer where you can observe the training process in real-time. | ||
| .. tab-item:: Flexiv Rizon 4s + Grav (Newton) | ||
|
|
||
| .. tab-set:: | ||
|
|
||
| .. tab-item:: uv (Recommended) | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| uv run isaaclab train --rl_library rsl_rl \ | ||
| --task IsaacContrib-Deploy-GearAssembly-Rizon4s-Grav \ | ||
| --num_envs 2 \ | ||
| --visualizer newton \ | ||
| presets=newton_hydroelastic | ||
|
|
||
| .. tab-item:: isaaclab.sh / isaaclab.bat | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| ./isaaclab.sh train --rl_library rsl_rl \ | ||
| --task IsaacContrib-Deploy-GearAssembly-Rizon4s-Grav \ | ||
| --num_envs 2 \ | ||
| --visualizer newton \ | ||
| presets=newton_hydroelastic | ||
|
|
||
| Use ``presets=newton_sdf`` to compare point-SDF contacts. To train a task-space | ||
| policy, use the ``IsaacContrib-Deploy-GearAssembly-Rizon4s-Grav-Newton-IK`` task | ||
| with the same Newton preset. | ||
|
|
||
| The centered SDF assets can also be tested with PhysX by using | ||
| ``presets=physx_sdf`` on the ``IsaacContrib-Deploy-GearAssembly-Rizon4s-Grav`` | ||
| task. The default PhysX preset retains the legacy Factory assets and frame conventions | ||
| for existing checkpoints. | ||
|
|
||
| This opens the selected viewer (Isaac Sim for PhysX or Newton Viewer for Newton) so you can | ||
| observe the training process in real time. | ||
|
|
||
| .. figure:: ../../_static/policy_deployment/02_gear_assembly/sim_real_gear_assembly_train.jpg | ||
| :align: center | ||
|
|
@@ -820,10 +854,59 @@ Now launch the full training run with more parallel environments in headless mod | |
| --num_envs 256 \ | ||
| --video --video_length 200 --video_interval 76800 | ||
|
|
||
| .. tab-item:: Flexiv Rizon 4s + Grav (Newton) | ||
|
|
||
| .. tab-set:: | ||
|
|
||
| .. tab-item:: uv (Recommended) | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| uv run isaaclab train --rl_library rsl_rl \ | ||
| --task IsaacContrib-Deploy-GearAssembly-Rizon4s-Grav \ | ||
| --num_envs 256 \ | ||
| --visualizer none \ | ||
| presets=newton_hydroelastic | ||
|
|
||
| .. tab-item:: isaaclab.sh / isaaclab.bat | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| ./isaaclab.sh train --rl_library rsl_rl \ | ||
| --task IsaacContrib-Deploy-GearAssembly-Rizon4s-Grav \ | ||
| --num_envs 256 \ | ||
| --visualizer none \ | ||
| presets=newton_hydroelastic | ||
|
|
||
| The Newton hydroelastic preset uses package-local concave SDF collision assets. Its defaults | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI-generated review — Moderate: this paragraph duplicates implementation details already encoded in the config/tests ( |
||
| separate the expensive collision rate from contact integration: the outer physics and collision | ||
| tick is 100 Hz, while 20 solver substeps produce a 2 kHz solver rate. A policy decimation of three | ||
| gives a 33.3 Hz control rate. The preset also uses a 5 mm shape gap and a bounded triangle-pair | ||
| buffer sized for 256 environments per GPU rank. The arm uses solver-native actuator gravity | ||
| compensation so gravity remains enabled for the gears, and the Grav linkage is held by physical | ||
| PD actuators; no action term rewrites the selected gear pose. | ||
|
|
||
| The default triangle-pair capacity is 4,194,304 per GPU rank. If Newton reports a triangle-pair | ||
| buffer overflow, reduce the number of environments per rank or increase the capacity before using | ||
| the resulting policy; overflowed candidate contacts are discarded. | ||
|
|
||
| For four-GPU training, launch 256 environments per rank (1,024 total): | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| uv run python scripts/reinforcement_learning/train_multigpu.py \ | ||
| --rl_library rsl_rl --num_gpus 4 \ | ||
| --task IsaacContrib-Deploy-GearAssembly-Rizon4s-Grav \ | ||
| --num_envs 256 --max_iterations 1000 \ | ||
| --visualizer none \ | ||
| presets=newton_hydroelastic | ||
|
|
||
| **Command breakdown:** | ||
|
|
||
| - ``--num_envs 256``: Runs 256 parallel environments for efficient training | ||
| - ``--video_length 200``: Each video captures approximately one full episode (``episode_length_s / (sim.dt * decimation)`` = ``6.66 / (1/1000 * 33)`` ≈ 200 steps) | ||
| - ``--num_envs 256``: Runs 256 parallel environments per trainer process | ||
| - ``--video_length 200``: Captures approximately one PhysX episode | ||
| (``6.66 / (1/120 * 4)`` ≈ 200 policy steps); a Newton episode is approximately | ||
| 222 policy steps (``6.66 / (0.01 * 3)``) | ||
| - ``--video_interval 76800``: Records a video every 76,800 environment steps (~every 150 iterations), producing ~10 videos over full training | ||
|
|
||
| Training typically takes ~12-24 hours for a robust insertion policy. The videos will be saved in the ``logs`` directory and can be reviewed to assess policy performance during training. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| Added | ||
| ^^^^^ | ||
|
|
||
| * Added Newton point-SDF and hydroelastic-SDF physics presets and collision | ||
| assets to the Flexiv Rizon 4s gear assembly task. | ||
| * Added a PhysX SDF preset that uses the same centered collision assets for | ||
| cross-backend validation while preserving legacy PhysX defaults. | ||
| * Added a Newton inverse-kinematics task variant for task-space policies. | ||
|
|
||
| Fixed | ||
| ^^^^^ | ||
|
|
||
| * Fixed Newton gear reset, reward, and termination frames so selected gears | ||
| target their shafts and physical grasps are measured at the fingertip | ||
| midpoint without changing the PhysX defaults. |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DOes this USDA need to live within IsaacLab? Could it be on Nucleus? |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this USDA need to live within IsaacLab? Could it be on Nucleus? |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this USDA need to live within IsaacLab? Could it be on Nucleus? |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this USDA need to live within IsaacLab? Could it be on Nucleus? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| from isaaclab_newton.envs.mdp.actions.newton_ik_actions_cfg import NewtonInverseKinematicsActionCfg | ||
| from isaaclab_newton.ik.newton_ik_objectives_cfg import NewtonIKJointLimitObjectiveCfg, NewtonIKPoseObjectiveCfg | ||
| from isaaclab_newton.ik.newton_ik_solver_cfg import NewtonIKSolverCfg | ||
|
|
||
| from isaaclab.utils.configclass import configclass | ||
|
|
||
| from . import joint_pos_env_cfg | ||
|
|
||
|
|
||
| @configclass | ||
| class Rizon4sGearAssemblyIKNewtonEnvCfg(joint_pos_env_cfg.Rizon4sGearAssemblyEnvCfg): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI-generated review — Important: this class inherits the PhysX default. I confirmed that resolving the registered Newton-IK task with |
||
| """Gear-assembly with a Newton inverse-kinematics (task-space) action for the Rizon 4s arm. | ||
|
|
||
| Replaces the joint-space :class:`~isaaclab.envs.mdp.RelativeJointPositionActionCfg` with a | ||
| Newton-solved relative end-effector pose action, so the policy commands end-effector motion | ||
| directly. This provides a six-dimensional task-space alternative to the seven-dimensional | ||
| joint-space action. The gripper remains a fixed mimic mechanism (not commanded by the policy). | ||
|
|
||
| Note: | ||
| Newton IK consumes the replicated robot prototype, so this variant requires a Newton preset | ||
| (``presets=newton_mjwarp``, ``presets=newton_sdf``, or | ||
| ``presets=newton_hydroelastic``); it is not compatible with ``presets=physx``. | ||
| """ | ||
|
|
||
| def __post_init__(self): | ||
| super().__post_init__() | ||
|
|
||
| # Command the physical flange frame used by the real Flexiv Cartesian controller. | ||
| self.actions.arm_action = NewtonInverseKinematicsActionCfg( | ||
| asset_name="robot", | ||
| joint_names=["joint1", "joint2", "joint3", "joint4", "joint5", "joint6", "joint7"], | ||
| controller=NewtonIKSolverCfg(optimizer="lm", jacobian_mode="analytic", iterations=24), | ||
| clip={".*": (-0.5, 0.5)}, | ||
| objectives=[ | ||
| NewtonIKPoseObjectiveCfg( | ||
| body_name="flange", | ||
| command_type="pose", | ||
| use_relative_mode=True, | ||
| scale=0.025, | ||
| ), | ||
| NewtonIKJointLimitObjectiveCfg(weight=0.1), | ||
| ], | ||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AI-generated review — Important: this is under “Full-Scale Training with Video Recording,” but the Newton command does not pass
--video,--video_length, or--video_interval; the later command breakdown nevertheless describes Newton video length. Add a supported Newton recording command or separate this into a headless-training section and remove the video claims.