You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
each EventTerm overrides previous ones and applies to all joints, unless I am missing something.
I think this happens because the starting point is always the default joints position / velocity and no filter is done, ignoring the joint_names attribute of the SceneEntityCfg parameter:
defreset_joints_by_scale(...):
...
# get default joint statejoint_pos=asset.data.default_joint_pos[env_ids].clone()
joint_vel=asset.data.default_joint_vel[env_ids].clone()
# bias these values randomlyjoint_pos+=math_utils.sample_uniform(*position_range, joint_pos.shape, joint_pos.device)
joint_vel+=math_utils.sample_uniform(*velocity_range, joint_vel.shape, joint_vel.device)
...
# set into the physics simulationasset.write_joint_state_to_sim(joint_pos, joint_vel, env_ids=env_ids)
To overcome this problem I defined a reset_joints_to_default function
defreset_joints_to_default(
env: ManagerBasedEnv,
env_ids: torch.Tensor,
asset_cfg: SceneEntityCfg=SceneEntityCfg("robot"),
):
"""Reset the robot joints to default position and velocity"""# extract the used quantities (to enable type-hinting)asset: Articulation=env.scene[asset_cfg.name]
# get default joint statejoint_pos=asset.data.default_joint_pos[env_ids].clone()
joint_vel=asset.data.default_joint_vel[env_ids].clone()
# set into the physics simulationasset.write_joint_state_to_sim(joint_pos, joint_vel, env_ids=env_ids)
that I use in the first EventTerm and then use a modified reset_joints_by_offset in subsequent EventTerm.
defreset_joints_by_offset(...):
...
# get current joint statejoint_pos_all=asset.data.joint_pos[env_ids]
joint_vel_all=asset.data.joint_vel[env_ids]
# fetch targeted jointsjoint_pos=joint_pos_all[:, asset_cfg.joint_ids]
joint_vel=joint_vel_all[:, asset_cfg.joint_ids]
# bias these values randomlyjoint_pos+=math_utils.sample_uniform(*position_range, joint_pos.shape, joint_pos.device)
joint_vel+=math_utils.sample_uniform(*velocity_range, joint_vel.shape, joint_vel.device)
# update joint statejoint_pos_all[:, asset_cfg.joint_ids] =joint_posjoint_vel_all[:, asset_cfg.joint_ids] =joint_vel
...
# set into the physics simulationasset.write_joint_state_to_sim(joint_pos_all, joint_vel_all, env_ids=env_ids)
System Info
Additional context
If you think the solution I currently use is valid, I can create a pull request with this implementation (it seems to be working well on my side).
Checklist
I have checked that there is no similar issue in the repo (required)
I have checked that the issue is not in running Isaac Sim itself and is related to the repo
Acceptance Criteria
Add the criteria for which this task is considered done. If not known at issue creation time, you can add this once the issue is assigned.
It is possible to target specific joints in the reset_joints_by_offset or reset_joints_by_scale functions.
It is possible to combine multiple EventTerm objects that use the reset_joints_by_offset or reset_joints_by_scale functions.
The text was updated successfully, but these errors were encountered:
Describe the bug
The
mdp.reset_joints_by_offset
andmdp.reset_joints_by_scale
functions cannot target specific joints and cannot be combined.Steps to reproduce
When defining multiple reset events (as done in the
Isaac-Cartpole-v0
task for example):each
EventTerm
overrides previous ones and applies to all joints, unless I am missing something.I think this happens because the starting point is always the default joints position / velocity and no filter is done, ignoring the
joint_names
attribute of theSceneEntityCfg
parameter:To overcome this problem I defined a
reset_joints_to_default
functionthat I use in the first
EventTerm
and then use a modifiedreset_joints_by_offset
in subsequentEventTerm
.System Info
Additional context
If you think the solution I currently use is valid, I can create a pull request with this implementation (it seems to be working well on my side).
Checklist
Acceptance Criteria
Add the criteria for which this task is considered done. If not known at issue creation time, you can add this once the issue is assigned.
reset_joints_by_offset
orreset_joints_by_scale
functions.EventTerm
objects that use thereset_joints_by_offset
orreset_joints_by_scale
functions.The text was updated successfully, but these errors were encountered: