[Question] Switching assets during reset #3469
Replies: 2 comments 1 reply
-
I dig through the docs more and I think the question becomes this: in |
Beta Was this translation helpful? Give feedback.
-
Thank you for posting this. Note that After environments are cloned with Key Points
Example: Change Root Pose of Each Robot in Select EnvironmentsSuppose there is an articulated robot stored in import torch
# Suppose self.robot is an Articulation after cloning. data.default_root_state is [num_envs, 13]
# (x, y, z, qw, qx, qy, qz, vx, vy, vz, wx, wy, wz)
# Let's move environments 1 and 2 along x and y axes:
env_ids = [1, 2]
new_positions = torch.tensor([
[2.0, 0.0, 0.0], # For env 1
[0.0, 2.0, 0.0], # For env 2
], device=self.robot.device)
# Get current root states and modify positions
root_states = self.robot.data.default_root_state[env_ids].clone()
root_states[:, :3] = new_positions
# Write only to envs 1 and 2
self.robot.write_root_state_to_sim(root_states, env_ids=env_ids) This code modifies only the specified environments—other environments remain unchanged. You can use similar tensor-indexed logic to adjust other properties, but you must check if the property supports at-runtime change (mass or color, for instance, might require different API calls or be limited by USD prim semantics). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, I am trying to train a robot in an indoor environment setting, I have about a thousand different room layouts which I won't be able to run a thousand envs in parallel due to memory constraint. In this case, let's say I run 32 envs in parallel, is it possible for me to switch the room layout for each env during the reset so I can iterate through all the room layouts.
Beta Was this translation helpful? Give feedback.
All reactions