Skip to content

Commit 3b83e11

Browse files
committed
Fix reset_joints_by_scale and reset_joints_by_offsets to only affect the joint specified by user
1 parent 75824e8 commit 3b83e11

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
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.40.12"
4+
version = "0.40.13"
55

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

source/isaaclab/docs/CHANGELOG.rst

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

4+
0.40.13 (2025-07-07)
5+
~~~~~~~~~~~~~~~~~~~~
6+
7+
Fixed
8+
^^^^^
9+
10+
* Fixed :meth:`isaaclab.envs.mdp.events.reset_joints_by_scale`, :meth:`isaaclab.envs.mdp.events.reset_joints_by_offsets`
11+
restricting the resetting joint indices be that user defined joint indices.
12+
13+
14+
415
0.40.12 (2025-07-03)
516
~~~~~~~~~~~~~~~~~~~~
617

source/isaaclab/isaaclab/envs/mdp/events.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,22 +1040,22 @@ def reset_joints_by_scale(
10401040
# extract the used quantities (to enable type-hinting)
10411041
asset: Articulation = env.scene[asset_cfg.name]
10421042
# get default joint state
1043-
joint_pos = asset.data.default_joint_pos[env_ids].clone()
1044-
joint_vel = asset.data.default_joint_vel[env_ids].clone()
1043+
joint_pos = asset.data.default_joint_pos[env_ids, asset_cfg.joint_ids].clone()
1044+
joint_vel = asset.data.default_joint_vel[env_ids, asset_cfg.joint_ids].clone()
10451045

10461046
# scale these values randomly
10471047
joint_pos *= math_utils.sample_uniform(*position_range, joint_pos.shape, joint_pos.device)
10481048
joint_vel *= math_utils.sample_uniform(*velocity_range, joint_vel.shape, joint_vel.device)
10491049

10501050
# clamp joint pos to limits
1051-
joint_pos_limits = asset.data.soft_joint_pos_limits[env_ids]
1051+
joint_pos_limits = asset.data.soft_joint_pos_limits[env_ids, asset_cfg.joint_ids]
10521052
joint_pos = joint_pos.clamp_(joint_pos_limits[..., 0], joint_pos_limits[..., 1])
10531053
# clamp joint vel to limits
1054-
joint_vel_limits = asset.data.soft_joint_vel_limits[env_ids]
1054+
joint_vel_limits = asset.data.soft_joint_vel_limits[env_ids, asset_cfg.joint_ids]
10551055
joint_vel = joint_vel.clamp_(-joint_vel_limits, joint_vel_limits)
10561056

10571057
# set into the physics simulation
1058-
asset.write_joint_state_to_sim(joint_pos, joint_vel, env_ids=env_ids)
1058+
asset.write_joint_state_to_sim(joint_pos, joint_vel, env_ids=env_ids, joint_ids=asset_cfg.joint_ids)
10591059

10601060

10611061
def reset_joints_by_offset(
@@ -1074,22 +1074,22 @@ def reset_joints_by_offset(
10741074
asset: Articulation = env.scene[asset_cfg.name]
10751075

10761076
# get default joint state
1077-
joint_pos = asset.data.default_joint_pos[env_ids].clone()
1078-
joint_vel = asset.data.default_joint_vel[env_ids].clone()
1077+
joint_pos = asset.data.default_joint_pos[env_ids, asset_cfg.joint_ids].clone()
1078+
joint_vel = asset.data.default_joint_vel[env_ids, asset_cfg.joint_ids].clone()
10791079

10801080
# bias these values randomly
10811081
joint_pos += math_utils.sample_uniform(*position_range, joint_pos.shape, joint_pos.device)
10821082
joint_vel += math_utils.sample_uniform(*velocity_range, joint_vel.shape, joint_vel.device)
10831083

10841084
# clamp joint pos to limits
1085-
joint_pos_limits = asset.data.soft_joint_pos_limits[env_ids]
1085+
joint_pos_limits = asset.data.soft_joint_pos_limits[env_ids, asset_cfg.joint_ids]
10861086
joint_pos = joint_pos.clamp_(joint_pos_limits[..., 0], joint_pos_limits[..., 1])
10871087
# clamp joint vel to limits
1088-
joint_vel_limits = asset.data.soft_joint_vel_limits[env_ids]
1088+
joint_vel_limits = asset.data.soft_joint_vel_limits[env_ids, asset_cfg.joint_ids]
10891089
joint_vel = joint_vel.clamp_(-joint_vel_limits, joint_vel_limits)
10901090

10911091
# set into the physics simulation
1092-
asset.write_joint_state_to_sim(joint_pos, joint_vel, env_ids=env_ids)
1092+
asset.write_joint_state_to_sim(joint_pos, joint_vel, env_ids=env_ids, joint_ids=asset_cfg.joint_ids)
10931093

10941094

10951095
def reset_nodal_state_uniform(

0 commit comments

Comments
 (0)