Skip to content

Commit d79ba36

Browse files
committed
[refactor] Cleanup codes
1 parent 3f9a400 commit d79ba36

30 files changed

Lines changed: 55 additions & 115 deletions

.github/ISSUE_TEMPLATE/1-bug.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ body:
66
- type: markdown
77
attributes:
88
value: |
9-
Thanks for taking the time to fill out this bug report, please make sure to [search for existing issues](https://github.com/OpenRobotLab/InternUtopia/issues) before filing a new one!
9+
Thanks for taking the time to fill out this bug report, please make sure to [search for existing issues](https://github.com/InternRobotics/InternUtopia/issues) before filing a new one!
1010
1111
- type: textarea
1212
id: bug-description

.github/ISSUE_TEMPLATE/3-question.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ body:
66
- type: markdown
77
attributes:
88
value: |
9-
Please make sure to [search for existing issues](https://github.com/OpenRobotLab/InternUtopia/issues) before filing a new one!
9+
Please make sure to [search for existing issues](https://github.com/InternRobotics/InternUtopia/issues) before filing a new one!
1010
1111
- type: textarea
1212
attributes:

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Thank you for your interest in contributing to InternUtopia! We welcome contributions from everyone. Please take a moment to review this guide to ensure a smooth collaboration.
44

5-
- [Reporting Bugs](https://github.com/OpenRobotLab/InternUtopia/issues/new/choose)
6-
- [Suggesting Enhancement](https://github.com/OpenRobotLab/InternUtopia/issues/new/choose)
7-
- [Questions and Discussions](https://github.com/OpenRobotLab/InternUtopia/issues/new/choose)
5+
- [Reporting Bugs](https://github.com/InternRobotics/InternUtopia/issues/new/choose)
6+
- [Suggesting Enhancement](https://github.com/InternRobotics/InternUtopia/issues/new/choose)
7+
- [Questions and Discussions](https://github.com/InternRobotics/InternUtopia/issues/new/choose)
88
- [Submitting Code Changes](#submitting-code-changes)
99
- [Reviewing and Merging](#reviewing-and-merging)
1010

internutopia/core/config/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from enum import Enum
2-
from typing import List, Optional
2+
from typing import Annotated, List, Optional
33

4-
from pydantic import BaseModel
4+
from pydantic import BaseModel, Field
55

66
from internutopia.core.config.distribution import DistributionCfg
77
from internutopia.core.config.object import ObjectCfg
@@ -24,7 +24,7 @@ class SimConfig(BaseModel):
2424
use_fabric: Optional[bool] = False
2525
headless: Optional[bool] = True
2626
webrtc: Optional[bool] = False
27-
native: Optional[bool] = False
27+
native: Annotated[Optional[bool], Field(deprecated='Deprecated for isaacsim ≥ 4.5.0')] = False
2828

2929

3030
class Config(BaseModel):

internutopia/core/robot/articulation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def create(
211211
) -> 'IArticulation':
212212
"""
213213
Factory method to create IArticulation instances based on simulator_type.
214+
214215
Args:
215216
simulator_type (str): simulator type.
216217
usd_path (str, optional): The file path to the USD containing the robot definition.

internutopia/core/robot/controller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, config: ControllerCfg, robot: BaseRobot, scene: IScene):
2323
Args:
2424
config (ControllerCfg): controller configuration.
2525
robot (BaseRobot): robot owning the controller.
26-
scene (Scene): scene from isaac sim.
26+
scene (IScene): scene interface.
2727
2828
"""
2929
self.sub_controllers = None

internutopia/core/runner.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,9 @@ def _next_episodes(self, reset_tasks: List[str] = None) -> List[TaskCfg]:
439439
return task_configs_list
440440

441441
def get_obj(self, name: str) -> IRigidBody:
442-
return self._scene.get(name)
442+
# Only supported in gym_env.
443+
# TODO: handle name by a more robust way and maybe support vec env
444+
return self._scene.get(name + '_0')
443445

444446
def remove_collider(self, prim_path: str):
445447
from omni.physx.scripts import utils
@@ -459,9 +461,10 @@ def create_world(self):
459461
physics_dt = self.config.simulator.physics_dt
460462
rendering_dt = self.config.simulator.rendering_dt
461463
physics_dt = eval(physics_dt) if isinstance(physics_dt, str) else physics_dt
462-
rendering_dtt = eval(rendering_dt) if isinstance(rendering_dt, str) else rendering_dt
464+
self.dt = physics_dt
465+
rendering_dt = eval(rendering_dt) if isinstance(rendering_dt, str) else rendering_dt
463466
use_fabric = self.config.simulator.use_fabric
464-
log.info(f'simulator params: physics dt={physics_dt}, rendering dt={rendering_dtt}, use_fabric={use_fabric}')
467+
log.info(f'simulator params: physics dt={physics_dt}, rendering dt={rendering_dt}, use_fabric={use_fabric}')
465468
from omni.isaac.core import World
466469

467470
self._world: World = World(

internutopia/core/sensor/camera.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ def create(
7171
simulator_type (str): simulator type.
7272
name (str): The unique identifier for the camera.
7373
prim_path (Optional[str]): The primary path associated with the camera.
74-
rgba (Optional[bool], default=False): Whether to get rgba form the camera or not.
75-
distance_to_image_plane (Optional[bool], default=False): Whether to get distance_to_image_plane form the camera or not.
76-
bounding_box_2d_tight (Optional[bool], default=False): Whether to get bounding_box_2d_tight form the camera or not.
77-
camera_params (Optional[bool], default=False): Whether to get camera_params form the camera or not.
74+
rgba (Optional[bool], default=False): Whether to get rgba from the camera or not.
75+
distance_to_image_plane (Optional[bool], default=False): Whether to get distance_to_image_plane from the camera or not.
76+
bounding_box_2d_tight (Optional[bool], default=False): Whether to get bounding_box_2d_tight from the camera or not.
77+
camera_params (Optional[bool], default=False): Whether to get camera_params from the camera or not.
7878
resolution (Optional[Tuple[int, int]], optional): resolution of the camera (width, height). Defaults to None.
7979
position (Optional[Tuple[float, float, float]], optional): position in the world frame of the prim. shape is (3, ). Defaults to None, which means left unchanged.
8080
translation (Optional[Tuple[float, float, float]], optional): translation in the local frame of the prim (with respect to its parent prim). shape is (3, ). Defaults to None, which means left unchanged.

internutopia/core/vec_env.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,13 @@
88

99
class Env:
1010
"""
11-
Represents an environment for multi env and multi agents. **Not gymnasium compatible**.
11+
Vectorized environments to run multiple independent environments simultaneously with multiple agents.
1212
13-
This class encapsulates the capability to reset, step, and close environments
14-
within a simulation framework. It provides properties to access the runner, active
15-
configs, simulation configuration, and other relevant components. The class is
16-
designed to manage the lifecycle of simulation tasks.
13+
**NOT gymnasium compatible**.
1714
1815
Parameters:
1916
config (Config): The config instance used for simulation
2017
management.
21-
22-
Methods:
23-
reset(env_ids: List[int] = None) -> Tuple[List, List]: Resets specified environments
24-
and returns initial observations and task configs.
25-
step(action: List[Union[Dict, OrderedDict]]) -> Tuple[List, List, List, List, List]:
26-
Executes a single step in the environment using provided actions.
27-
get_dt(): Retrieves the simulation timestep (dt).
28-
get_observations() -> List | Any: Fetches observations from the simulation environment.
29-
close(): Closes the simulation environment.
30-
finished() -> bool: Checks if all tasks in the simulation are completed.
31-
32-
Properties:
33-
runner: Provides access to the internal runner instance.
34-
is_render: Indicates whether the environment is in a renderable state.
35-
active_task_configs: Retrieves the currently active task configs.
36-
simulation_app: Retrieves the simulation app instance.
3718
"""
3819

3920
def __init__(self, config: Config) -> None:

internutopia/demo/aliengo_locomotion.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,11 @@
99
)
1010
from internutopia_extension.configs.tasks import SingleInferenceTaskCfg
1111

12-
headless = False
13-
webrtc = False
14-
15-
if not has_display():
16-
headless = True
17-
webrtc = True
12+
headless = not has_display()
1813

1914

2015
config = Config(
21-
simulator=SimConfig(physics_dt=1 / 240, rendering_dt=1 / 240, use_fabric=False, webrtc=webrtc, headless=headless),
16+
simulator=SimConfig(physics_dt=1 / 240, rendering_dt=1 / 240, use_fabric=False, headless=headless, webrtc=headless),
2217
task_configs=[
2318
SingleInferenceTaskCfg(
2419
scene_asset_path=gm.ASSET_PATH + '/scenes/empty.usd',

0 commit comments

Comments
 (0)