Skip to content

Commit

Permalink
Modified the 'test_write_root_state' test case inside the articulatio…
Browse files Browse the repository at this point in the history
…n to catch errors when indexes are passed but not assigned properly.
  • Loading branch information
AntoineRichard committed Jan 13, 2025
1 parent 694b297 commit b817087
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,7 @@ def test_write_root_state(self):
# make quaternion a unit vector
rand_state[..., 3:7] = torch.nn.functional.normalize(rand_state[..., 3:7], dim=-1)

env_idx = env_idx.to(device)
for i in range(10):

# perform step
Expand All @@ -1096,9 +1097,15 @@ def test_write_root_state(self):
articulation.update(sim.cfg.dt)

if state_location == "com":
articulation.write_root_com_state_to_sim(rand_state)
if i % 2 == 0:
articulation.write_root_com_state_to_sim(rand_state)
else:
articulation.write_root_com_state_to_sim(rand_state, env_ids=env_idx)
elif state_location == "link":
articulation.write_root_link_state_to_sim(rand_state)
if i % 2 == 0:
articulation.write_root_link_state_to_sim(rand_state)
else:
articulation.write_root_link_state_to_sim(rand_state, env_ids=env_idx)

if state_location == "com":
torch.testing.assert_close(rand_state, articulation.data.root_com_state_w)
Expand Down

0 comments on commit b817087

Please sign in to comment.