Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
48 changes: 37 additions & 11 deletions configs/agents/rl/basic/cart_pole/train_config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
{
"trainer": {
"exp_name": "cart_pole_ppo",
"gym_config": "configs/agents/rl/basic/cart_pole/gym_config.json",
"seed": 42,
"device": "cuda:0",
"headless": true,
"enable_rt": false,
"gpu_id": 0,
"num_envs": 64,
"iterations": 1000,
Expand All @@ -22,30 +21,57 @@
"interval_step": 1,
"params": {
"name": "main_cam",
"resolution": [640, 480],
"eye": [-1.4, 1.4, 2.5],
"target": [0, 0, 0.7],
"up": [0, 0, 1],
"intrinsics": [600, 600, 320, 240],
"resolution": [
640,
480
],
"eye": [
-1.4,
1.4,
2.5
],
"target": [
0,
0,
0.7
],
"up": [
0,
0,
1
],
"intrinsics": [
600,
600,
320,
240
],
"save_path": "./outputs/videos/eval"
}
}
}
}
},
"renderer": "legacy"
},
"policy": {
"name": "actor_critic",
"actor": {
"type": "mlp",
"network_cfg": {
"hidden_sizes": [256, 256],
"hidden_sizes": [
256,
256
],
"activation": "relu"
}
},
"critic": {
"type": "mlp",
"network_cfg": {
"hidden_sizes": [256, 256],
"hidden_sizes": [
256,
256
],
"activation": "relu"
}
}
Expand All @@ -64,4 +90,4 @@
"max_grad_norm": 0.5
}
}
}
}
41 changes: 32 additions & 9 deletions configs/agents/rl/basic/cart_pole/train_config_grpo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"seed": 42,
"device": "cuda:0",
"headless": true,
"enable_rt": false,
"gpu_id": 0,
"num_envs": 64,
"iterations": 1000,
Expand All @@ -23,23 +22,47 @@
"interval_step": 1,
"params": {
"name": "main_cam",
"resolution": [640, 480],
"eye": [-1.4, 1.4, 2.5],
"target": [0, 0, 0.7],
"up": [0, 0, 1],
"intrinsics": [600, 600, 320, 240],
"resolution": [
640,
480
],
"eye": [
-1.4,
1.4,
2.5
],
"target": [
0,
0,
0.7
],
"up": [
0,
0,
1
],
"intrinsics": [
600,
600,
320,
240
],
"save_path": "./outputs/videos/eval"
}
}
}
}
},
"renderer": "legacy"
},
"policy": {
"name": "actor_only",
"actor": {
"type": "mlp",
"network_cfg": {
"hidden_sizes": [256, 256],
"hidden_sizes": [
256,
256
],
"activation": "relu"
}
}
Expand All @@ -55,7 +78,7 @@
"ent_coef": 0.01,
"kl_coef": 0.0,
"group_size": 4,
"eps": 1e-8,
"eps": 1e-08,
"reset_every_rollout": true,
"max_grad_norm": 0.5,
"truncate_at_first_done": true
Expand Down
48 changes: 37 additions & 11 deletions configs/agents/rl/push_cube/train_config.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
{
"trainer": {
"exp_name": "push_cube_ppo",
"gym_config": "configs/agents/rl/push_cube/gym_config.json",
"seed": 42,
"device": "cuda:0",
"headless": true,
"enable_rt": false,
"gpu_id": 0,
"num_envs": 64,
"iterations": 1000,
Expand All @@ -25,30 +24,57 @@
"interval_step": 1,
"params": {
"name": "main_cam",
"resolution": [640, 480],
"eye": [-1.4, 1.4, 2.0],
"target": [0, 0, 0],
"up": [0, 0, 1],
"intrinsics": [600, 600, 320, 240],
"resolution": [
640,
480
],
"eye": [
-1.4,
1.4,
2.0
],
"target": [
0,
0,
0
],
"up": [
0,
0,
1
],
"intrinsics": [
600,
600,
320,
240
],
"save_path": "./outputs/videos/eval"
}
}
}
}
},
"renderer": "legacy"
},
"policy": {
"name": "actor_critic",
"actor": {
"type": "mlp",
"network_cfg": {
"hidden_sizes": [256, 256],
"hidden_sizes": [
256,
256
],
"activation": "relu"
}
},
"critic": {
"type": "mlp",
"network_cfg": {
"hidden_sizes": [256, 256],
"hidden_sizes": [
256,
256
],
"activation": "relu"
}
}
Expand All @@ -67,4 +93,4 @@
"max_grad_norm": 0.5
}
}
}
}
2 changes: 1 addition & 1 deletion docs/source/overview/sim/sim_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sim_config = SimulationManagerCfg(
| `width` | `int` | `1920` | The width of the simulation window. |
| `height` | `int` | `1080` | The height of the simulation window. |
| `headless` | `bool` | `False` | Whether to run the simulation in headless mode (no Window). |
| `enable_rt` | `bool` | `False` | Whether to enable ray tracing rendering. |
| `renderer` | `bool` | `False` | Whether to enable ray tracing rendering. |
| `enable_denoiser` | `bool` | `True` | Whether to enable denoising for ray tracing rendering. |
| `spp` | `int` | `64` | Samples per pixel for ray tracing rendering. Only valid when ray tracing is enabled and denoiser is False. |
Comment on lines +36 to 38
| `gpu_id` | `int` | `0` | The gpu index that the simulation engine will be used. Affects gpu physics device. |
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial/gizmo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ Command-line options:
- ``--device cpu|cuda``: Choose simulation device
- ``--num_envs N``: Number of parallel environments
- ``--headless``: Run without GUI for automated testing
- ``--enable_rt``: Enable ray tracing for better visuals
- ``--renderer``: Enable ray tracing for better visuals

Once running:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial/robot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ You can customize the simulation with various command-line options:
python scripts/tutorials/sim/create_robot.py --headless

# Enable ray tracing rendering
python scripts/tutorials/sim/create_robot.py --enable_rt
python scripts/tutorials/sim/create_robot.py --renderer

Comment on lines 118 to 120
The simulation will show the robot moving through different poses, demonstrating basic joint control capabilities.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial/sensor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ You can customize the simulation with the following command-line options:
python scripts/tutorials/sim/create_sensor.py --headless

# Enable ray tracing rendering
python scripts/tutorials/sim/create_sensor.py --enable_rt
python scripts/tutorials/sim/create_sensor.py --renderer

# Attach the camera to the robot end-effector
python scripts/tutorials/sim/create_sensor.py --attach_sensor
Expand Down
1 change: 1 addition & 0 deletions docs/sync_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

Idempotent copy. Exit code 0 on success.
"""

import shutil
from pathlib import Path
import sys
Expand Down
1 change: 0 additions & 1 deletion embodichain/agents/datasets/online_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from embodichain.agents.engine.data import OnlineDataEngine
from embodichain.agents.datasets.sampler import ChunkSizeSampler


__all__ = [
"OnlineDataset",
]
Expand Down
1 change: 0 additions & 1 deletion embodichain/agents/datasets/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from abc import ABC, abstractmethod
from typing import Callable, Iterator, List, Optional, Union


__all__ = [
"ChunkSizeSampler",
"UniformChunkSampler",
Expand Down
3 changes: 2 additions & 1 deletion embodichain/agents/engine/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from tensordict import TensorDict
from tqdm import tqdm

from embodichain.lab.sim.cfg import RenderCfg
from embodichain.utils.logger import log_info, log_error
from embodichain.utils import configclass

Expand Down Expand Up @@ -112,7 +113,7 @@ def _sim_worker_fn(
env_cfg.sim_cfg = SimulationManagerCfg(
headless=gym_config.get("headless", True),
sim_device=gym_config.get("device", "cpu"),
enable_rt=gym_config.get("enable_rt", True),
render_cfg=RenderCfg(renderer=gym_config.get("renderer", "legacy")),
gpu_id=gym_config.get("gpu_id", 0),
)

Expand Down
1 change: 0 additions & 1 deletion embodichain/agents/rl/models/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import torch
import torch.nn as nn


ActivationName = Union[str, None]


Expand Down
7 changes: 4 additions & 3 deletions embodichain/agents/rl/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from embodichain.utils.utility import load_json
from embodichain.utils.module_utils import find_function_from_modules
from embodichain.lab.sim import SimulationManagerCfg
from embodichain.lab.sim.cfg import RenderCfg
from embodichain.lab.gym.envs.managers.cfg import EventCfg


Expand Down Expand Up @@ -73,7 +74,7 @@ def train_from_config(config_path: str):
save_freq = int(trainer_cfg.get("save_freq", 50000))
num_eval_episodes = int(trainer_cfg.get("num_eval_episodes", 5))
headless = bool(trainer_cfg.get("headless", True))
enable_rt = bool(trainer_cfg.get("enable_rt", False))
renderer = trainer_cfg.get("renderer", "legacy")
gpu_id = int(trainer_cfg.get("gpu_id", 0))
num_envs = trainer_cfg.get("num_envs", None)
wandb_project_name = trainer_cfg.get("wandb_project_name", "embodichain-generic")
Expand Down Expand Up @@ -158,11 +159,11 @@ def train_from_config(config_path: str):
else:
gym_env_cfg.sim_cfg.sim_device = torch.device("cpu")
gym_env_cfg.sim_cfg.headless = headless
gym_env_cfg.sim_cfg.enable_rt = enable_rt
gym_env_cfg.sim_cfg.render_cfg = RenderCfg(renderer=renderer)
gym_env_cfg.sim_cfg.gpu_id = gpu_id

logger.log_info(
f"Loaded gym_config from {gym_config_path} (env_id={gym_config_data['id']}, num_envs={gym_env_cfg.num_envs}, headless={gym_env_cfg.sim_cfg.headless}, enable_rt={gym_env_cfg.sim_cfg.enable_rt}, sim_device={gym_env_cfg.sim_cfg.sim_device})"
f"Loaded gym_config from {gym_config_path} (env_id={gym_config_data['id']}, num_envs={gym_env_cfg.num_envs}, headless={gym_env_cfg.sim_cfg.headless}, renderer={gym_env_cfg.sim_cfg.render_cfg.renderer}, sim_device={gym_env_cfg.sim_cfg.sim_device})"
)

env = build_env(gym_config_data["id"], base_env_cfg=gym_env_cfg)
Expand Down
1 change: 0 additions & 1 deletion embodichain/data/assets/eef_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
EMBODICHAIN_DEFAULT_DATA_ROOT,
)


eef_assets = "eef_assets"


Expand Down
1 change: 0 additions & 1 deletion embodichain/data/assets/materials.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
EMBODICHAIN_DEFAULT_DATA_ROOT,
)


material_assets = "materials"


Expand Down
1 change: 0 additions & 1 deletion embodichain/data/assets/obj_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
EMBODICHAIN_DEFAULT_DATA_ROOT,
)


obj_assets = "obj_assets"


Expand Down
1 change: 0 additions & 1 deletion embodichain/data/assets/robot_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
EMBODICHAIN_DEFAULT_DATA_ROOT,
)


robot_assets = "robot_assets"


Expand Down
1 change: 0 additions & 1 deletion embodichain/data/assets/scene_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
EMBODICHAIN_DEFAULT_DATA_ROOT,
)


scene_assets = "scene_assets"


Expand Down
Loading
Loading