Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Reshape + shape computation issues with observation manager #1957

Open
2 of 4 tasks
pculbertson-bdai opened this issue Feb 27, 2025 · 1 comment · May be fixed by #1958
Open
2 of 4 tasks

[Bug Report] Reshape + shape computation issues with observation manager #1957

pculbertson-bdai opened this issue Feb 27, 2025 · 1 comment · May be fixed by #1958
Labels
bug Something isn't working

Comments

@pculbertson-bdai
Copy link

pculbertson-bdai commented Feb 27, 2025

Description

The observation manager has a couple issues when providing history_length != None. In particular:

  1. The env.observation_shape is computed incorrectly for these groups when flatten_history_dim=False. (See below for a concrete example).
  2. When flatten_history_dim=True the observation is not returned in a way that is easy to reshape to recover the common history dimension.

While 2 may be a feature request (I thought this was the expected behavior, but realized it is unclear in hindsight), 1 is certainly a bug with how the observations are being handled currently.

Steps to Reproduce

  1. Create an observation group with multiple history-enabled terms. For example:
@configclass
class ObservationManagerCfg:
    @configclass
    class PolicyCfg(ObservationGroupCfg):
        history_length = H
        flatten_history_dim = False
        term1 = ObservationTermCfg(func=f1) # f1 returns shape (D1,)
        term2 = ObservationTermCfg(func=f2) # f2 returns shape (D2,)

    policy = PolicyCfg()

Expected: Upon instantiating the env, env.observation_space["policy"].shape is (num_envs, H, D1 + D2).
Actual: Upon instantiating the env, env.observation_space["policy"].shape is (num_envs, 2H, D1 + D2).

  1. Create an observation group with flatten_history_dim=True (e.g., change this parameter of the last example.

When reading an observation from the observation manager,

policy_obs = observation_manager.compute()["policy"]

Expected: policy_obs.reshape(-1, H, D1 + D2) = torch.concatenate([term1, term2], dim=-1). Note this is poor syntax - but ideally we could reconstruct the observations with a coherent history dim.
Actual: policy_obs = torch.concatenate([term1.reshape(num_envs, -1), term2.reshape(num_envs, -1)], dim=-1). The reshape does not preserve a history dimension.

System Info

Describe the characteristic of your environment:

  • Commit: f1a4975
  • Isaac Sim Version: 4.5.0
  • OS: Ubuntu 22.04
  • GPU: RTX 5000 Ada
  • CUDA: 12.2
  • GPU Driver: 535.183.01

Additional context

Will open a PR with suggested changes to fix these issues.

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

  • Concatenated, unflattened histories have the correct shape in env.observation_space
  • History observations can be reshaped easily to preserve a history dim.
@RandomOakForest
Copy link
Collaborator

Thanks for posting this. The team will review.

@RandomOakForest RandomOakForest added the bug Something isn't working label Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants