Unverified Commit 259cc9d3 authored by Mayank Mittal's avatar Mayank Mittal Committed by GitHub

Updates pre-commit and setup.py to require Python 3.10 (#389)

# Description

As we are dropping support for Isaac Sim 2022.2, this MR updates the
pre-commit and setup.py to check for Python 3.10 language. Notable
changes when the formatter was run:

* `typing-extensions` has been merged to `typing`
* `collections.abc` is favored over `typing` for importing generic
types. The latter will be deprecated in future Python releases.

## Type of change

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.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
- [x] I have run all the tests with `./orbit.sh --test` and they pass
- [ ] 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 9c3db10e
repos:
- repo: https://github.com/python/black
rev: 23.10.1
rev: 24.1.1
hooks:
- id: black
args: ["--line-length", "120", "--preview"]
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-simplify, flake8-return]
......@@ -25,7 +25,7 @@ repos:
- id: detect-private-key
- id: debug-statements
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
......@@ -34,7 +34,7 @@ repos:
rev: v3.15.0
hooks:
- id: pyupgrade
args: ["--py37-plus"]
args: ["--py310-plus"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
......
[tool.isort]
py_version = 37
py_version = 310
line_length = 120
group_by_package = true
......@@ -36,7 +36,6 @@ extra_standard_library = [
"toml",
"trimesh",
"tqdm",
"typing_extensions",
]
# Imports from Isaac Sim and Omniverse
known_third_party = [
......@@ -71,7 +70,7 @@ exclude = [
]
typeCheckingMode = "basic"
pythonVersion = "3.7"
pythonVersion = "3.10"
pythonPlatform = "Linux"
enableTypeIgnoreComments = true
......
......@@ -26,12 +26,13 @@ setup(
description=EXTENSION_TOML_DATA["package"]["description"],
keywords=EXTENSION_TOML_DATA["package"]["keywords"],
include_package_data=True,
python_requires=">=3.7",
python_requires=">=3.10",
packages=["omni.isaac.contrib_tasks"],
classifiers=[
"Natural Language :: English",
"Programming Language :: Python :: 3.10",
"Isaac Sim :: 2023.1.0-hotfix.1",
"Isaac Sim :: 2023.1.1",
],
zip_safe=False,
)
......@@ -7,7 +7,8 @@ from __future__ import annotations
import torch
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
from omni.isaac.core.utils.types import ArticulationActions
......@@ -57,7 +58,7 @@ class ActuatorBase(ABC):
self,
cfg: ActuatorBaseCfg,
joint_names: list[str],
joint_ids: Sequence[int],
joint_ids: slice | Sequence[int],
num_envs: int,
device: str,
stiffness: torch.Tensor | float = 0.0,
......@@ -144,7 +145,7 @@ class ActuatorBase(ABC):
return self._joint_names
@property
def joint_indices(self) -> Sequence[int]:
def joint_indices(self) -> slice | Sequence[int]:
"""Articulation's joint indices that are part of the group.
Note:
......
......@@ -5,9 +5,9 @@
from __future__ import annotations
from collections.abc import Iterable
from dataclasses import MISSING
from typing import Iterable
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.utils import configclass
......@@ -32,16 +32,16 @@ class ActuatorBaseCfg:
This can be a list of joint names or a list of regex expressions (e.g. ".*").
"""
effort_limit: float | None = None
effort_limit: dict[str, float] | float | None = None
"""Force/Torque limit of the joints in the group. Defaults to None.
If None, the limit is set to the value specified in the USD joint prim.
"""
velocity_limit: float | None = None
velocity_limit: dict[str, float] | float | None = None
"""Velocity limit of the joints in the group. Defaults to None.
If None, the limit is set to infinity.
If None, the limit is set to the value specified in the USD joint prim.
"""
stiffness: dict[str, float] | float | None = MISSING
......
......@@ -15,7 +15,8 @@ Currently, the following models are supported:
from __future__ import annotations
import torch
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
from omni.isaac.core.utils.types import ArticulationActions
......
......@@ -6,7 +6,8 @@
from __future__ import annotations
import torch
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
from omni.isaac.core.utils.types import ArticulationActions
......
......@@ -116,6 +116,7 @@ The following snippet shows how use the :class:`AppLauncher` in different ways:
.. _`Native Livestream`: https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/manual_livestream_clients.html#isaac-sim-setup-kit-remote
.. _`Websocket Livestream`: https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/manual_livestream_clients.html#isaac-sim-setup-livestream-webrtc
.. _`WebRTC Livestream`: https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/manual_livestream_clients.html#isaac-sim-setup-livestream-websocket
"""
from __future__ import annotations
......@@ -125,8 +126,7 @@ import faulthandler
import os
import re
import sys
from typing import Any
from typing_extensions import Literal
from typing import Any, Literal
from omni.isaac.kit import SimulationApp
......
......@@ -9,8 +9,9 @@
from __future__ import annotations
import torch
from collections.abc import Sequence
from prettytable import PrettyTable
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING
import carb
import omni.physics.tensors.impl.api as physx
......@@ -729,18 +730,16 @@ class Articulation(RigidObject):
table.align["Name"] = "l"
# add info on each term
for index, name in enumerate(self.joint_names):
table.add_row(
[
index,
name,
stiffnesses[index],
dampings[index],
armatures[index],
frictions[index],
position_limits[index],
velocity_limits[index],
effort_limits[index],
]
)
table.add_row([
index,
name,
stiffnesses[index],
dampings[index],
armatures[index],
frictions[index],
position_limits[index],
velocity_limits[index],
effort_limits[index],
])
# convert table to string
carb.log_info(f"Simulation parameters for joints in {self.cfg.prim_path}:\n" + table.get_string())
......@@ -4,7 +4,6 @@
# SPDX-License-Identifier: BSD-3-Clause
from dataclasses import MISSING
from typing import Dict
from omni.isaac.orbit.actuators import ActuatorBaseCfg
from omni.isaac.orbit.utils import configclass
......@@ -24,9 +23,9 @@ class ArticulationCfg(RigidObjectCfg):
"""Initial state of the articulation."""
# root position
joint_pos: Dict[str, float] = {".*": 0.0}
joint_pos: dict[str, float] = {".*": 0.0}
"""Joint positions of the joints. Defaults to 0.0 for all joints."""
joint_vel: Dict[str, float] = {".*": 0.0}
joint_vel: dict[str, float] = {".*": 0.0}
"""Joint velocities of the joints. Defaults to 0.0 for all joints."""
##
......@@ -38,5 +37,5 @@ class ArticulationCfg(RigidObjectCfg):
soft_joint_pos_limit_factor: float = 1.0
"""Fraction specifying the range of DOF position limits (parsed from the asset) to use.
Defaults to 1.0."""
actuators: Dict[str, ActuatorBaseCfg] = MISSING
actuators: dict[str, ActuatorBaseCfg] = MISSING
"""Actuators for the robot with corresponding joint names."""
......@@ -5,7 +5,6 @@
import torch
from dataclasses import dataclass
from typing import List
from ..rigid_object import RigidObjectData
......@@ -18,7 +17,7 @@ class ArticulationData(RigidObjectData):
# Properties.
##
joint_names: List[str] = None
joint_names: list[str] = None
"""Joint names in the order parsed by the simulation view."""
##
......
......@@ -9,7 +9,8 @@ import inspect
import re
import weakref
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any
import omni.kit.app
import omni.timeline
......
......@@ -6,7 +6,7 @@
from __future__ import annotations
from dataclasses import MISSING
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.sim import SpawnerCfg
from omni.isaac.orbit.utils import configclass
......
......@@ -6,7 +6,8 @@
from __future__ import annotations
import torch
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
import carb
import omni.physics.tensors.impl.api as physx
......
......@@ -9,7 +9,7 @@ from __future__ import annotations
import numpy as np
import torch
from typing import Sequence
from collections.abc import Sequence
import omni.isaac.core.utils.prims as prim_utils
import omni.isaac.core.utils.stage as stage_utils
......
......@@ -9,7 +9,7 @@ from __future__ import annotations
import numpy as np
import torch
from typing import Sequence
from collections.abc import Sequence
import omni.isaac.core.utils.prims as prim_utils
import omni.isaac.core.utils.stage as stage_utils
......
......@@ -11,8 +11,9 @@ import builtins
import math
import numpy as np
import scipy.spatial.transform as tf
from collections.abc import Sequence
from dataclasses import dataclass
from typing import Any, Sequence
from typing import Any
import omni.isaac.core.utils.prims as prim_utils
import omni.isaac.core.utils.stage as stage_utils
......
......@@ -7,8 +7,8 @@ from __future__ import annotations
import numpy as np
import scipy.spatial.transform as tf
from collections.abc import Sequence
from dataclasses import dataclass
from typing import Sequence
import omni
import omni.isaac.core.utils.prims as prim_utils
......
......@@ -9,7 +9,7 @@ from __future__ import annotations
import numpy as np
import torch
from typing import Sequence
from collections.abc import Sequence
import omni.isaac.core.utils.prims as prim_utils
import omni.isaac.core.utils.stage as stage_utils
......
......@@ -7,7 +7,7 @@ from __future__ import annotations
import contextlib
import math
from typing import Sequence
from collections.abc import Sequence
import carb
import omni.isaac.core.utils.nucleus as nucleus_utils
......
......@@ -6,7 +6,7 @@
from __future__ import annotations
from dataclasses import MISSING
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.utils import configclass
......
......@@ -6,8 +6,8 @@
from __future__ import annotations
import torch
from collections.abc import Sequence
from dataclasses import MISSING
from typing import Sequence
from omni.isaac.orbit.utils import configclass
......
......@@ -6,8 +6,8 @@
from __future__ import annotations
import torch
from collections.abc import Sequence
from dataclasses import MISSING
from typing import Sequence
from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit.utils.math import apply_delta_pose, compute_pose_error
......
......@@ -8,7 +8,8 @@
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Any, Callable
from collections.abc import Callable
from typing import Any
class DeviceBase(ABC):
......
......@@ -9,7 +9,7 @@ from __future__ import annotations
import numpy as np
import weakref
from typing import Callable
from collections.abc import Callable
import carb
import omni
......
......@@ -7,8 +7,8 @@
import numpy as np
import weakref
from collections.abc import Callable
from scipy.spatial.transform.rotation import Rotation
from typing import Callable, Tuple
import carb
import omni
......@@ -127,7 +127,7 @@ class Se3Gamepad(DeviceBase):
"""
self._additional_callbacks[key] = func
def advance(self) -> Tuple[np.ndarray, bool]:
def advance(self) -> tuple[np.ndarray, bool]:
"""Provides the result from gamepad event state.
Returns:
......
......@@ -9,7 +9,7 @@ from __future__ import annotations
import numpy as np
import weakref
from typing import Callable
from collections.abc import Callable
import carb
import omni
......
......@@ -7,8 +7,8 @@
import numpy as np
import weakref
from collections.abc import Callable
from scipy.spatial.transform.rotation import Rotation
from typing import Callable, Tuple
import carb
import omni
......@@ -117,7 +117,7 @@ class Se3Keyboard(DeviceBase):
"""
self._additional_callbacks[key] = func
def advance(self) -> Tuple[np.ndarray, bool]:
def advance(self) -> tuple[np.ndarray, bool]:
"""Provides the result from keyboard event state.
Returns:
......
......@@ -11,7 +11,7 @@ import hid
import numpy as np
import threading
import time
from typing import Callable
from collections.abc import Callable
from ..device_base import DeviceBase
from .utils import convert_buffer
......
......@@ -11,8 +11,8 @@ import hid
import numpy as np
import threading
import time
from collections.abc import Callable
from scipy.spatial.transform.rotation import Rotation
from typing import Callable
from ..device_base import DeviceBase
from .utils import convert_buffer
......
......@@ -7,7 +7,8 @@ from __future__ import annotations
import builtins
import torch
from typing import Any, Dict, Sequence, Union
from collections.abc import Sequence
from typing import Any
import omni.isaac.core.utils.torch as torch_utils
......@@ -18,7 +19,7 @@ from omni.isaac.orbit.utils.timer import Timer
from .base_env_cfg import BaseEnvCfg
VecEnvObs = Dict[str, Union[torch.Tensor, Dict[str, torch.Tensor]]]
VecEnvObs = dict[str, torch.Tensor | dict[str, torch.Tensor]]
"""Observation returned by the environment.
The observations are stored in a dictionary. The keys are the group to which the observations belong.
......
......@@ -7,7 +7,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
from omni.isaac.orbit.managers import CommandTerm
......
......@@ -8,7 +8,8 @@
from __future__ import annotations
import torch
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
from omni.isaac.orbit.assets import Articulation
from omni.isaac.orbit.managers import CommandTerm
......
......@@ -8,7 +8,8 @@
from __future__ import annotations
import torch
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
from omni.isaac.orbit.assets import Articulation
from omni.isaac.orbit.managers import CommandTerm
......
......@@ -8,7 +8,8 @@
from __future__ import annotations
import torch
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
import omni.isaac.orbit.utils.math as math_utils
from omni.isaac.orbit.assets import Articulation
......
......@@ -11,7 +11,8 @@ the curriculum introduced by the function.
from __future__ import annotations
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from omni.isaac.orbit.envs import RLTaskEnv
......
......@@ -9,7 +9,8 @@ import gymnasium as gym
import math
import numpy as np
import torch
from typing import Any, ClassVar, Dict, Sequence, Tuple
from collections.abc import Sequence
from typing import Any, ClassVar
from omni.isaac.version import get_version
......@@ -18,7 +19,7 @@ from omni.isaac.orbit.managers import CommandManager, CurriculumManager, RewardM
from .base_env import BaseEnv, VecEnvObs
from .rl_task_env_cfg import RLTaskEnvCfg
VecEnvStepReturn = Tuple[VecEnvObs, torch.Tensor, torch.Tensor, torch.Tensor, Dict]
VecEnvStepReturn = tuple[VecEnvObs, torch.Tensor, torch.Tensor, torch.Tensor, dict]
"""The environment signals processed at the end of each step.
The tuple contains batched information for each sub-environment. The information is stored in the following order:
......@@ -286,12 +287,10 @@ class RLTaskEnv(BaseEnv, gym.Env):
if has_concatenated_obs:
self.single_observation_space[group_name] = gym.spaces.Box(low=-np.inf, high=np.inf, shape=group_dim)
else:
self.single_observation_space[group_name] = gym.spaces.Dict(
{
term_name: gym.spaces.Box(low=-np.inf, high=np.inf, shape=term_dim)
for term_name, term_dim in zip(group_term_names, group_term_dim)
}
)
self.single_observation_space[group_name] = gym.spaces.Dict({
term_name: gym.spaces.Box(low=-np.inf, high=np.inf, shape=term_dim)
for term_name, term_dim in zip(group_term_names, group_term_dim)
})
# action space (unbounded since we don't impose any limits)
action_dim = sum(self.action_manager.action_term_dim)
self.single_action_space = gym.spaces.Box(low=-np.inf, high=np.inf, shape=(action_dim,))
......
......@@ -9,8 +9,9 @@ from __future__ import annotations
import torch
from abc import abstractmethod
from collections.abc import Sequence
from prettytable import PrettyTable
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING
from omni.isaac.orbit.assets import AssetBase
......
......@@ -11,8 +11,9 @@ import inspect
import torch
import weakref
from abc import abstractmethod
from collections.abc import Sequence
from prettytable import PrettyTable
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING
import omni.kit.app
......
......@@ -8,8 +8,9 @@
from __future__ import annotations
import torch
from collections.abc import Sequence
from prettytable import PrettyTable
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING
from .manager_base import ManagerBase, ManagerTermBase
from .manager_term_cfg import CurriculumTermCfg
......
......@@ -8,7 +8,8 @@ from __future__ import annotations
import copy
import inspect
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any
import carb
......
......@@ -8,8 +8,9 @@
from __future__ import annotations
import torch
from collections.abc import Callable
from dataclasses import MISSING
from typing import TYPE_CHECKING, Any, Callable
from typing import TYPE_CHECKING, Any
from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit.utils.noise import NoiseCfg
......
......@@ -8,8 +8,9 @@
from __future__ import annotations
import torch
from collections.abc import Sequence
from prettytable import PrettyTable
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING
from .manager_base import ManagerBase, ManagerTermBase
from .manager_term_cfg import ObservationGroupCfg, ObservationTermCfg
......
......@@ -8,8 +8,9 @@
from __future__ import annotations
import torch
from collections.abc import Sequence
from prettytable import PrettyTable
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING
import carb
......
......@@ -8,8 +8,9 @@
from __future__ import annotations
import torch
from collections.abc import Sequence
from prettytable import PrettyTable
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING
from .manager_base import ManagerBase, ManagerTermBase
from .manager_term_cfg import RewardTermCfg
......
......@@ -8,8 +8,9 @@
from __future__ import annotations
import torch
from collections.abc import Sequence
from prettytable import PrettyTable
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING
from .manager_base import ManagerBase, ManagerTermBase
from .manager_term_cfg import TerminationTermCfg
......
......@@ -7,7 +7,8 @@ from __future__ import annotations
import builtins
import torch
from typing import Any, Sequence
from collections.abc import Sequence
from typing import Any
import carb
import omni.usd
......
......@@ -9,9 +9,9 @@ import math
import numpy as np
import re
import torch
from collections.abc import Sequence
from tensordict import TensorDict
from typing import TYPE_CHECKING, Any, Sequence
from typing_extensions import Literal
from typing import TYPE_CHECKING, Any, Literal
import omni.kit.commands
import omni.usd
......
......@@ -6,7 +6,7 @@
from __future__ import annotations
from dataclasses import MISSING
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.sim import FisheyeCameraCfg, PinholeCameraCfg
from omni.isaac.orbit.utils import configclass
......
......@@ -11,8 +11,8 @@ import math
import numpy as np
import torch
import torch.nn.functional as F
from typing import Sequence
from typing_extensions import Literal
from collections.abc import Sequence
from typing import Literal
import omni.isaac.core.utils.stage as stage_utils
import warp as wp
......
......@@ -9,7 +9,8 @@
from __future__ import annotations
import torch
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
import omni.physics.tensors.impl.api as physx
from pxr import PhysxSchema
......
......@@ -6,7 +6,8 @@
from __future__ import annotations
import torch
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
import carb
import omni.physics.tensors.impl.api as physx
......
......@@ -8,8 +8,8 @@
from __future__ import annotations
import torch
from collections.abc import Callable, Sequence
from dataclasses import MISSING
from typing import Callable, Sequence
from omni.isaac.orbit.utils import configclass
......
......@@ -8,7 +8,8 @@ from __future__ import annotations
import numpy as np
import re
import torch
from typing import TYPE_CHECKING, ClassVar, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING, ClassVar
import carb
import omni.physics.tensors.impl.api as physx
......
......@@ -6,9 +6,9 @@
from __future__ import annotations
import torch
from collections.abc import Sequence
from tensordict import TensorDict
from typing import TYPE_CHECKING, ClassVar, Sequence
from typing_extensions import Literal
from typing import TYPE_CHECKING, ClassVar, Literal
import omni.physics.tensors.impl.api as physx
from omni.isaac.core.prims import XFormPrimView
......
......@@ -7,7 +7,7 @@
from __future__ import annotations
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.utils import configclass
......
......@@ -15,7 +15,8 @@ import inspect
import torch
import weakref
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING, Any
import omni.kit.app
import omni.timeline
......
......@@ -6,7 +6,7 @@
from __future__ import annotations
from dataclasses import MISSING
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.sim.converters.asset_converter_base_cfg import AssetConverterBaseCfg
from omni.isaac.orbit.utils import configclass
......
......@@ -11,7 +11,7 @@ configuring the environment instances, viewer settings, and simulation parameter
from __future__ import annotations
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.utils import configclass
......
......@@ -5,8 +5,8 @@
from __future__ import annotations
from collections.abc import Callable
from dataclasses import MISSING
from typing import Callable
from omni.isaac.orbit.sim import converters, schemas
from omni.isaac.orbit.sim.spawners import materials
......
......@@ -5,9 +5,9 @@
from __future__ import annotations
from collections.abc import Callable
from dataclasses import MISSING
from typing import Callable
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.sim.spawners.spawner_cfg import SpawnerCfg
from omni.isaac.orbit.utils import configclass
......
......@@ -5,9 +5,9 @@
from __future__ import annotations
from collections.abc import Callable
from dataclasses import MISSING
from typing import Callable
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.utils import configclass
......
......@@ -5,8 +5,8 @@
from __future__ import annotations
from collections.abc import Callable
from dataclasses import MISSING
from typing import Callable
from omni.isaac.orbit.utils import configclass
......
......@@ -5,8 +5,8 @@
from __future__ import annotations
from typing import Callable
from typing_extensions import Literal
from collections.abc import Callable
from typing import Literal
from omni.isaac.orbit.sim.spawners.spawner_cfg import SpawnerCfg
from omni.isaac.orbit.utils import configclass
......
......@@ -5,9 +5,9 @@
from __future__ import annotations
from collections.abc import Callable
from dataclasses import MISSING
from typing import Callable
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.sim.spawners import materials
from omni.isaac.orbit.sim.spawners.spawner_cfg import RigidObjectSpawnerCfg
......
......@@ -5,8 +5,8 @@
from __future__ import annotations
from collections.abc import Callable
from dataclasses import MISSING
from typing import Callable
from pxr import Usd
......
......@@ -10,7 +10,8 @@ from __future__ import annotations
import functools
import inspect
import re
from typing import TYPE_CHECKING, Any, Callable
from collections.abc import Callable
from typing import TYPE_CHECKING, Any
import carb
import omni.isaac.core.utils.stage as stage_utils
......
......@@ -9,7 +9,8 @@ import copy
import functools
import numpy as np
import trimesh
from typing import TYPE_CHECKING, Callable
from collections.abc import Callable
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from .hf_terrains_cfg import HfTerrainBaseCfg
......
......@@ -16,9 +16,9 @@ from __future__ import annotations
import numpy as np
import trimesh
from collections.abc import Callable
from dataclasses import MISSING
from typing import Callable
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.utils import configclass
......
......@@ -8,7 +8,8 @@ from __future__ import annotations
import numpy as np
import torch
import trimesh
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
import warp
from pxr import UsdGeom
......
......@@ -6,8 +6,7 @@
from __future__ import annotations
from dataclasses import MISSING
from typing import TYPE_CHECKING
from typing_extensions import Literal
from typing import TYPE_CHECKING, Literal
import omni.isaac.orbit.sim as sim_utils
from omni.isaac.orbit.utils import configclass
......
......@@ -809,12 +809,10 @@ def repeated_objects_terrain(
meshes_list = list()
# compute quantities
origin = np.asarray((0.5 * cfg.size[0], 0.5 * cfg.size[1], 0.5 * height))
platform_corners = np.asarray(
[
[origin[0] - cfg.platform_width / 2, origin[1] - cfg.platform_width / 2],
[origin[0] + cfg.platform_width / 2, origin[1] + cfg.platform_width / 2],
]
)
platform_corners = np.asarray([
[origin[0] - cfg.platform_width / 2, origin[1] - cfg.platform_width / 2],
[origin[0] + cfg.platform_width / 2, origin[1] + cfg.platform_width / 2],
])
platform_corners[0, :] *= 1 - platform_clearance
platform_corners[1, :] *= 1 + platform_clearance
# sample center for objects
......
......@@ -6,7 +6,7 @@
from __future__ import annotations
from dataclasses import MISSING
from typing_extensions import Literal
from typing import Literal
import omni.isaac.orbit.terrains.trimesh.mesh_terrains as mesh_terrains
import omni.isaac.orbit.terrains.trimesh.utils as mesh_utils_terrains
......
......@@ -17,7 +17,7 @@ from __future__ import annotations
import io
import os
import tempfile
from typing_extensions import Literal
from typing import Literal
import carb
import omni.client
......
......@@ -8,10 +8,10 @@ from __future__ import annotations
"""Sub-module that provides a wrapper around the Python 3.7 onwards ``dataclasses`` module."""
import inspect
import sys
from collections.abc import Callable
from copy import deepcopy
from dataclasses import MISSING, Field, dataclass, field, replace
from typing import Any, Callable, ClassVar
from typing import Any, ClassVar
from .dict import class_to_dict, update_class_from_dict
......@@ -228,11 +228,8 @@ def _add_annotation_types(cls):
elif key != value.__name__:
# note: we don't want to add type annotations for nested configclass. Thus, we check if
# the name of the type matches the name of the variable.
if sys.version_info < (3, 10):
hints[key] = type[value]
else:
# since Python 3.10, type hints are stored as strings
hints[key] = f"type[{value.__name__}]"
# since Python 3.10, type hints are stored as strings
hints[key] = f"type[{value.__name__}]"
# Note: Do not change this line. `cls.__dict__.get("__annotations__", {})` is different from
# `cls.__annotations__` because of inheritance.
......
......@@ -10,7 +10,8 @@ from __future__ import annotations
import collections.abc
import hashlib
import json
from typing import Any, Iterable, Mapping
from collections.abc import Iterable, Mapping
from typing import Any
from .array import TENSOR_TYPE_CONVERSIONS, TENSOR_TYPES
from .string import callable_to_string, string_to_callable
......
......@@ -7,12 +7,11 @@
import os
import yaml
from typing import Dict, Union
from omni.isaac.orbit.utils import class_to_dict
def load_yaml(filename: str) -> Dict:
def load_yaml(filename: str) -> dict:
"""Loads an input PKL file safely.
Args:
......@@ -31,7 +30,7 @@ def load_yaml(filename: str) -> Dict:
return data
def dump_yaml(filename: str, data: Union[Dict, object], sort_keys: bool = False):
def dump_yaml(filename: str, data: dict | object, sort_keys: bool = False):
"""Saves data into a YAML file safely.
Note:
......
......@@ -10,7 +10,7 @@ from __future__ import annotations
import numpy as np
import torch
import torch.nn.functional
from typing_extensions import Literal
from typing import Literal
"""
General
......
......@@ -6,8 +6,8 @@
from __future__ import annotations
import torch
from collections.abc import Callable
from dataclasses import MISSING
from typing import Callable
from omni.isaac.orbit.utils import configclass
......
......@@ -11,7 +11,8 @@ import ast
import importlib
import inspect
import re
from typing import Any, Callable, Sequence
from collections.abc import Callable, Sequence
from typing import Any
"""
String formatting.
......
......@@ -28,8 +28,7 @@ INSTALL_REQUIRES = [
"gymnasium==0.29.0",
# procedural-generation
"trimesh",
"pyglet==1.5.27; python_version < '3.8'", # pyglet 2.0 requires python 3.8
"pyglet; python_version >= '3.8'",
"pyglet",
]
# Installation operation
......@@ -44,13 +43,14 @@ setup(
keywords=EXTENSION_TOML_DATA["package"]["keywords"],
license="BSD-3-Clause",
include_package_data=True,
python_requires=">=3.7",
python_requires=">=3.10",
install_requires=INSTALL_REQUIRES,
packages=["omni.isaac.orbit"],
classifiers=[
"Natural Language :: English",
"Programming Language :: Python :: 3.10",
"Isaac Sim :: 2023.1.0-hotfix.1",
"Isaac Sim :: 2023.1.1",
],
zip_safe=False,
)
......@@ -19,12 +19,12 @@ simulation_app = app_launcher.app
import copy
import os
import sys
import traceback
import unittest
from collections.abc import Callable
from dataclasses import MISSING, asdict, field
from functools import wraps
from typing import Callable, ClassVar
from typing import ClassVar
import carb
......@@ -651,10 +651,7 @@ class TestConfigClass(unittest.TestCase):
cfg = DummyClassCfg()
# since python 3.10, annotations are stored as strings
if sys.version_info >= (3, 10):
annotations = {k: eval(v) for k, v in cfg.__annotations__.items()}
else:
annotations = cfg.__annotations__
annotations = {k: eval(v) for k, v in cfg.__annotations__.items()}
# check types
self.assertEqual(annotations["class_name_1"], type)
self.assertEqual(annotations["class_name_2"], type[DummyClass])
......
......@@ -3,8 +3,7 @@
#
# SPDX-License-Identifier: BSD-3-Clause
"""Configuration for a simple Cartpole robot
"""
"""Configuration for a simple Cartpole robot."""
from __future__ import annotations
......
......@@ -26,8 +26,13 @@ setup(
description=EXTENSION_TOML_DATA["package"]["description"],
keywords=EXTENSION_TOML_DATA["package"]["keywords"],
include_package_data=True,
python_requires=">=3.7",
python_requires=">=3.10",
packages=["omni.isaac.orbit_assets"],
classifiers=["Natural Language :: English", "Programming Language :: Python :: 3.7"],
classifiers=[
"Natural Language :: English",
"Programming Language :: Python :: 3.10",
"Isaac Sim :: 2023.1.0-hotfix.1",
"Isaac Sim :: 2023.1.1",
],
zip_safe=False,
)
......@@ -2,7 +2,7 @@ Changelog
---------
0.5.5 (2024-02-05)
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
......
......@@ -12,7 +12,8 @@ the curriculum introduced by the function.
from __future__ import annotations
import torch
from typing import TYPE_CHECKING, Sequence
from collections.abc import Sequence
from typing import TYPE_CHECKING
from omni.isaac.orbit.assets import Articulation
from omni.isaac.orbit.managers import SceneEntityCfg
......
......@@ -12,7 +12,7 @@ import json
import numpy as np
import os
import torch
from typing import Iterable
from collections.abc import Iterable
import carb
......
......@@ -6,7 +6,7 @@
from __future__ import annotations
from dataclasses import MISSING
from typing_extensions import Literal
from typing import Literal
from omni.isaac.orbit.utils import configclass
......
......@@ -247,12 +247,10 @@ class SkrlSequentialLogTrainer(Trainer):
for timestep in tqdm.tqdm(range(self.initial_timestep, self.timesteps), disable=self.disable_progressbar):
# compute actions
with torch.no_grad():
actions = torch.vstack(
[
agent.act(states[scope[0] : scope[1]], timestep=timestep, timesteps=self.timesteps)[0]
for agent, scope in zip(self.agents, self.agents_scope)
]
)
actions = torch.vstack([
agent.act(states[scope[0] : scope[1]], timestep=timestep, timesteps=self.timesteps)[0]
for agent, scope in zip(self.agents, self.agents_scope)
])
# step the environments
next_states, rewards, terminated, truncated, infos = self.env.step(actions)
......
......@@ -54,7 +54,7 @@ setup(
description=EXTENSION_TOML_DATA["package"]["description"],
keywords=EXTENSION_TOML_DATA["package"]["keywords"],
include_package_data=True,
python_requires=">=3.7",
python_requires=">=3.10",
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
packages=["omni.isaac.orbit_tasks"],
......@@ -62,6 +62,7 @@ setup(
"Natural Language :: English",
"Programming Language :: Python :: 3.10",
"Isaac Sim :: 2023.1.0-hotfix.1",
"Isaac Sim :: 2023.1.1",
],
zip_safe=False,
)
......@@ -39,7 +39,7 @@ simulation_app = app_launcher.app
import gymnasium as gym
import torch
import traceback
from typing import Sequence
from collections.abc import Sequence
import carb
import warp as wp
......
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