Modifies `ObservationManager` and `RewardManager` to take functions in each...
Modifies `ObservationManager` and `RewardManager` to take functions in each term's configuration (#61)
# Description
This PR modifies the `ObservationManager` and `RewardManager` to change
their default behavior. Earlier they expected that users inherit from
the class and define member functions inside it to compute the terms.
The function name was resolved from the term name itself. However, this
prevented the reuse of common terms and the rewriting of a lot of code
across environments.
The changes made in this PR add another argument `func` to the term
dictionary which now expects a function directly. This way users can use
the same function multiple times for different terms. Example:
```python
def get_contact_force(env, bodies):
....
class ObservationManagerCfg:
term_1 = {"func": get_contact_force, "bodies": "base"}
term_2 = {"func": get_contact_force, "bodies": ".*_FOOT"}
```
The older class implementations have been moved to
`omni.isaac.orbit.compat.utils.mdp` for compatibility.
Additionally, we include `ManagerBase` and `ManagerBaseTermCfg` as a
base class to ensure a better signature on how configuration terms are
handled.
## Type of change
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- This change requires a documentation update
## Checklist
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [x] 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
---------
Co-authored-by:
Mayank Mittal <mittalma@leggedrobotics.com>
Showing
File moved
File moved
File moved
Please register or sign in to comment