Hi, everyone. I have a question about the data structure in the script ‘anymal_c_env.py’.
As I want to customize my Env file, I follow this script and find the total length of observation space is more than 48 as defined.
Here is the code:
observation_space = 48
…
def _get_observations(self) → dict:
self._previous_actions = self._actions.clone()
height_data = None
if isinstance(self.cfg, AnymalCRoughEnvCfg):
height_data = (
self._height_scanner.data.pos_w[:, 2].unsqueeze(1) - self._height_scanner.data.ray_hits_w[…, 2] - 0.5
).clip(-1.0, 1.0)
obs = torch.cat(
[
tensor
for tensor in (
self._robot.data.root_lin_vel_b,#3
self._robot.data.root_ang_vel_b,#3
self._robot.data.projected_gravity_b,#3
self._commands,#3
self._robot.data.joint_pos - self._robot.data.default_joint_pos,#12
self._robot.data.joint_vel,#12
height_data,#1
self._actions,#12
)
if tensor is not None
],
dim=-1,
)
print("root_lin_vel_b is:", self._robot.data.root_lin_vel_b.size(), end='\n')
print("root_ang_vel_b is:", self._robot.data.root_ang_vel_b.size(), end='\n')
print("projected_gravity_b is:", self._robot.data.projected_gravity_b.size(), end='\n')
print("_commands is:", self._commands.size(), end='\n')
print("joint_pos is:", self._robot.data.joint_pos.size(), end='\n')
print("joint_vel is:", self._robot.data.joint_vel.size(), end='\n')
print("height_data is:", height_data.size(), end='\n')
print("_actions is:", self._actions.size(), end='\n')
observations = {"policy": obs}
return observations
/////////////////// print result
root_lin_vel_b is: torch.Size([4096, 3])
root_ang_vel_b is: torch.Size([4096, 3])
projected_gravity_b is: torch.Size([4096, 3])
_commands is: torch.Size([4096, 3])
joint_pos is: torch.Size([4096, 12])
joint_vel is: torch.Size([4096, 12])
height_data is: torch.Size([4096, 187])
_actions is: torch.Size([4096, 12])
The column length of height_data is so large 187. I want to know how does the script deal with the overlength tensor, regarding the limitation of ‘observation_space’.
I appreciate much your help.