Skip to content
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

Switches from carb to omni.log for logging #1215

Merged
merged 6 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,8 @@ def _config_resolution(self, launcher_args: dict):
" The file does not exist."
)

# Resolve the absolute path of the experience file
self._sim_experience_file = os.path.abspath(self._sim_experience_file)
print(f"[INFO][AppLauncher]: Loading experience file: {self._sim_experience_file}")
# Remove all values from input keyword args which are not meant for SimulationApp
# Assign all the passed settings to a dictionary for the simulation app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from prettytable import PrettyTable
from typing import TYPE_CHECKING

import carb
import omni.isaac.core.utils.stage as stage_utils
import omni.log
import omni.physics.tensors.impl.api as physx
from omni.isaac.core.utils.types import ArticulationActions
from pxr import PhysxSchema, UsdPhysics
Expand Down Expand Up @@ -542,7 +542,7 @@ def write_joint_limits_to_sim(
# update default joint pos to stay within the new limits
if torch.any((self._data.default_joint_pos < limits[..., 0]) | (self._data.default_joint_pos > limits[..., 1])):
self._data.default_joint_pos = torch.clamp(self._data.default_joint_pos, limits[..., 0], limits[..., 1])
carb.log_warn(
omni.log.warn(
"Some default joint positions are outside of the range of the new joint limits. Default joint positions"
" will be clamped to be within the new joint limits."
)
Expand Down Expand Up @@ -925,13 +925,13 @@ def _initialize_impl(self):
raise RuntimeError(f"Failed to create articulation at: {self.cfg.prim_path}. Please check PhysX logs.")

# log information about the articulation
carb.log_info(f"Articulation initialized at: {self.cfg.prim_path} with root '{root_prim_path_expr}'.")
carb.log_info(f"Is fixed root: {self.is_fixed_base}")
carb.log_info(f"Number of bodies: {self.num_bodies}")
carb.log_info(f"Body names: {self.body_names}")
carb.log_info(f"Number of joints: {self.num_joints}")
carb.log_info(f"Joint names: {self.joint_names}")
carb.log_info(f"Number of fixed tendons: {self.num_fixed_tendons}")
omni.log.info(f"Articulation initialized at: {self.cfg.prim_path} with root '{root_prim_path_expr}'.")
omni.log.info(f"Is fixed root: {self.is_fixed_base}")
omni.log.info(f"Number of bodies: {self.num_bodies}")
omni.log.info(f"Body names: {self.body_names}")
omni.log.info(f"Number of joints: {self.num_joints}")
omni.log.info(f"Joint names: {self.joint_names}")
omni.log.info(f"Number of fixed tendons: {self.num_fixed_tendons}")

# container for data access
self._data = ArticulationData(self.root_physx_view, self.device)
Expand Down Expand Up @@ -1142,7 +1142,7 @@ def _process_actuators_cfg(self):
velocity_limit=usd_velocity_limit[:, joint_ids],
)
# log information on actuator groups
carb.log_info(
omni.log.info(
f"Actuator collection: {actuator_name} with model '{actuator_cfg.class_type.__name__}' and"
f" joint names: {joint_names} [{joint_ids}]."
)
Expand Down Expand Up @@ -1177,7 +1177,7 @@ def _process_actuators_cfg(self):
# perform some sanity checks to ensure actuators are prepared correctly
total_act_joints = sum(actuator.num_joints for actuator in self.actuators.values())
if total_act_joints != (self.num_joints - self.num_fixed_tendons):
carb.log_warn(
omni.log.warn(
"Not all actuators are configured! Total number of actuated joints not equal to number of"
f" joints available: {total_act_joints} != {self.num_joints - self.num_fixed_tendons}."
)
Expand Down Expand Up @@ -1336,7 +1336,7 @@ def _log_articulation_joint_info(self):
effort_limits[index],
])
# convert table to string
carb.log_info(f"Simulation parameters for joints in {self.cfg.prim_path}:\n" + table.get_string())
omni.log.info(f"Simulation parameters for joints in {self.cfg.prim_path}:\n" + table.get_string())

# read out all tendon parameters from simulation
if self.num_fixed_tendons > 0:
Expand Down Expand Up @@ -1372,4 +1372,4 @@ def _log_articulation_joint_info(self):
ft_offsets[index],
])
# convert table to string
carb.log_info(f"Simulation parameters for tendons in {self.cfg.prim_path}:\n" + tendon_table.get_string())
omni.log.info(f"Simulation parameters for tendons in {self.cfg.prim_path}:\n" + tendon_table.get_string())
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING

import carb
import omni.log
import omni.physics.tensors.impl.api as physx
from pxr import PhysxSchema, UsdShade

Expand Down Expand Up @@ -305,7 +305,7 @@ def _initialize_impl(self):
material_prim = mat_prim
break
if material_prim is None:
carb.log_info(
omni.log.info(
f"Failed to find a deformable material binding for '{root_prim.GetPath().pathString}'."
" The material properties will be set to default values and are not modifiable at runtime."
" If you want to modify the material properties, please ensure that the material is bound"
Expand Down Expand Up @@ -341,14 +341,14 @@ def _initialize_impl(self):
self._material_physx_view = None

# log information about the deformable body
carb.log_info(f"Deformable body initialized at: {root_prim_path_expr}")
carb.log_info(f"Number of instances: {self.num_instances}")
carb.log_info(f"Number of bodies: {self.num_bodies}")
omni.log.info(f"Deformable body initialized at: {root_prim_path_expr}")
omni.log.info(f"Number of instances: {self.num_instances}")
omni.log.info(f"Number of bodies: {self.num_bodies}")
if self._material_physx_view is not None:
carb.log_info(f"Deformable material initialized at: {material_prim_path_expr}")
carb.log_info(f"Number of instances: {self._material_physx_view.count}")
omni.log.info(f"Deformable material initialized at: {material_prim_path_expr}")
omni.log.info(f"Number of instances: {self._material_physx_view.count}")
else:
carb.log_info("No deformable material found. Material properties will be set to default values.")
omni.log.info("No deformable material found. Material properties will be set to default values.")

# container for data access
self._data = DeformableObjectData(self.root_physx_view, self.device)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING

import carb
import omni.log
import omni.physics.tensors.impl.api as physx
from pxr import UsdPhysics

Expand Down Expand Up @@ -299,10 +299,10 @@ def _initialize_impl(self):
raise RuntimeError(f"Failed to create rigid body at: {self.cfg.prim_path}. Please check PhysX logs.")

# log information about the rigid body
carb.log_info(f"Rigid body initialized at: {self.cfg.prim_path} with root '{root_prim_path_expr}'.")
carb.log_info(f"Number of instances: {self.num_instances}")
carb.log_info(f"Number of bodies: {self.num_bodies}")
carb.log_info(f"Body names: {self.body_names}")
omni.log.info(f"Rigid body initialized at: {self.cfg.prim_path} with root '{root_prim_path_expr}'.")
omni.log.info(f"Number of instances: {self.num_instances}")
omni.log.info(f"Number of bodies: {self.num_bodies}")
omni.log.info(f"Body names: {self.body_names}")

# container for data access
self._data = RigidObjectData(self.root_physx_view, self.device)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
from collections.abc import Sequence
from typing import Any, ClassVar

import carb
import omni.isaac.core.utils.torch as torch_utils
import omni.kit.app
import omni.log
from omni.isaac.version import get_version

from omni.isaac.lab.managers import EventManager
Expand Down Expand Up @@ -83,7 +83,7 @@ def __init__(self, cfg: DirectMARLEnvCfg, render_mode: str | None = None, **kwar
if self.cfg.seed is not None:
self.cfg.seed = self.seed(self.cfg.seed)
else:
carb.log_warn("Seed not set for the environment. The environment creation may not be deterministic.")
omni.log.warn("Seed not set for the environment. The environment creation may not be deterministic.")

# create a simulation context to control the simulator
if SimulationContext.instance() is None:
Expand All @@ -105,7 +105,7 @@ def __init__(self, cfg: DirectMARLEnvCfg, render_mode: str | None = None, **kwar
f"({self.cfg.decimation}). Multiple multiple render calls will happen for each environment step."
"If this is not intended, set the render interval to be equal to the decimation."
)
carb.log_warn(msg)
omni.log.warn(msg)

# generate scene
with Timer("[INFO]: Time taken for scene creation", "scene_creation"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
from collections.abc import Sequence
from typing import Any, ClassVar

import carb
import omni.isaac.core.utils.torch as torch_utils
import omni.kit.app
import omni.log
from omni.isaac.version import get_version

from omni.isaac.lab.managers import EventManager
Expand Down Expand Up @@ -88,7 +88,7 @@ def __init__(self, cfg: DirectRLEnvCfg, render_mode: str | None = None, **kwargs
if self.cfg.seed is not None:
self.cfg.seed = self.seed(self.cfg.seed)
else:
carb.log_warn("Seed not set for the environment. The environment creation may not be deterministic.")
omni.log.warn("Seed not set for the environment. The environment creation may not be deterministic.")

# create a simulation context to control the simulator
if SimulationContext.instance() is None:
Expand All @@ -110,7 +110,7 @@ def __init__(self, cfg: DirectRLEnvCfg, render_mode: str | None = None, **kwargs
f"({self.cfg.decimation}). Multiple multiple render calls will happen for each environment step."
"If this is not intended, set the render interval to be equal to the decimation."
)
carb.log_warn(msg)
omni.log.warn(msg)

# generate scene
with Timer("[INFO]: Time taken for scene creation", "scene_creation"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from collections.abc import Sequence
from typing import Any

import carb
import omni.isaac.core.utils.torch as torch_utils
import omni.log

from omni.isaac.lab.managers import ActionManager, EventManager, ObservationManager
from omni.isaac.lab.scene import InteractiveScene
Expand Down Expand Up @@ -78,7 +78,7 @@ def __init__(self, cfg: ManagerBasedEnvCfg):
if self.cfg.seed is not None:
self.cfg.seed = self.seed(self.cfg.seed)
else:
carb.log_warn("Seed not set for the environment. The environment creation may not be deterministic.")
omni.log.warn("Seed not set for the environment. The environment creation may not be deterministic.")

# create a simulation context to control the simulator
if SimulationContext.instance() is None:
Expand Down Expand Up @@ -106,7 +106,7 @@ def __init__(self, cfg: ManagerBasedEnvCfg):
f"({self.cfg.decimation}). Multiple multiple render calls will happen for each environment step. "
"If this is not intended, set the render interval to be equal to the decimation."
)
carb.log_warn(msg)
omni.log.warn(msg)

# counter for simulation steps
self._sim_step_counter = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING

import carb
import omni.log

import omni.isaac.lab.utils.string as string_utils
from omni.isaac.lab.assets.articulation import Articulation
Expand Down Expand Up @@ -52,7 +52,7 @@ def __init__(self, cfg: actions_cfg.BinaryJointActionCfg, env: ManagerBasedEnv)
self._joint_ids, self._joint_names = self._asset.find_joints(self.cfg.joint_names)
self._num_joints = len(self._joint_ids)
# log the resolved joint names for debugging
carb.log_info(
omni.log.info(
f"Resolved joint names for the action term {self.__class__.__name__}:"
f" {self._joint_names} [{self._joint_ids}]"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING

import carb
import omni.log

import omni.isaac.lab.utils.string as string_utils
from omni.isaac.lab.assets.articulation import Articulation
Expand Down Expand Up @@ -61,7 +61,7 @@ def __init__(self, cfg: actions_cfg.JointActionCfg, env: ManagerBasedEnv) -> Non
)
self._num_joints = len(self._joint_ids)
# log the resolved joint names for debugging
carb.log_info(
omni.log.info(
f"Resolved joint names for the action term {self.__class__.__name__}:"
f" {self._joint_names} [{self._joint_ids}]"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING

import carb
import omni.log

import omni.isaac.lab.utils.math as math_utils
import omni.isaac.lab.utils.string as string_utils
Expand Down Expand Up @@ -53,7 +53,7 @@ def __init__(self, cfg: actions_cfg.JointPositionToLimitsActionCfg, env: Manager
self._joint_ids, self._joint_names = self._asset.find_joints(self.cfg.joint_names)
self._num_joints = len(self._joint_ids)
# log the resolved joint names for debugging
carb.log_info(
omni.log.info(
f"Resolved joint names for the action term {self.__class__.__name__}:"
f" {self._joint_names} [{self._joint_ids}]"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING

import carb
import omni.log

from omni.isaac.lab.assets.articulation import Articulation
from omni.isaac.lab.managers.action_manager import ActionTerm
Expand Down Expand Up @@ -88,11 +88,11 @@ def __init__(self, cfg: actions_cfg.NonHolonomicActionCfg, env: ManagerBasedEnv)
self._joint_ids = [x_joint_id[0], y_joint_id[0], yaw_joint_id[0]]
self._joint_names = [x_joint_name[0], y_joint_name[0], yaw_joint_name[0]]
# log info for debugging
carb.log_info(
omni.log.info(
f"Resolved joint names for the action term {self.__class__.__name__}:"
f" {self._joint_names} [{self._joint_ids}]"
)
carb.log_info(
omni.log.info(
f"Resolved body name for the action term {self.__class__.__name__}: {self._body_name} [{self._body_idx}]"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING

import carb
import omni.log

import omni.isaac.lab.utils.math as math_utils
from omni.isaac.lab.assets.articulation import Articulation
Expand Down Expand Up @@ -70,11 +70,11 @@ def __init__(self, cfg: actions_cfg.DifferentialInverseKinematicsActionCfg, env:
self._jacobi_joint_ids = [i + 6 for i in self._joint_ids]

# log info for debugging
carb.log_info(
omni.log.info(
f"Resolved joint names for the action term {self.__class__.__name__}:"
f" {self._joint_names} [{self._joint_ids}]"
)
carb.log_info(
omni.log.info(
f"Resolved body name for the action term {self.__class__.__name__}: {self._body_name} [{self._body_idx}]"
)
# Avoid indexing across all joints for efficiency
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from prettytable import PrettyTable
from typing import TYPE_CHECKING

import carb
import omni.log

from .manager_base import ManagerBase, ManagerTermBase
from .manager_term_cfg import EventTermCfg
Expand Down Expand Up @@ -157,7 +157,7 @@ def apply(
"""
# check if mode is valid
if mode not in self._mode_term_names:
carb.log_warn(f"Event mode '{mode}' is not defined. Skipping event.")
omni.log.warn(f"Event mode '{mode}' is not defined. Skipping event.")
return
# check if mode is interval and dt is not provided
if mode == "interval" and dt is None:
Expand Down Expand Up @@ -324,7 +324,7 @@ def _prepare_terms(self):
)

if term_cfg.mode != "reset" and term_cfg.min_step_count_between_reset != 0:
carb.log_warn(
omni.log.warn(
f"Event term '{term_name}' has 'min_step_count_between_reset' set to a non-zero value"
" but the mode is not 'reset'. Ignoring the 'min_step_count_between_reset' value."
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any

import carb
import omni.log

import omni.isaac.lab.utils.string as string_utils
from omni.isaac.lab.utils import string_to_callable
Expand Down Expand Up @@ -251,7 +251,7 @@ def _resolve_common_term_cfg(self, term_name: str, term_cfg: ManagerTermBaseCfg,
if value.body_ids is not None:
msg += f"\n\tBody names: {value.body_names} [{value.body_ids}]"
# print the information
carb.log_info(msg)
omni.log.info(msg)
# store the entity
term_cfg.params[key] = value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def clone_environments(self, copy_from_source: bool = False):
carb_settings_iface = carb.settings.get_settings()
has_multi_assets = carb_settings_iface.get("/isaaclab/spawn/multi_assets")
if has_multi_assets and self.cfg.replicate_physics:
carb.log_warn(
omni.log.warn(
"Varying assets might have been spawned under different environments."
" However, the replicate physics flag is enabled in the 'InteractiveScene' configuration."
" This may adversely affect PhysX parsing. We recommend disabling this property."
Expand Down Expand Up @@ -239,7 +239,7 @@ def physics_scene_path(self) -> str:
for prim in self.stage.Traverse():
if prim.HasAPI(PhysxSchema.PhysxSceneAPI):
self._physics_scene_path = prim.GetPrimPath().pathString
carb.log_info(f"Physics scene prim path: {self._physics_scene_path}")
omni.log.info(f"Physics scene prim path: {self._physics_scene_path}")
break
if self._physics_scene_path is None:
raise RuntimeError("No physics scene found! Please make sure one exists.")
Expand Down
Loading
Loading