Repository navigation
[Backport] PRs #7987 and #7988 to release/3.0.0 - #8026
Conversation
`ActuatorNetLSTM.compute` used DC-motor clipping without updating its cached joint velocity, so the torque-speed limits were always evaluated at zero velocity. With the ANYmal actuator settings (saturation 120 N·m, effort limit 80 N·m, velocity limit 7.5 rad/s), it allowed 80 N·m of positive torque at 7.5 rad/s when the limit should be zero. Explicit PD and neural-network compute pass the current velocity directly into DC-motor clipping. This removes the cached `_joint_vel` tensor, its allocation and copies, and the redundant `DCMotor.compute` override. Clipping uses a local clamped value, preserving the measured velocity and the existing torque-speed equations. The base `_clip_effort(effort, *args, **kwargs)` only clamps effort and leaves model-specific inputs to subclasses. `DCMotor._clip_effort(effort, joint_vel)` owns velocity-dependent clipping; implicit actuators retain `_clip_effort(effort)`. Custom overrides used by explicit PD and neural-network actuators must accept the velocity argument, as documented in the changelog. - Bug fix and removal of redundant actuator state Extended the existing DC-motor and ideal-PD tests; no new test file. - DC-motor, ideal-PD, and implicit-actuator suites: **41 passed**, including CPU and CUDA cases. Formatting and pre-commit checks passed. - The LSTM regression calls real `compute` with a constant 100 N·m network and checks expected efforts `80, 60, 0, 80` at velocities `0, 3.75, 7.5, -7.5`. Restoring the original production implementation fails numerically: two values differ, including 80 instead of zero at the velocity limit. - Existing four-quadrant DC-motor compute cases also verify that measured velocity stays unchanged. The LSTM regression guards against reintroducing cached `_joint_vel` state. - One assertion in the existing ideal-PD compute test verifies that base clipping needs only effort. It fails against the previous required-velocity signature. - A temporary two-step smoke check exercised DC-motor, LSTM, and MLP compute on CPU and CUDA with changing velocities beyond the curve's corner. Efforts matched the expected values and measured velocities stayed unchanged. - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` - [x] I have read and understood the contribution guidelines - [x] I have run the `pre-commit` checks with `./isaaclab.sh --format` - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added a changelog fragment under `source/isaaclab/changelog.d/` - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Lynn <[email protected]> Co-authored-by: Octi Zhang <[email protected]> (cherry picked from commit 9c7cfc6)
|
run-ci |
|
| self.computed_effort = self.stiffness * error_pos + self.damping * error_vel + control_action.joint_efforts | ||
| # clip the torques based on the motor limits | ||
| self.applied_effort = self._clip_effort(self.computed_effort) | ||
| self.applied_effort = self._clip_effort(self.computed_effort, joint_vel) |
There was a problem hiding this comment.
Existing clipping overrides fail
If a custom IdealPDActuator subclass overrides _clip_effort(self, effort) using the previous signature, its inherited compute() now passes joint_vel as a second argument. That raises TypeError instead of applying the joint effort. The changelog describes the new signature, but existing subclasses still fail unless updated.
…7987) `quat_apply` and `quat_apply_inverse` flattened quaternion and vector batches independently, losing broadcasting and causing `body_projected_gravity_b` to fail for multiple bodies. Both helpers now broadcast leading dimensions following NumPy rules and return the broadcast result shape. They use tensor views for broadcasting, without materializing repeated inputs. The observation only preserves an explicit body dimension, including integer body selection. The frame-transformer tutorial explicitly selects its single quaternion so its configured offset remains a flat 3-vector. Incompatible batch shapes now raise an error even when their element counts match; callers intentionally pairing flattened arrays must reshape them explicitly. The changelog also documents retained singleton batch dimensions and potentially noncontiguous outputs for transposed inputs; use `reshape` when flattening those outputs. Consolidated forward/inverse coverage in the existing math test and moved the gravity regression into `test_gravity_randomization.py`, using different gravity directions per environment. No new test file. Merged current `develop` and retained its multidimensional rotation coverage. - Existing math, gravity, and reorientation checks passed. The caller audit additionally passed 66 tests: 36 CPU/CUDA quaternion cases, 21 operational-space controller cases, and 9 existing dexterous-task, FORGE, visualization, and sampler cases. - 42 CPU/CUDA comparisons of consumer tensor paths and gradients agreed with the old helpers. The tutorial offset failed backend-style stacking before its one-line correction and passed afterward with the analytic -90-degree yaw result. - Confirmed the broadcasting and gravity regressions fail with the old helpers and pass with the fix, including rejection of incompatible equal-element-count batches. - All pre-commit checks passed. - Single-thread CPU / RTX 5090 microbenchmarks: matching `(4096, 16)` GPU batches improved from about 27 to 25 microseconds; the gravity broadcast case improved from about 33 to 27 microseconds. Matching large CPU batches were about 17% slower (1.03 to 1.20 ms); matching 4096-element CPU batches were about unchanged (73 to 71 microseconds). - Bug fix, with an explicit compatibility change for callers relying on implicit flattened pairing. - [ ] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` - [x] I have read and understood the contribution guidelines - [x] I have run the `pre-commit` checks with `./isaaclab.sh --format` - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added a changelog fragment under `source/isaaclab/changelog.d/` - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Lynn <[email protected]> Co-authored-by: Octi Zhang <[email protected]> (cherry picked from commit 417aafc)
|
run-ci |
There was a problem hiding this comment.
Isaac Lab Review Bot
Reviewed the release/3.0.0 backport covering quaternion broadcasting, multi-body projected-gravity observations, and velocity-aware DC-motor clipping. The changed producer and consumer paths are consistent, with focused regression coverage and changelog migration guidance.
- Design and architecture: Passing measured joint velocity directly into DC-motor clipping removes the cached velocity state and consistently connects ideal-PD, LSTM, and MLP actuator paths. The base variadic clipping hook preserves single-argument behavior for actuator implementations that do not require model-specific inputs.
- API: The changed broadcasting semantics of
quat_applyandquat_apply_inverse, along with the updated_clip_effortoverride contract, are explicitly documented in package changelog fragments. Updated gravity and tutorial call sites preserve their intended output shapes, including the explicit singleton body dimension for integer body selections. - Implementation: The quaternion implementation applies NumPy-style leading-dimension broadcasting, the gravity observation reshapes selections before rotation and flattens the documented result afterward, and actuator computations now supply current velocity without retaining a redundant buffer. Tests cover broadcast-compatible and incompatible shapes, integer and multi-body gravity selections, DC-motor torque-speed clipping, and the LSTM regression. The remaining compatibility impact is the intentional, documented change for out-of-tree callers relying on flattened quaternion pairing or custom clipping overrides.
No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.
Automated review; human maintainers own approval decisions.
Backports #7987 and #7988 to
release/3.0.0, consolidating the separate #8028 backport here.The existing #7988 backport is unchanged. The #7987 backport retains the original production changes and quaternion regression while preserving unrelated release-branch math tests; it excludes the unrelated rewrites in #8028's generated conflict resolution. No new test files were added.
Validation: 615 existing math, gravity, DC-motor, ideal-PD, and implicit-actuator tests passed locally, including CPU/CUDA coverage; the benchmark was excluded. The multi-body gravity regression fails with the pre-backport quaternion helpers and passes with the fix. All formatting/pre-commit checks passed. The combined branch merges cleanly with the checked release head.
Original commits:
417aafcba64292e7859f1cc1888f6462cd8e59a7(#7987) and9c7cfc64333b4962d6420da67f1d8bb3a2f55880(#7988). Both initial bot backports required conflict resolution, so release-maintainer review remains necessary.