Skip to content

Commit

Permalink
revert debug and testing codes in cartpole examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jtigue-bdai committed Oct 8, 2024
1 parent 00195e7 commit 9ba5200
Show file tree
Hide file tree
Showing 15 changed files with 13 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import carb
import omni.isaac.core.utils.torch as torch_utils

from omni.isaac.lab.managers import ActionManager, ManagerLiveVisualizer, EventManager, ObservationManager
from omni.isaac.lab.managers import ActionManager, EventManager, ManagerLiveVisualizer, ObservationManager
from omni.isaac.lab.scene import InteractiveScene
from omni.isaac.lab.sim import SimulationContext
from omni.isaac.lab.utils.timer import Timer
Expand Down Expand Up @@ -228,8 +228,8 @@ def setup_manager_visualizers(self):
"""Creates live visualizers for manager terms."""

self.manager_visualizers = {
"action_manager" : ManagerLiveVisualizer(manager=self.action_manager),
"observation_manager" : ManagerLiveVisualizer(manager=self.observation_manager),
"action_manager": ManagerLiveVisualizer(manager=self.action_manager),
"observation_manager": ManagerLiveVisualizer(manager=self.observation_manager),
}

"""
Expand Down Expand Up @@ -383,4 +383,3 @@ def _reset_idx(self, env_ids: Sequence[int]):
# -- event manager
info = self.event_manager.reset(env_ids)
self.extras["log"].update(info)

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from dataclasses import MISSING

import omni.isaac.lab.envs.mdp as mdp
from omni.isaac.lab.managers import DefaultManagerBasedEnvLiveVisCfg
from omni.isaac.lab.managers import EventTermCfg as EventTerm
from omni.isaac.lab.scene import InteractiveSceneCfg
from omni.isaac.lab.sim import SimulationCfg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def setup_manager_visualizers(self):
"""Creates live visualizers for manager terms."""

self.manager_visualizers = {
"action_manager" : ManagerLiveVisualizer(manager=self.action_manager),
"observation_manager" : ManagerLiveVisualizer(manager=self.observation_manager),
"action_manager": ManagerLiveVisualizer(manager=self.action_manager),
"observation_manager": ManagerLiveVisualizer(manager=self.observation_manager),
"command_manager": ManagerLiveVisualizer(manager=self.command_manager),
"termination_manager": ManagerLiveVisualizer(manager=self.termination_manager),
"reward_manager": ManagerLiveVisualizer(manager=self.reward_manager),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from dataclasses import MISSING

from omni.isaac.lab.managers import DefaultManagerBasedRLEnvLiveVisCfg
from omni.isaac.lab.utils import configclass

from .manager_based_env_cfg import ManagerBasedEnvCfg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from omni.isaac.lab.managers import SceneEntityCfg
from omni.isaac.lab.sensors import Camera, RayCaster, RayCasterCamera, TiledCamera


if TYPE_CHECKING:
from omni.isaac.lab.envs import ManagerBasedEnv, ManagerBasedRLEnv

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import omni.usd
from pxr import PhysxSchema, Sdf, Usd, UsdGeom, UsdPhysics

# from omni.isaac.lab.ui.widgets.ui_visualizer_mixin import UiVisualizerMixin
from omni.isaac.lab.managers import ManagerLiveVisualizer

if TYPE_CHECKING:
Expand Down Expand Up @@ -261,7 +260,6 @@ def _visualize_manager(self, title: str, class_name: str) -> None:
else:
print(f"ManagerLiveVisualizer cannot be created for manager: {class_name}, Manager does not exist")


"""
Custom callbacks for UI elements.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
from .curriculum_manager import CurriculumManager
from .event_manager import EventManager
from .manager_base import ManagerBase, ManagerTermBase
from .manager_live_visualizer import (
DefaultManagerBasedEnvLiveVisCfg,
DefaultManagerBasedRLEnvLiveVisCfg,
EnvLiveVisualizer,
ManagerLiveVisualizer,
)
from .manager_live_visualizer import ManagerLiveVisualizer
from .manager_term_cfg import (
ActionTermCfg,
CommandTermCfg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def get_active_iterable_terms(self, env_idx: int) -> Sequence[tuple[str, Sequenc
"""Returns the active terms as iterable sequence of tuples.
The first element of the tuple is the name of the term and the second element is the raw value(s) of the term.
Args:
env_idx: The specific environment to pull the active terms from.
env_idx: The specific environment to pull the active terms from.
Returns:
The active terms.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def get_active_iterable_terms(self, env_idx: int) -> Sequence[tuple[str, Sequenc
"""Returns the active terms as iterable sequence of tuples.
The first element of the tuple is the name of the term and the second element is the raw value(s) of the term.
Args:
env_idx: The specific environment to pull the active terms from.
env_idx: The specific environment to pull the active terms from.
Returns:
The active terms.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_active_iterable_terms(self, env_idx: int) -> Sequence[tuple[str, Sequenc
"""Returns the active terms as iterable sequence of tuples.
The first element of the tuple is the name of the term and the second element is the raw value(s) of the term.
Args:
env_idx: The specific environment to pull the active terms from.
env_idx: The specific environment to pull the active terms from.
Returns:
The active terms.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def get_active_iterable_terms(self, env_idx: int) -> Sequence[tuple[str, Sequenc
"""Returns the active terms as iterable sequence of tuples.
The first element of the tuple is the name of the term and the second element is the raw value(s) of the term.
Args:
env_idx: The specific environment to pull the active terms from.
env_idx: The specific environment to pull the active terms from.
Returns:
The active terms.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def get_active_iterable_terms(self, env_idx: int) -> Sequence[tuple[str, Sequenc
"""Returns the active terms as iterable sequence of tuples.
The first element of the tuple is the name of the term and the second element is the raw value(s) of the term.
Args:
env_idx: The specific environment to pull the active terms from.
env_idx: The specific environment to pull the active terms from.
Returns:
The active terms.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def get_active_iterable_terms(self, env_idx: int) -> Sequence[tuple[str, Sequenc
"""Returns the active terms as iterable sequence of tuples.
The first element of the tuple is the name of the term and the second element is the raw value(s) of the term.
Args:
env_idx: The specific environment to pull the active terms from.
env_idx: The specific environment to pull the active terms from.
Returns:
The active terms.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from omni.isaac.lab.managers import SceneEntityCfg
from omni.isaac.lab.managers import TerminationTermCfg as DoneTerm
from omni.isaac.lab.scene import InteractiveSceneCfg
from omni.isaac.lab.sensors import CameraCfg
from omni.isaac.lab.utils import configclass

import omni.isaac.lab_tasks.manager_based.classic.cartpole.mdp as mdp
Expand Down Expand Up @@ -55,18 +54,6 @@ class CartpoleSceneCfg(InteractiveSceneCfg):
init_state=AssetBaseCfg.InitialStateCfg(rot=(0.738, 0.477, 0.477, 0.0)),
)

camera = CameraCfg(
prim_path="{ENV_REGEX_NS}/Robot/front_cam",
update_period=0.1,
height=150,
width=150,
data_types=["distance_to_image_plane"],
spawn=sim_utils.PinholeCameraCfg(
focal_length=24.0, focus_distance=400.0, horizontal_aperture=60.0, clipping_range=(0.1, 1)
),
offset=CameraCfg.OffsetCfg(pos=(-0.5, 0.0, 0.015), rot=(0.5, -0.5, 0.5, -0.5), convention="ros"),
)


##
# MDP settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,8 @@ def __post_init__(self) -> None:
self.enable_corruption = False
self.concatenate_terms = True

@configclass
class PerceptionCfg(ObsGroup):
"""Observation for perception group."""

depth_image = ObsTerm(func=mdp.camera_depth_image, params={"sensor_cfg": SceneEntityCfg("camera")})

# observation groups
policy: PolicyCfg = PolicyCfg()
perception: PerceptionCfg = PerceptionCfg()


@configclass
Expand Down Expand Up @@ -160,7 +153,7 @@ def main():
# step the environment
obs, _ = env.step(joint_efforts)
# print current orientation of pole
# print("[Env 0]: Pole joint: ", obs["policy"][0][1].item())
print("[Env 0]: Pole joint: ", obs["policy"][0][1].item())
# update counter
count += 1

Expand Down

0 comments on commit 9ba5200

Please sign in to comment.