Unverified Commit c37c50e1 authored by Yujian Zhang's avatar Yujian Zhang Committed by GitHub

Adds sanity check for the term type inside the command manager (#1315)

# Description

- The purpose of this change is to enhance the robustness of the code by
adding a sanity check to ensure that the command term is of a valid type
before it is processed (Just like ActionTerm). This validation step is
crucial for preventing unexpected errors and maintaining system
stability, especially when dealing with dynamically configured command
terms that may vary based on external inputs or configurations. By
validating the type of the command term, we can provide early feedback
to developers and users, helping to catch misconfigurations or type
mismatches during the initial stages. This change aims to improve the
overall reliability and maintainability of the codebase.

- It also fixes iteration over group_cfg_items inside the observation
manager.

## 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`
- [x] I have made corresponding changes to the documentation
- [x] 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

---------
Signed-off-by: 's avatarMayank Mittal <12863862+Mayankm96@users.noreply.github.com>
Co-authored-by: 's avatarMayank Mittal <12863862+Mayankm96@users.noreply.github.com>
parent c0d01d7e
...@@ -72,6 +72,7 @@ Guidelines for modifications: ...@@ -72,6 +72,7 @@ Guidelines for modifications:
* Wei Yang * Wei Yang
* Xavier Nal * Xavier Nal
* Yang Jin * Yang Jin
* Yujian Zhang
* Zhengyu Zhang * Zhengyu Zhang
* Ziqi Fan * Ziqi Fan
* Qian Wan * Qian Wan
......
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.27.8"
version = "0.27.7"
# Description # Description
title = "Isaac Lab framework for Robot Learning" title = "Isaac Lab framework for Robot Learning"
......
Changelog Changelog
--------- ---------
0.27.8 (2024-11-01)
~~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Added sanity check if the term is a valid type inside the command manager.
* Corrected the iteration over ``group_cfg_items`` inside the observation manager.
0.27.7 (2024-10-28) 0.27.7 (2024-10-28)
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
......
...@@ -394,5 +394,8 @@ class CommandManager(ManagerBase): ...@@ -394,5 +394,8 @@ class CommandManager(ManagerBase):
) )
# create the action term # create the action term
term = term_cfg.class_type(term_cfg, self._env) term = term_cfg.class_type(term_cfg, self._env)
# sanity check if term is valid type
if not isinstance(term, CommandTerm):
raise TypeError(f"Returned object for the term '{term_name}' is not of type CommandType.")
# add class to dict # add class to dict
self._terms[term_name] = term self._terms[term_name] = term
...@@ -317,7 +317,7 @@ class ObservationManager(ManagerBase): ...@@ -317,7 +317,7 @@ class ObservationManager(ManagerBase):
else: else:
group_cfg_items = group_cfg.__dict__.items() group_cfg_items = group_cfg.__dict__.items()
# iterate over all the terms in each group # iterate over all the terms in each group
for term_name, term_cfg in group_cfg.__dict__.items(): for term_name, term_cfg in group_cfg_items:
# skip non-obs settings # skip non-obs settings
if term_name in ["enable_corruption", "concatenate_terms"]: if term_name in ["enable_corruption", "concatenate_terms"]:
continue continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment