Skip to content

Commit

Permalink
Merge branch 'main' into feature/hyperparam_tune
Browse files Browse the repository at this point in the history
  • Loading branch information
glvov-bdai authored Nov 7, 2024
2 parents 34f0908 + b9a49ca commit 0856cd6
Show file tree
Hide file tree
Showing 43 changed files with 651 additions and 300 deletions.
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Table of Contents
:maxdepth: 1
:caption: References

source/refs/reference_architecture/index
source/refs/additional_resources
source/refs/contributing
source/refs/troubleshooting
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
375 changes: 375 additions & 0 deletions docs/source/refs/reference_architecture/index.rst

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
# Register Gym environments.
##

task_entry = "omni.isaac.lab_tasks.direct.allegro_hand"
inhand_task_entry = "omni.isaac.lab_tasks.direct.inhand_manipulation"

gym.register(
id="Isaac-Repose-Cube-Allegro-Direct-v0",
entry_point=f"{inhand_task_entry}.inhand_manipulation_env:InHandManipulationEnv",
disable_env_checker=True,
kwargs={
"env_cfg_entry_point": f"{task_entry}.allegro_hand_env_cfg:AllegroHandEnvCfg",
"env_cfg_entry_point": f"{__name__}.allegro_hand_env_cfg:AllegroHandEnvCfg",
"rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml",
"rsl_rl_cfg_entry_point": f"{agents.__name__}.rsl_rl_ppo_cfg:AllegroHandPPORunnerCfg",
"skrl_cfg_entry_point": f"{agents.__name__}:skrl_ppo_cfg.yaml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
# Register Gym environments.
##

task_entry = "omni.isaac.lab_tasks.direct.ant"

gym.register(
id="Isaac-Ant-Direct-v0",
entry_point=f"{task_entry}.ant_env:AntEnv",
entry_point=f"{__name__}.ant_env:AntEnv",
disable_env_checker=True,
kwargs={
"env_cfg_entry_point": f"{task_entry}.ant_env:AntEnvCfg",
"env_cfg_entry_point": f"{__name__}.ant_env:AntEnvCfg",
"rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml",
"rsl_rl_cfg_entry_point": f"{agents.__name__}.rsl_rl_ppo_cfg:AntPPORunnerCfg",
"skrl_cfg_entry_point": f"{agents.__name__}:skrl_ppo_cfg.yaml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
# Register Gym environments.
##

task_entry = "omni.isaac.lab_tasks.direct.anymal_c"

gym.register(
id="Isaac-Velocity-Flat-Anymal-C-Direct-v0",
entry_point=f"{task_entry}.anymal_c_env:AnymalCEnv",
entry_point=f"{__name__}.anymal_c_env:AnymalCEnv",
disable_env_checker=True,
kwargs={
"env_cfg_entry_point": f"{task_entry}.anymal_c_env:AnymalCFlatEnvCfg",
"env_cfg_entry_point": f"{__name__}.anymal_c_env_cfg:AnymalCFlatEnvCfg",
"rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_flat_ppo_cfg.yaml",
"rsl_rl_cfg_entry_point": f"{agents.__name__}.rsl_rl_ppo_cfg:AnymalCFlatPPORunnerCfg",
"skrl_cfg_entry_point": f"{agents.__name__}:skrl_flat_ppo_cfg.yaml",
Expand All @@ -31,10 +29,10 @@

gym.register(
id="Isaac-Velocity-Rough-Anymal-C-Direct-v0",
entry_point=f"{task_entry}.anymal_c_env:AnymalCEnv",
entry_point=f"{__name__}.anymal_c_env:AnymalCEnv",
disable_env_checker=True,
kwargs={
"env_cfg_entry_point": f"{task_entry}.anymal_c_env:AnymalCRoughEnvCfg",
"env_cfg_entry_point": f"{__name__}.anymal_c_env_cfg:AnymalCRoughEnvCfg",
"rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_rough_ppo_cfg.yaml",
"rsl_rl_cfg_entry_point": f"{agents.__name__}.rsl_rl_ppo_cfg:AnymalCRoughPPORunnerCfg",
"skrl_cfg_entry_point": f"{agents.__name__}:skrl_rough_ppo_cfg.yaml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,150 +8,12 @@
import gymnasium as gym
import torch

import omni.isaac.lab.envs.mdp as mdp
import omni.isaac.lab.sim as sim_utils
from omni.isaac.lab.assets import Articulation, ArticulationCfg
from omni.isaac.lab.envs import DirectRLEnv, DirectRLEnvCfg
from omni.isaac.lab.managers import EventTermCfg as EventTerm
from omni.isaac.lab.managers import SceneEntityCfg
from omni.isaac.lab.scene import InteractiveSceneCfg
from omni.isaac.lab.sensors import ContactSensor, ContactSensorCfg, RayCaster, RayCasterCfg, patterns
from omni.isaac.lab.sim import SimulationCfg
from omni.isaac.lab.terrains import TerrainImporterCfg
from omni.isaac.lab.utils import configclass
from omni.isaac.lab.assets import Articulation
from omni.isaac.lab.envs import DirectRLEnv
from omni.isaac.lab.sensors import ContactSensor, RayCaster

##
# Pre-defined configs
##
from omni.isaac.lab_assets.anymal import ANYMAL_C_CFG # isort: skip
from omni.isaac.lab.terrains.config.rough import ROUGH_TERRAINS_CFG # isort: skip


@configclass
class EventCfg:
"""Configuration for randomization."""

physics_material = EventTerm(
func=mdp.randomize_rigid_body_material,
mode="startup",
params={
"asset_cfg": SceneEntityCfg("robot", body_names=".*"),
"static_friction_range": (0.8, 0.8),
"dynamic_friction_range": (0.6, 0.6),
"restitution_range": (0.0, 0.0),
"num_buckets": 64,
},
)

add_base_mass = EventTerm(
func=mdp.randomize_rigid_body_mass,
mode="startup",
params={
"asset_cfg": SceneEntityCfg("robot", body_names="base"),
"mass_distribution_params": (-5.0, 5.0),
"operation": "add",
},
)


@configclass
class AnymalCFlatEnvCfg(DirectRLEnvCfg):
# env
episode_length_s = 20.0
decimation = 4
action_scale = 0.5
action_space = 12
observation_space = 48
state_space = 0

# simulation
sim: SimulationCfg = SimulationCfg(
dt=1 / 200,
render_interval=decimation,
disable_contact_processing=True,
physics_material=sim_utils.RigidBodyMaterialCfg(
friction_combine_mode="multiply",
restitution_combine_mode="multiply",
static_friction=1.0,
dynamic_friction=1.0,
restitution=0.0,
),
)
terrain = TerrainImporterCfg(
prim_path="/World/ground",
terrain_type="plane",
collision_group=-1,
physics_material=sim_utils.RigidBodyMaterialCfg(
friction_combine_mode="multiply",
restitution_combine_mode="multiply",
static_friction=1.0,
dynamic_friction=1.0,
restitution=0.0,
),
debug_vis=False,
)

# scene
scene: InteractiveSceneCfg = InteractiveSceneCfg(num_envs=4096, env_spacing=4.0, replicate_physics=True)

# events
events: EventCfg = EventCfg()

# robot
robot: ArticulationCfg = ANYMAL_C_CFG.replace(prim_path="/World/envs/env_.*/Robot")
contact_sensor: ContactSensorCfg = ContactSensorCfg(
prim_path="/World/envs/env_.*/Robot/.*", history_length=3, update_period=0.005, track_air_time=True
)

# reward scales
lin_vel_reward_scale = 1.0
yaw_rate_reward_scale = 0.5
z_vel_reward_scale = -2.0
ang_vel_reward_scale = -0.05
joint_torque_reward_scale = -2.5e-5
joint_accel_reward_scale = -2.5e-7
action_rate_reward_scale = -0.01
feet_air_time_reward_scale = 0.5
undersired_contact_reward_scale = -1.0
flat_orientation_reward_scale = -5.0


@configclass
class AnymalCRoughEnvCfg(AnymalCFlatEnvCfg):
# env
observation_space = 235

terrain = TerrainImporterCfg(
prim_path="/World/ground",
terrain_type="generator",
terrain_generator=ROUGH_TERRAINS_CFG,
max_init_terrain_level=9,
collision_group=-1,
physics_material=sim_utils.RigidBodyMaterialCfg(
friction_combine_mode="multiply",
restitution_combine_mode="multiply",
static_friction=1.0,
dynamic_friction=1.0,
),
visual_material=sim_utils.MdlFileCfg(
mdl_path="{NVIDIA_NUCLEUS_DIR}/Materials/Base/Architecture/Shingles_01.mdl",
project_uvw=True,
),
debug_vis=False,
)

# we add a height scanner for perceptive locomotion
height_scanner = RayCasterCfg(
prim_path="/World/envs/env_.*/Robot/base",
offset=RayCasterCfg.OffsetCfg(pos=(0.0, 0.0, 20.0)),
attach_yaw_only=True,
pattern_cfg=patterns.GridPatternCfg(resolution=0.1, size=[1.6, 1.0]),
debug_vis=False,
mesh_prim_paths=["/World/ground"],
)

# reward scales (override from flat config)
flat_orientation_reward_scale = 0.0
from .anymal_c_env_cfg import AnymalCFlatEnvCfg, AnymalCRoughEnvCfg


class AnymalCEnv(DirectRLEnv):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Copyright (c) 2022-2024, The Isaac Lab Project Developers.
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause

import omni.isaac.lab.envs.mdp as mdp
import omni.isaac.lab.sim as sim_utils
from omni.isaac.lab.assets import ArticulationCfg
from omni.isaac.lab.envs import DirectRLEnvCfg
from omni.isaac.lab.managers import EventTermCfg as EventTerm
from omni.isaac.lab.managers import SceneEntityCfg
from omni.isaac.lab.scene import InteractiveSceneCfg
from omni.isaac.lab.sensors import ContactSensorCfg, RayCasterCfg, patterns
from omni.isaac.lab.sim import SimulationCfg
from omni.isaac.lab.terrains import TerrainImporterCfg
from omni.isaac.lab.utils import configclass

##
# Pre-defined configs
##
from omni.isaac.lab_assets.anymal import ANYMAL_C_CFG # isort: skip
from omni.isaac.lab.terrains.config.rough import ROUGH_TERRAINS_CFG # isort: skip


@configclass
class EventCfg:
"""Configuration for randomization."""

physics_material = EventTerm(
func=mdp.randomize_rigid_body_material,
mode="startup",
params={
"asset_cfg": SceneEntityCfg("robot", body_names=".*"),
"static_friction_range": (0.8, 0.8),
"dynamic_friction_range": (0.6, 0.6),
"restitution_range": (0.0, 0.0),
"num_buckets": 64,
},
)

add_base_mass = EventTerm(
func=mdp.randomize_rigid_body_mass,
mode="startup",
params={
"asset_cfg": SceneEntityCfg("robot", body_names="base"),
"mass_distribution_params": (-5.0, 5.0),
"operation": "add",
},
)


@configclass
class AnymalCFlatEnvCfg(DirectRLEnvCfg):
# env
episode_length_s = 20.0
decimation = 4
action_scale = 0.5
action_space = 12
observation_space = 48
state_space = 0

# simulation
sim: SimulationCfg = SimulationCfg(
dt=1 / 200,
render_interval=decimation,
disable_contact_processing=True,
physics_material=sim_utils.RigidBodyMaterialCfg(
friction_combine_mode="multiply",
restitution_combine_mode="multiply",
static_friction=1.0,
dynamic_friction=1.0,
restitution=0.0,
),
)
terrain = TerrainImporterCfg(
prim_path="/World/ground",
terrain_type="plane",
collision_group=-1,
physics_material=sim_utils.RigidBodyMaterialCfg(
friction_combine_mode="multiply",
restitution_combine_mode="multiply",
static_friction=1.0,
dynamic_friction=1.0,
restitution=0.0,
),
debug_vis=False,
)

# scene
scene: InteractiveSceneCfg = InteractiveSceneCfg(num_envs=4096, env_spacing=4.0, replicate_physics=True)

# events
events: EventCfg = EventCfg()

# robot
robot: ArticulationCfg = ANYMAL_C_CFG.replace(prim_path="/World/envs/env_.*/Robot")
contact_sensor: ContactSensorCfg = ContactSensorCfg(
prim_path="/World/envs/env_.*/Robot/.*", history_length=3, update_period=0.005, track_air_time=True
)

# reward scales
lin_vel_reward_scale = 1.0
yaw_rate_reward_scale = 0.5
z_vel_reward_scale = -2.0
ang_vel_reward_scale = -0.05
joint_torque_reward_scale = -2.5e-5
joint_accel_reward_scale = -2.5e-7
action_rate_reward_scale = -0.01
feet_air_time_reward_scale = 0.5
undersired_contact_reward_scale = -1.0
flat_orientation_reward_scale = -5.0


@configclass
class AnymalCRoughEnvCfg(AnymalCFlatEnvCfg):
# env
observation_space = 235

terrain = TerrainImporterCfg(
prim_path="/World/ground",
terrain_type="generator",
terrain_generator=ROUGH_TERRAINS_CFG,
max_init_terrain_level=9,
collision_group=-1,
physics_material=sim_utils.RigidBodyMaterialCfg(
friction_combine_mode="multiply",
restitution_combine_mode="multiply",
static_friction=1.0,
dynamic_friction=1.0,
),
visual_material=sim_utils.MdlFileCfg(
mdl_path="{NVIDIA_NUCLEUS_DIR}/Materials/Base/Architecture/Shingles_01.mdl",
project_uvw=True,
),
debug_vis=False,
)

# we add a height scanner for perceptive locomotion
height_scanner = RayCasterCfg(
prim_path="/World/envs/env_.*/Robot/base",
offset=RayCasterCfg.OffsetCfg(pos=(0.0, 0.0, 20.0)),
attach_yaw_only=True,
pattern_cfg=patterns.GridPatternCfg(resolution=0.1, size=[1.6, 1.0]),
debug_vis=False,
mesh_prim_paths=["/World/ground"],
)

# reward scales (override from flat config)
flat_orientation_reward_scale = 0.0
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
# Register Gym environments.
##

task_entry = "omni.isaac.lab_tasks.direct.cart_double_pendulum"

gym.register(
id="Isaac-Cart-Double-Pendulum-Direct-v0",
entry_point=f"{task_entry}.cart_double_pendulum_env:CartDoublePendulumEnv",
entry_point=f"{__name__}.cart_double_pendulum_env:CartDoublePendulumEnv",
disable_env_checker=True,
kwargs={
"env_cfg_entry_point": f"{task_entry}.cart_double_pendulum_env:CartDoublePendulumEnvCfg",
"env_cfg_entry_point": f"{__name__}.cart_double_pendulum_env:CartDoublePendulumEnvCfg",
"rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml",
"skrl_cfg_entry_point": f"{agents.__name__}:skrl_ppo_cfg.yaml",
"skrl_ippo_cfg_entry_point": f"{agents.__name__}:skrl_ippo_cfg.yaml",
Expand Down
Loading

0 comments on commit 0856cd6

Please sign in to comment.