• Patrick Yin's avatar
    Fixes ObservationManager history buffer corrupted by external calls to... · d1ecc377
    Patrick Yin authored
    Fixes ObservationManager history buffer corrupted by external calls to ObservationManager.compute (#2885)
    
    # Description
    
    When observation group has history length greater than zero, calling
    `ObservationManager.compute` modifies history state by appending current
    observation to history. This creates history corruption when
    non-`ManagerBasedEnv` classes invoke `ObservationManager.compute`. This
    PR introduces `update_history` flag (default to `False`) and only
    `ManagerBasedEnv` has the privilege to run `ObservationManager.compute`
    with `update_history=True`. If `update_history=False` and the history
    buffer is `None`, a copy of history is returned instead of the original.
    
    I have added test cases to verify this fix is effective.
    
    Fixes #2884 
    
    ## Type of change
    
    - Bug fix (non-breaking change which fixes an issue)
    
    ## Checklist
    
    - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
    `./isaaclab.sh --format`
    - [ ] I have made corresponding changes to the documentation
    - [x] My changes generate no new warnings
    - [x] I have added tests that prove my fix is effective or that my
    feature works
    - [x] I have updated the changelog and the corresponding version in the
    extension's `config/extension.toml` file
    - [x] I have added my name to the `CONTRIBUTORS.md` or my name already
    exists there
    
    ---------
    Signed-off-by: 's avatarooctipus <zhengyuz@nvidia.com>
    Signed-off-by: 's avatarKelly Guo <kellyg@nvidia.com>
    Co-authored-by: 's avatarooctipus <zhengyuz@nvidia.com>
    Co-authored-by: 's avatarKelly Guo <kellyg@nvidia.com>
    d1ecc377