Unverified Commit a02ed972 authored by Mayank Mittal's avatar Mayank Mittal Committed by GitHub

Fixes the check for action-space inside Stable-Baselines3 wrapper (#610)

# Description

Earlier the wrapper was checking the action space boundedness through
`is_bounded` function. However, that method returns a boolean instead of
a string. This MR fixes this issue.

Fixes #609

## 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
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have run all the tests with `./isaaclab.sh --test` and they pass
- [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
parent 5c021834
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.7.8"
version = "0.7.9"
# Description
title = "Isaac Lab Environments"
......
Changelog
---------
0.7.9 (2024-07-01)
~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Fixed the action space check in the Stable-Baselines3 wrapper. Earlier, the wrapper checked
the action space via :meth:`gymnasium.spaces.Box.is_bounded` method, which returned a bool
value instead of a string.
0.7.8 (2024-06-26)
~~~~~~~~~~~~~~~~~~
......
......@@ -144,13 +144,15 @@ class Sb3VecEnvWrapper(VecEnv):
self.num_envs = self.unwrapped.num_envs
self.sim_device = self.unwrapped.device
self.render_mode = self.unwrapped.render_mode
# obtain gym spaces
# note: stable-baselines3 does not like when we have unbounded action space so
# we set it to some high value here. Maybe this is not general but something to think about.
observation_space = self.unwrapped.single_observation_space["policy"]
action_space = self.unwrapped.single_action_space
if isinstance(action_space, gym.spaces.Box) and action_space.is_bounded() != "both":
if isinstance(action_space, gym.spaces.Box) and not action_space.is_bounded("both"):
action_space = gym.spaces.Box(low=-100, high=100, shape=action_space.shape)
# initialize vec-env
VecEnv.__init__(self, self.num_envs, observation_space, action_space)
# add buffer for logging episodic information
......
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