Skip to content

Commit a0e0a29

Browse files
committed
seperate velocity_limits at actuator vs simulation level
1 parent c4bec8f commit a0e0a29

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

Diff for: source/isaaclab/isaaclab/actuators/actuator_base.py

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def __init__(
110110
# note: for velocity limits, we don't have USD parameter, so default is infinity
111111
self.effort_limit = self._parse_joint_parameter(self.cfg.effort_limit, effort_limit)
112112
self.velocity_limit = self._parse_joint_parameter(self.cfg.velocity_limit, velocity_limit)
113+
self.effort_limit_sim = self._parse_joint_parameter(self.cfg.effort_limit_sim, effort_limit)
114+
self.velocity_limit_sim = self._parse_joint_parameter(self.cfg.velocity_limit_sim, velocity_limit)
113115

114116
# create commands buffers for allocation
115117
self.computed_effort = torch.zeros(self._num_envs, self.num_joints, device=self._device)

Diff for: source/isaaclab/isaaclab/actuators/actuator_cfg.py

+17-2
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,28 @@ class ActuatorBaseCfg:
3333
effort_limit: dict[str, float] | float | None = None
3434
"""Force/Torque limit of the joints in the group. Defaults to None.
3535
36-
If None, the limit is set to the value specified in the USD joint prim.
36+
This limit is used to clip the computed torque sent to the simulation. If None, the limit is set to the value
37+
specified in the USD joint prim.
3738
"""
3839

3940
velocity_limit: dict[str, float] | float | None = None
4041
"""Velocity limit of the joints in the group. Defaults to None.
4142
42-
If None, the limit is set to the value specified in the USD joint prim.
43+
This limit is used by the actuator model. If None, the limit is set to the value specified in the USD joint prim.
44+
"""
45+
46+
effort_limit_sim: dict[str, float] | float | None = None
47+
"""Force/Torque limit of the joints in the group that will be propagated to the simulation physics solver. Defaults to None.
48+
49+
If None, the limit is set to the value specified in the USD joint prim. The simulation effort limits prevent
50+
computed torques from exceeding. If effort limits are too tight issues with solver convergence may occur.
51+
"""
52+
53+
velocity_limit_sim: dict[str, float] | float | None = None
54+
"""Velocity limit of the joints in the group that will be propagated to the simulation physics solver. Defaults to None.
55+
56+
If None, the limit is set to the value specified in the USD joint prim. Resulting solver solutions will constrain
57+
velocities by these limits. If velocity limits are too tight issues with solver convergence may occur.
4358
"""
4459

4560
stiffness: dict[str, float] | float | None = MISSING

Diff for: source/isaaclab/isaaclab/assets/articulation/articulation.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1342,17 +1342,17 @@ def _process_actuators_cfg(self):
13421342
# the gains and limits are set into the simulation since actuator model is implicit
13431343
self.write_joint_stiffness_to_sim(actuator.stiffness, joint_ids=actuator.joint_indices)
13441344
self.write_joint_damping_to_sim(actuator.damping, joint_ids=actuator.joint_indices)
1345-
self.write_joint_effort_limit_to_sim(actuator.effort_limit, joint_ids=actuator.joint_indices)
1346-
self.write_joint_velocity_limit_to_sim(actuator.velocity_limit, joint_ids=actuator.joint_indices)
1345+
self.write_joint_effort_limit_to_sim(actuator.effort_limit_sim, joint_ids=actuator.joint_indices)
1346+
self.write_joint_velocity_limit_to_sim(actuator.velocity_limit_sim, joint_ids=actuator.joint_indices)
13471347
self.write_joint_armature_to_sim(actuator.armature, joint_ids=actuator.joint_indices)
13481348
self.write_joint_friction_to_sim(actuator.friction, joint_ids=actuator.joint_indices)
13491349
else:
13501350
# the gains and limits are processed by the actuator model
13511351
# we set gains to zero, and torque limit to a high value in simulation to avoid any interference
13521352
self.write_joint_stiffness_to_sim(0.0, joint_ids=actuator.joint_indices)
13531353
self.write_joint_damping_to_sim(0.0, joint_ids=actuator.joint_indices)
1354-
self.write_joint_effort_limit_to_sim(1.0e9, joint_ids=actuator.joint_indices)
1355-
self.write_joint_velocity_limit_to_sim(actuator.velocity_limit, joint_ids=actuator.joint_indices)
1354+
self.write_joint_effort_limit_to_sim(actuator.effort_limit_sim, joint_ids=actuator.joint_indices)
1355+
self.write_joint_velocity_limit_to_sim(actuator.velocity_limit_sim, joint_ids=actuator.joint_indices)
13561356
self.write_joint_armature_to_sim(actuator.armature, joint_ids=actuator.joint_indices)
13571357
self.write_joint_friction_to_sim(actuator.friction, joint_ids=actuator.joint_indices)
13581358
# Store the actual default stiffness and damping values for explicit and implicit actuators (not written the sim)

Diff for: source/isaaclab/test/assets/test_articulation.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def generate_articulation_cfg(
4545
damping: float | None = 2.0,
4646
vel_limit: float | None = 100.0,
4747
effort_limit: float | None = 400.0,
48+
vel_limit_sim: float | None = None,
49+
effort_limit_sim: float | None = None,
4850
) -> ArticulationCfg:
4951
"""Generate an articulation configuration.
5052
@@ -77,6 +79,8 @@ def generate_articulation_cfg(
7779
joint_names_expr=[".*"],
7880
effort_limit=effort_limit,
7981
velocity_limit=vel_limit,
82+
effort_limit_sim=effort_limit_sim,
83+
velocity_limit_sim=vel_limit_sim,
8084
stiffness=0.0,
8185
damping=10.0,
8286
),
@@ -900,7 +904,7 @@ def test_setting_gains_from_cfg_dict(self):
900904
torch.testing.assert_close(articulation.actuators["body"].stiffness, expected_stiffness)
901905
torch.testing.assert_close(articulation.actuators["body"].damping, expected_damping)
902906

903-
def test_setting_velocity_limits(self):
907+
def test_setting_velocity_sim_limits(self):
904908
"""Test that velocity limits are loaded form the configuration correctly."""
905909
for num_articulations in (1, 2):
906910
for device in ("cuda:0", "cpu"):
@@ -911,7 +915,7 @@ def test_setting_velocity_limits(self):
911915
) as sim:
912916
sim._app_control_on_stop_handle = None
913917
articulation_cfg = generate_articulation_cfg(
914-
articulation_type="single_joint", vel_limit=limit, effort_limit=limit
918+
articulation_type="single_joint", vel_limit_sim=limit, effort_limit_sim=limit
915919
)
916920
articulation, _ = generate_articulation(
917921
articulation_cfg=articulation_cfg, num_articulations=num_articulations, device=device
@@ -928,7 +932,7 @@ def test_setting_velocity_limits(self):
928932
)
929933
# Check that gains are loaded from USD file
930934
torch.testing.assert_close(
931-
articulation.actuators["joint"].velocity_limit, expected_velocity_limit
935+
articulation.actuators["joint"].velocity_limit_sim, expected_velocity_limit
932936
)
933937
torch.testing.assert_close(
934938
articulation.data.joint_velocity_limits, expected_velocity_limit

0 commit comments

Comments
 (0)