Skip to content

Commit 8710f91

Browse files
jtigue-bdaiMayankm96
authored andcommitted
Fixes default effort limit behavior for implicit actuators (isaac-sim#2098)
# Description This MR fixes the default behavior of implicit actuators if no effort limit is set. Previously, the check was using the class variable value instead of self which led to the wrong values getting propogated. Fixes isaac-sim#2054 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Checklist - [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 - [ ] 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 --------- Signed-off-by: James Tigue <[email protected]> Co-authored-by: Mayank Mittal <[email protected]>
1 parent 94cdbd7 commit 8710f91

File tree

8 files changed

+204
-100
lines changed

8 files changed

+204
-100
lines changed

source/isaaclab/config/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
# Note: Semantic Versioning is used: https://semver.org/
4-
version = "0.36.2"
4+
version = "0.36.3"
55

66
# Description
77
title = "Isaac Lab framework for Robot Learning"

source/isaaclab/docs/CHANGELOG.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Changelog
22
---------
33

4+
0.36.3 (2025-03-17)
5+
~~~~~~~~~~~~~~~~~~~
6+
7+
Fixed
8+
^^^^^
9+
10+
* Fixed default behavior of :class:`~isaaclab.actuators.ImplicitActuator` if no :attr:`effort_limits_sim` or
11+
:attr:`effort_limit` is set.
12+
13+
414
0.36.2 (2025-03-12)
515
~~~~~~~~~~~~~~~~~~~
616

source/isaaclab/isaaclab/actuators/actuator_base.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ class ActuatorBase(ABC):
8888
friction: torch.Tensor
8989
"""The joint friction of the actuator joints. Shape is (num_envs, num_joints)."""
9090

91+
_DEFAULT_MAX_EFFORT_SIM: ClassVar[float] = 1.0e9
92+
"""The default maximum effort for the actuator joints in the simulation. Defaults to 1.0e9.
93+
94+
If the :attr:`ActuatorBaseCfg.effort_limit_sim` is not specified and the actuator is an explicit
95+
actuator, then this value is used.
96+
"""
97+
9198
def __init__(
9299
self,
93100
cfg: ActuatorBaseCfg,
@@ -140,8 +147,8 @@ def __init__(
140147

141148
# For explicit models, we do not want to enforce the effort limit through the solver
142149
# (unless it is explicitly set)
143-
if not ActuatorBase.is_implicit_model and self.cfg.effort_limit_sim is None:
144-
self.cfg.effort_limit_sim = 1.0e9
150+
if not self.is_implicit_model and self.cfg.effort_limit_sim is None:
151+
self.cfg.effort_limit_sim = self._DEFAULT_MAX_EFFORT_SIM
145152

146153
# parse joint stiffness and damping
147154
self.stiffness = self._parse_joint_parameter(self.cfg.stiffness, stiffness)

source/isaaclab/isaaclab/sim/schemas/schemas.py

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# needed to import for allowing type-hinting: Usd.Stage | None
77
from __future__ import annotations
88

9+
import math
10+
911
import isaacsim.core.utils.stage as stage_utils
1012
import omni.log
1113
import omni.physx.scripts.utils as physx_utils
@@ -529,7 +531,7 @@ def activate_contact_sensors(prim_path: str, threshold: float = 0.0, stage: Usd.
529531

530532
@apply_nested
531533
def modify_joint_drive_properties(
532-
prim_path: str, drive_props: schemas_cfg.JointDrivePropertiesCfg, stage: Usd.Stage | None = None
534+
prim_path: str, cfg: schemas_cfg.JointDrivePropertiesCfg, stage: Usd.Stage | None = None
533535
) -> bool:
534536
"""Modify PhysX parameters for a joint prim.
535537
@@ -552,7 +554,7 @@ def modify_joint_drive_properties(
552554
553555
Args:
554556
prim_path: The prim path where to apply the joint drive schema.
555-
drive_props: The configuration for the joint drive.
557+
cfg: The configuration for the joint drive.
556558
stage: The stage where to find the prim. Defaults to None, in which case the
557559
current stage is used.
558560
@@ -587,10 +589,43 @@ def modify_joint_drive_properties(
587589
usd_drive_api = UsdPhysics.DriveAPI(prim, drive_api_name)
588590
if not usd_drive_api:
589591
usd_drive_api = UsdPhysics.DriveAPI.Apply(prim, drive_api_name)
592+
# check if prim has Physx joint drive applied on it
593+
physx_joint_api = PhysxSchema.PhysxJointAPI(prim)
594+
if not physx_joint_api:
595+
physx_joint_api = PhysxSchema.PhysxJointAPI.Apply(prim)
596+
597+
# mapping from configuration name to USD attribute name
598+
cfg_to_usd_map = {
599+
"max_velocity": "max_joint_velocity",
600+
"max_effort": "max_force",
601+
"drive_type": "type",
602+
}
603+
# convert to dict
604+
cfg = cfg.to_dict()
590605

591-
# change the drive type to input
592-
if drive_props.drive_type is not None:
593-
usd_drive_api.CreateTypeAttr().Set(drive_props.drive_type)
606+
# check if linear drive
607+
is_linear_drive = prim.IsA(UsdPhysics.PrismaticJoint)
608+
# convert values for angular drives from radians to degrees units
609+
if not is_linear_drive:
610+
if cfg["max_velocity"] is not None:
611+
# rad / s --> deg / s
612+
cfg["max_velocity"] = cfg["max_velocity"] * 180.0 / math.pi
613+
if cfg["stiffness"] is not None:
614+
# N-m/rad --> N-m/deg
615+
cfg["stiffness"] = cfg["stiffness"] * math.pi / 180.0
616+
if cfg["damping"] is not None:
617+
# N-m-s/rad --> N-m-s/deg
618+
cfg["damping"] = cfg["damping"] * math.pi / 180.0
619+
620+
# set into PhysX API
621+
for attr_name in ["max_velocity"]:
622+
value = cfg.pop(attr_name, None)
623+
attr_name = cfg_to_usd_map[attr_name]
624+
safe_set_attribute_on_usd_schema(physx_joint_api, attr_name, value, camel_case=True)
625+
# set into USD API
626+
for attr_name, attr_value in cfg.items():
627+
attr_name = cfg_to_usd_map.get(attr_name, attr_name)
628+
safe_set_attribute_on_usd_schema(usd_drive_api, attr_name, attr_value, camel_case=True)
594629

595630
return True
596631

source/isaaclab/isaaclab/sim/schemas/schemas_cfg.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,36 @@ class JointDrivePropertiesCfg:
199199
then the joint is driven by an acceleration (usually used for kinematic joints).
200200
"""
201201

202+
max_effort: float | None = None
203+
"""Maximum effort that can be applied to the joint (in kg-m^2/s^2)."""
204+
205+
max_velocity: float | None = None
206+
"""Maximum velocity of the joint.
207+
208+
The unit depends on the joint model:
209+
210+
* For linear joints, the unit is m/s.
211+
* For angular joints, the unit is rad/s.
212+
"""
213+
214+
stiffness: float | None = None
215+
"""Stiffness of the joint drive.
216+
217+
The unit depends on the joint model:
218+
219+
* For linear joints, the unit is kg-m/s^2 (N/m).
220+
* For angular joints, the unit is kg-m^2/s^2/rad (N-m/rad).
221+
"""
222+
223+
damping: float | None = None
224+
"""Damping of the joint drive.
225+
226+
The unit depends on the joint model:
227+
228+
* For linear joints, the unit is kg-m/s (N-s/m).
229+
* For angular joints, the unit is kg-m^2/s/rad (N-m-s/rad).
230+
"""
231+
202232

203233
@configclass
204234
class FixedTendonPropertiesCfg:

source/isaaclab/isaaclab/sim/spawners/from_files/from_files_cfg.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ class FileCfg(RigidObjectSpawnerCfg, DeformableObjectSpawnerCfg):
4343
"""Properties to apply to the fixed tendons (if any)."""
4444

4545
joint_drive_props: schemas.JointDrivePropertiesCfg | None = None
46-
"""Properties to apply to a joint."""
46+
"""Properties to apply to a joint.
47+
48+
.. note::
49+
The joint drive properties set the USD attributes of all the joint drives in the asset.
50+
We recommend using this attribute sparingly and only when necessary. Instead, please use the
51+
:attr:`~isaaclab.assets.ArticulationCfg.actuators` parameter to set the joint drive properties
52+
for specific joints in an articulation.
53+
"""
4754

4855
visual_material_path: str = "material"
4956
"""Path to the visual material to use for the prim. Defaults to "material".

0 commit comments

Comments
 (0)