• ooctipus's avatar
    Fixes Termination Manager logging to report aggregated percentage of... · 8dabd3f1
    ooctipus authored
    Fixes Termination Manager logging to report aggregated percentage of environments done due to each term.  (#3107)
    
    # Description
    
    Currently Termination Manager write current step's done count for each
    term if reset is detected. This leads to two problem.
    1. User sees different counts just by varying num_envs
    2. the count can be over-count or under-count depending on when reset
    happens, as pointed out in #2977 (Thanks, @Kyu3224)
    
    The cause of the bug is because we are reporting current step status
    into a buffer that suppose to record episodic done. So instead of write
    the entire buffer base on current value, we ask the update to respect
    the non-reseting environment's old value, and instead of reporting
    count, we report percentage of environment that was done due to the
    particular term.
    
    Test on Isaac-Velocity-Rough-Anymal-C-v0
    
    Before fix:
    <img width="786" height="323" alt="Screenshot from 2025-08-06 22-16-20"
    src="https://github.com/user-attachments/assets/4838d612-7f0e-4232-a07e-688b547e91db"
    />
    Red: num_envs = 4096, Orange: num_envs = 1024
    
    After fix:
    
    <img width="786" height="323" alt="Screenshot from 2025-08-06 22-16-12"
    src="https://github.com/user-attachments/assets/e6e55c21-17ed-42ca-8d94-a19d08611f86"
    />
    Red: num_envs = 4096, Orange: num_envs = 1024
    
    Note that curve of the same color ran on same seed, and curves matched
    exactly, the only difference is the data gets reported in termination.
    The percentage version is a lot more clear in conveying how agent
    currently fails, and how much percentage of agent fails, and shows that
    increasing num_envs to 4096 helps improve agent avoiding termination by
    `base_contact` much quicker than num_envs=1024. Such message is a bit
    hard to tell in first image.
    
    <!--
    Example:
    
    | Before | After |
    | ------ | ----- |
    | _gif/png before_ | _gif/png after_ |
    
    To upload images to a PR -- simply drag and drop an image while in edit
    mode and it should upload the image directly. You can then paste that
    source into the above before/after sections.
    -->
    
    ## 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
    - [ ] My changes generate no new warnings
    - [ ] 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
    
    <!--
    As you go through the checklist above, you can mark something as done by
    putting an x character in it
    
    For example,
    - [x] I have done this task
    - [ ] I have not done this task
    -->
    8dabd3f1
Name
Last commit
Last update
..
config Loading commit data...
docs Loading commit data...
isaaclab Loading commit data...
test Loading commit data...
utils Loading commit data...
pyproject.toml Loading commit data...
setup.py Loading commit data...