-
Notifications
You must be signed in to change notification settings - Fork 2k
Create Manager Based Cartpole Vision Example Environments #995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jsmith-bdai
merged 20 commits into
isaac-sim:main
from
glvov-bdai:feature/manager_based_vision_cartpole_envs
Sep 25, 2024
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9c01c16
Only convert perspective to orthogonal depth changes
glvov-bdai c1c7972
Manager Based Cartpole Only
glvov-bdai 3625314
Sync changelog
glvov-bdai 541c029
remove accidental paste
glvov-bdai a35a979
only cartpole and convert perspective util
garylvov 1b9c8d5
update depth logic to 1.2
garylvov 2ee8313
sync
glvov-bdai 1f8c09c
add normalization and reduce env count
glvov-bdai fb45a2d
Merge branch 'isaac-sim:main' into feature/manager_based_vision_cartp…
glvov-bdai 87c0dc6
Update source/extensions/omni.isaac.lab/omni/isaac/lab/envs/mdp/obser…
glvov-bdai 93ef5c1
merge main into branch
glvov-bdai 83bd480
split up config
glvov-bdai ec58f89
Update cartpole_camera_env_cfg.py
glvov-bdai 658b024
Merge branch 'main' into feature/manager_based_vision_cartpole_envs
glvov-bdai 7cebf7f
Merge branch 'main' into feature/manager_based_vision_cartpole_envs
glvov-bdai 7a894e4
Update CHANGELOG.rst
glvov-bdai 9334ffb
formatting and change default to NOT convert
glvov-bdai 8759608
add space between env list
glvov-bdai 9119edc
fix changelog
glvov-bdai fc24a9e
Update source/extensions/omni.isaac.lab_tasks/docs/CHANGELOG.rst
glvov-bdai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
...s/omni/isaac/lab_tasks/manager_based/classic/cartpole/agents/rl_games_camera_ppo_cfg.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
params: | ||
seed: 42 | ||
|
||
# environment wrapper clipping | ||
env: | ||
# added to the wrapper | ||
clip_observations: 5.0 | ||
# can make custom wrapper? | ||
clip_actions: 1.0 | ||
|
||
algo: | ||
name: a2c_continuous | ||
|
||
model: | ||
name: continuous_a2c_logstd | ||
|
||
# doesn't have this fine grained control but made it close | ||
network: | ||
name: actor_critic | ||
separate: False | ||
space: | ||
continuous: | ||
mu_activation: None | ||
sigma_activation: None | ||
|
||
mu_init: | ||
name: default | ||
sigma_init: | ||
name: const_initializer | ||
val: 0 | ||
fixed_sigma: True | ||
cnn: | ||
type: conv2d | ||
activation: relu | ||
initializer: | ||
name: default | ||
regularizer: | ||
name: None | ||
convs: | ||
- filters: 32 | ||
kernel_size: 8 | ||
strides: 4 | ||
padding: 0 | ||
- filters: 64 | ||
kernel_size: 4 | ||
strides: 2 | ||
padding: 0 | ||
- filters: 64 | ||
kernel_size: 3 | ||
strides: 1 | ||
padding: 0 | ||
|
||
mlp: | ||
units: [512] | ||
activation: elu | ||
initializer: | ||
name: default | ||
|
||
load_checkpoint: False # flag which sets whether to load the checkpoint | ||
load_path: '' # path to the checkpoint to load | ||
|
||
config: | ||
name: cartpole_camera | ||
env_name: rlgpu | ||
device: 'cuda:0' | ||
device_name: 'cuda:0' | ||
multi_gpu: False | ||
ppo: True | ||
mixed_precision: False | ||
normalize_input: False | ||
normalize_value: True | ||
num_actors: -1 # configured from the script (based on num_envs) | ||
reward_shaper: | ||
scale_value: 1.0 | ||
normalize_advantage: True | ||
gamma: 0.99 | ||
tau : 0.95 | ||
learning_rate: 1e-4 | ||
lr_schedule: adaptive | ||
kl_threshold: 0.008 | ||
score_to_win: 20000 | ||
max_epochs: 500 | ||
save_best_after: 50 | ||
save_frequency: 25 | ||
grad_norm: 1.0 | ||
entropy_coef: 0.0 | ||
truncate_grads: True | ||
e_clip: 0.2 | ||
horizon_length: 64 | ||
minibatch_size: 2048 | ||
mini_epochs: 4 | ||
critic_coef: 2 | ||
clip_value: True | ||
seq_length: 4 | ||
bounds_loss_coef: 0.0001 |
86 changes: 86 additions & 0 deletions
86
....lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_camera_env_cfg.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Copyright (c) 2022-2024, The Isaac Lab Project Developers. | ||
# All rights reserved. | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
import omni.isaac.lab.sim as sim_utils | ||
from omni.isaac.lab.envs.mdp.observations import grab_images | ||
from omni.isaac.lab.managers import ObservationGroupCfg as ObsGroup | ||
from omni.isaac.lab.managers import ObservationTermCfg as ObsTerm | ||
from omni.isaac.lab.managers import SceneEntityCfg | ||
from omni.isaac.lab.sensors import TiledCameraCfg | ||
from omni.isaac.lab.utils import configclass | ||
|
||
from omni.isaac.lab_tasks.manager_based.classic.cartpole.cartpole_env_cfg import CartpoleEnvCfg, CartpoleSceneCfg | ||
|
||
## | ||
# Scene definition | ||
## | ||
|
||
|
||
@configclass | ||
class CartpoleRGBCameraSceneCfg(CartpoleSceneCfg): | ||
tiled_camera: TiledCameraCfg = TiledCameraCfg( | ||
prim_path="{ENV_REGEX_NS}/Camera", | ||
offset=TiledCameraCfg.OffsetCfg(pos=(-7.0, 0.0, 3.0), rot=(0.9945, 0.0, 0.1045, 0.0), convention="world"), | ||
data_types=["rgb"], | ||
spawn=sim_utils.PinholeCameraCfg( | ||
focal_length=24.0, focus_distance=400.0, horizontal_aperture=20.955, clipping_range=(0.1, 20.0) | ||
), | ||
width=80, | ||
height=80, | ||
) | ||
|
||
|
||
@configclass | ||
class CartpoleDepthCameraSceneCfg(CartpoleSceneCfg): | ||
tiled_camera: TiledCameraCfg = TiledCameraCfg( | ||
prim_path="{ENV_REGEX_NS}/Camera", | ||
offset=TiledCameraCfg.OffsetCfg(pos=(-7.0, 0.0, 3.0), rot=(0.9945, 0.0, 0.1045, 0.0), convention="world"), | ||
data_types=["distance_to_camera"], | ||
spawn=sim_utils.PinholeCameraCfg( | ||
focal_length=24.0, focus_distance=400.0, horizontal_aperture=20.955, clipping_range=(0.1, 20.0) | ||
), | ||
width=80, | ||
height=80, | ||
) | ||
|
||
|
||
@configclass | ||
class RGBObservationsCfg: | ||
"""Observation specifications for the MDP.""" | ||
|
||
@configclass | ||
class RGBCameraPolicyCfg(ObsGroup): | ||
"""Observations for policy group.""" | ||
|
||
image = ObsTerm(func=grab_images, params={"sensor_cfg": SceneEntityCfg("tiled_camera"), "data_type": "rgb"}) | ||
|
||
def __post_init__(self) -> None: | ||
self.enable_corruption = False | ||
self.concatenate_terms = True | ||
|
||
policy: ObsGroup = RGBCameraPolicyCfg() | ||
|
||
|
||
@configclass | ||
class DepthObservationsCfg: | ||
@configclass | ||
class DepthCameraPolicyCfg(RGBObservationsCfg.RGBCameraPolicyCfg): | ||
image = ObsTerm( | ||
func=grab_images, params={"sensor_cfg": SceneEntityCfg("tiled_camera"), "data_type": "distance_to_camera"} | ||
) | ||
|
||
policy: ObsGroup = DepthCameraPolicyCfg() | ||
|
||
|
||
@configclass | ||
class CartpoleRGBCameraEnvCfg(CartpoleEnvCfg): | ||
scene: CartpoleSceneCfg = CartpoleRGBCameraSceneCfg(num_envs=1024, env_spacing=20) | ||
observations = RGBObservationsCfg() | ||
|
||
|
||
@configclass | ||
class CartpoleDepthCameraEnvCfg(CartpoleEnvCfg): | ||
scene: CartpoleSceneCfg = CartpoleDepthCameraSceneCfg(num_envs=1024, env_spacing=20) | ||
observations = DepthObservationsCfg() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.