Skip to content
Open
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: check-yaml
- id: check-toml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.5
rev: v0.16.9
hooks:
- id: ruff
args: [ --fix ]
Expand Down
4 changes: 2 additions & 2 deletions docs/source/FAQ/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ from metasim.sim.sapien_handler import SapienHandler
from metasim.sim.isaacsim_handler import IsaacSimHandler

# Same scenario works with any simulator
handler = MujocoHandler(scenario) # or
handler = SapienHandler(scenario) # or
handler = MujocoHandler(scenario) # or
handler = SapienHandler(scenario) # or
handler = IsaacSimHandler(scenario)
```

Expand Down
12 changes: 2 additions & 10 deletions docs/source/dataset_benchmark/benchmark/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,8 @@ class RandomizationCfg:
Without the need for knowing the details of randomized evaluation, you can simply define the level of randomization with numbers 0-3, and use the randomization config inside of a scenario config:

```python
randomization = RandomizationCfg(
camera=False, light=False, ground=False, reflection=False
)
scenario = ScenarioCfg(
task=task,
robot=robot,
cameras=[camera],
randomization=randomization,
try_add_table=True
)
randomization = RandomizationCfg(camera=False, light=False, ground=False, reflection=False)
scenario = ScenarioCfg(task=task, robot=robot, cameras=[camera], randomization=randomization, try_add_table=True)
```

And the instantiated environment will be automatically randomized!
2 changes: 1 addition & 1 deletion docs/source/dataset_benchmark/dataset/multiagent.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ demos; each demo carries `init_state`, `actions`, and optional `states`:

```python
{
"franka_left": [{"init_state": {...}, "actions": [...], "states": None}, ...],
"franka_left": [{"init_state": {...}, "actions": [...], "states": None}, ...],
"franka_right": [{"init_state": {...}, "actions": [...], "states": None}, ...],
"metadata": {"num_agents": 2, "agents": ["franka_left", "franka_right"]},
}
Expand Down
10 changes: 5 additions & 5 deletions docs/source/dataset_benchmark/integrations/libero.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ user-set value or the base `~/.libero`). No manual config editing needed.
## Usage

```python
import roboverse_pack.tasks.libero # auto-registers Libero/<suite>__<task>
import roboverse_pack.tasks.libero_plus # auto-registers LiberoPlus/<suite>__<task>
import roboverse_pack.tasks.libero # auto-registers Libero/<suite>__<task>
import roboverse_pack.tasks.libero_plus # auto-registers LiberoPlus/<suite>__<task>
from roboverse_pack.tasks.libero_plus import make_liberoplus_env

# build any of the 10,120 perturbation tasks by (suite, task index)
env = make_liberoplus_env("libero_object", 7, seed=0)
obs, reward, done, info = env.step([0.0] * 7) # native legacy-gym 4-tuple (kept for fidelity)
obs, reward, done, info = env.step([0.0] * 7) # native legacy-gym 4-tuple (kept for fidelity)
```

## Native MetaSim tasks — run (and delete) LIBERO
Expand All @@ -93,9 +93,9 @@ other RoboVerse task and run with `libero`/`robosuite` uninstalled:
from metasim.task.registry import get_task_class

Task = get_task_class("libero_native.10__KITCHEN_SCENE3_turn_on_the_stove_and_put_the_moka_pot_on_it")
env = Task() # loads the vendored scene; no libero
env = Task() # loads the vendored scene; no libero
obs, info = env.reset()
obs, reward, terminated, time_out, info = env.step(action) # 7-D OSC delta + gripper
obs, reward, terminated, time_out, info = env.step(action) # 7-D OSC delta + gripper
```

Each task is a first-class `BaseTaskEnv` (`NativeLiberoEnv`); a static bundle under
Expand Down
16 changes: 9 additions & 7 deletions docs/source/dataset_benchmark/integrations/mjlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ paths:

```python
ScenarioCfg(
robots=[RobotCfg(
name="g1",
num_joints=29,
fix_base_link=False,
mjcf_path=mjlab_asset("asset_zoo/robots/unitree_g1/xmls/g1.xml"),
enabled_self_collisions=False,
)],
robots=[
RobotCfg(
name="g1",
num_joints=29,
fix_base_link=False,
mjcf_path=mjlab_asset("asset_zoo/robots/unitree_g1/xmls/g1.xml"),
enabled_self_collisions=False,
)
],
simulator="mujoco",
add_default_ground=False, # raw rollout doesn't add a ground either
)
Expand Down
5 changes: 4 additions & 1 deletion docs/source/dataset_benchmark/integrations/simpler_env.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,23 @@ rendering works, no sm_120 wall.
## Usage

```python
import roboverse_pack.tasks.simpler_env # auto-registers SimplerEnv/<task> + simpler.<task>
import roboverse_pack.tasks.simpler_env # auto-registers SimplerEnv/<task> + simpler.<task>

# (1) MetaSim-native via gym
import gymnasium as gym

env = gym.make("SimplerEnv/google_robot_pick_coke_can")
obs, info = env.reset(seed=0)
obs, reward, terminated, truncated, info = env.step(env.action_space.sample())

# (2) MetaSim-native via the MetaSim task registry
from metasim.task.registry import get_task_class

task = get_task_class("simpler.widowx_stack_cube")()

# (3) optional upstream passthrough (requires the SimplerEnv clone)
from roboverse_pack.tasks.simpler_env import register_simpler_env_passthrough

register_simpler_env_passthrough(prefix="SimplerEnvPassthrough/")
env = gym.make("SimplerEnvPassthrough/google_robot_pick_coke_can")
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ from roboverse_learn.base.base_runner import BaseRunner
abs_config_path = str(pathlib.Path(__file__).resolve().parent.joinpath("configs").absolute())
OmegaConf.register_new_resolver("eval", eval, replace=True)


@hydra.main(config_path=abs_config_path, version_base=None)
def main(cfg):
OmegaConf.resolve(cfg)
Expand All @@ -145,6 +146,7 @@ def main(cfg):
runner: BaseRunner = cls(cfg)
runner.run()


if __name__ == "__main__":
main()
```
Expand Down
46 changes: 20 additions & 26 deletions docs/source/roboverse_learn/reinforcement_learning/fast_td3.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,39 @@ The script uses a `CONFIG` dictionary for all parameters. Key options include:
```python
CONFIG = {
# Environment
"sim": "mjx", # Simulator backend
"robots": ["h1"], # Robot type
"task": "humanoid.run", # Task name
"num_envs": 1024, # Number of parallel environments
"decimation": 10, # Control decimation

"sim": "mjx", # Simulator backend
"robots": ["h1"], # Robot type
"task": "humanoid.run", # Task name
"num_envs": 1024, # Number of parallel environments
"decimation": 10, # Control decimation
# Training
"total_timesteps": 1500, # Total training steps
"batch_size": 32768, # Batch size for updates
"buffer_size": 20480, # Replay buffer size

"total_timesteps": 1500, # Total training steps
"batch_size": 32768, # Batch size for updates
"buffer_size": 20480, # Replay buffer size
# Algorithm
"gamma": 0.99, # Discount factor
"tau": 0.1, # Target network update rate
"policy_frequency": 2, # Policy update frequency
"num_updates": 12, # Updates per step

"gamma": 0.99, # Discount factor
"tau": 0.1, # Target network update rate
"policy_frequency": 2, # Policy update frequency
"num_updates": 12, # Updates per step
# Networks
"critic_learning_rate": 0.0003,
"actor_learning_rate": 0.0003,
"critic_hidden_dim": 1024,
"actor_hidden_dim": 512,

# Distributional Q-learning
"num_atoms": 101,
"v_min": -250.0,
"v_max": 250.0,

# Optimizations
"use_cdq": True, # Clipped Double Q-learning
"compile": True, # PyTorch compilation
"obs_normalization": True, # Observation normalization
"amp": True, # Automatic mixed precision
"amp_dtype": "fp16", # Precision type

"use_cdq": True, # Clipped Double Q-learning
"compile": True, # PyTorch compilation
"obs_normalization": True, # Observation normalization
"amp": True, # Automatic mixed precision
"amp_dtype": "fp16", # Precision type
# Logging
"use_wandb": False, # Weights & Biases integration
"eval_interval": 700, # Evaluation frequency
"save_interval": 700, # Model saving frequency
"use_wandb": False, # Weights & Biases integration
"eval_interval": 700, # Evaluation frequency
"save_interval": 700, # Model saving frequency
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ ground_cfg = GroundCfg(
dynamic_friction=1.0,
elements={
"slope": [SlopeCfg(origin=[0, 0], size=[2.0, 2.0], slope=0.3)],
"stair": [StairCfg(origin=[5, 0], size=[2.0, 2.0], step_height=0.1)]
}
"stair": [StairCfg(origin=[5, 0], size=[2.0, 2.0], step_height=0.1)],
},
)
```

Expand Down
6 changes: 3 additions & 3 deletions examples/obj_layout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ class PutBananaTask(Task):
name="banana",
usd_path="...",
pos=(0.5, 0.2, 0.15), # ← From saved poses
rot=(0, 0, 0, 1), # ← From saved poses
rot=(0, 0, 0, 1), # ← From saved poses
),
],
robots=[
RobotCfg(
name="franka",
pos=(0.0, 0.0, 0.0), # ← From saved poses
rot=(0, 0, 0, 1), # ← From saved poses
pos=(0.0, 0.0, 0.0), # ← From saved poses
rot=(0, 0, 0, 1), # ← From saved poses
),
],
)
Expand Down
3 changes: 2 additions & 1 deletion examples/rl/fast_td3/fttd3_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ def projection(
next_dist = F.softmax(self.forward(obs, actions), dim=1)
proj_dist = torch.zeros_like(next_dist)
offset = (
torch.linspace(0, (batch_size - 1) * self.num_atoms, batch_size, device=device)
torch
.linspace(0, (batch_size - 1) * self.num_atoms, batch_size, device=device)
.unsqueeze(1)
.expand(batch_size, self.num_atoms)
.long()
Expand Down
4 changes: 2 additions & 2 deletions examples/viser/VISER_USAGE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ visualizer.enable_trajectory_playback()
visualizer.setup_ik_solver(robot_name, robot_config, env_handler)

# Load and set trajectory
visualizer.load_trajectory('trajectory.pkl.gz')
visualizer.set_current_trajectory('franka', 0)
visualizer.load_trajectory("trajectory.pkl.gz")
visualizer.set_current_trajectory("franka", 0)
```

### Custom Scene Setup
Expand Down
21 changes: 9 additions & 12 deletions packages/metasim/docs/source/concept/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ class ScenarioCfg:
# Runtime
render: RenderCfg = RenderCfg()
sim_params: SimParamCfg = SimParamCfg()
simulator: Literal["isaaclab","isaacgym","sapien2","sapien3",
"genesis","pybullet","mujoco"] | None = None
renderer: Literal["isaaclab","isaacgym","sapien2","sapien3",
"genesis","pybullet","mujoco"] | None = None
simulator: Literal["isaaclab", "isaacgym", "sapien2", "sapien3", "genesis", "pybullet", "mujoco"] | None = None
renderer: Literal["isaaclab", "isaacgym", "sapien2", "sapien3", "genesis", "pybullet", "mujoco"] | None = None

# Misc
num_envs: int = 1
Expand Down Expand Up @@ -153,13 +151,12 @@ The class provides mechanisms for asset management and dynamic updates:

```python
RobotCfg(
name="robot_template",
num_joints=2,
urdf_path="roboverse_data/robots/your_robot/urdf/your_robot.urdf",
fix_base_link=True,
enabled_gravity=True,
control_type={"joint1": "position", "joint2": "effort"},
actuators={"joint1": BaseActuatorCfg(stiffness=500, damping=10),
"joint2": BaseActuatorCfg(effort_limit_sim=50)}
name="robot_template",
num_joints=2,
urdf_path="roboverse_data/robots/your_robot/urdf/your_robot.urdf",
fix_base_link=True,
enabled_gravity=True,
control_type={"joint1": "position", "joint2": "effort"},
actuators={"joint1": BaseActuatorCfg(stiffness=500, damping=10), "joint2": BaseActuatorCfg(effort_limit_sim=50)},
)
```
12 changes: 5 additions & 7 deletions packages/metasim/docs/source/concept/get_extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Implement the `_extra_spec` method inside your task definition:
```python
def _extra_spec(self) -> dict:
return {
"imu_pos": SitePos("imu"), # World position of IMU sensor site
"head_vel": BodyVel("head"), # Velocity of the robot's head
"imu_pos": SitePos("imu"), # World position of IMU sensor site
"head_vel": BodyVel("head"), # Velocity of the robot's head
}
```

Expand Down Expand Up @@ -90,10 +90,7 @@ extras = handler.get_extra()
This returns a dictionary containing your custom observations:

```python
{
"imu_pos": tensor([[0.1, 0.2, 0.3], [...]]),
"head_vel": tensor([[0.01, 0.02, 0.03], [...]])
}
{"imu_pos": tensor([[0.1, 0.2, 0.3], [...]]), "head_vel": tensor([[0.01, 0.02, 0.03], [...]])}
```

You can directly use this data for:
Expand Down Expand Up @@ -134,6 +131,7 @@ Example:
from metasim.queries.base import BaseQueryType
import torch


class BodyMassQuery(BaseQueryType):
def bind_handler(self, handler):
# Store the handler for later use
Expand All @@ -158,7 +156,7 @@ After defining your custom query class, simply instantiate and use it directly i
```python
def _extra_spec(self) -> dict:
return {
"body_mass": BodyMassQuery(), # Your custom query
"body_mass": BodyMassQuery(), # Your custom query
"imu_pos": SitePos("imu"),
}
```
Expand Down
Loading
Loading