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
14 changes: 11 additions & 3 deletions docs/source/metasim/get_started/advanced_installation/pyroki.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@ PyRoki requires Python 3.10 or higher. Python 3.12+ is recommended for best comp
## Installation

```bash
cd third_part
git clone https://github.com/chungmin99/pyroki.git
cd pyroki
pip install -e .
cd ../../
pip install jax==0.4.30 jaxlib==0.4.30
```
For Isaacsim, also need the following commands:

### For Isaacsim
If you encounter a NumPy version mismatch between lsaacSim 5.0.0 and PyRoki, for example, an error
`TypeError: asarray() got an unexpected keyword argument 'copy'`, try running the following commands:
```bash
pip install numpy==1.26.0 # For Isaacsim
pip install jax==0.6.0 # For Isaacsim
pip install numpy==1.26.0
pip install sentry-sdk==1.43.0 typing-extensions==4.12.2 websockets==12.0
pip install --upgrade websockets
```





Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 4. Motion Planning
In this tutorial, we will show you how to use MetaSim to plan a motion for a robot.
Note here, we use the `curobo` package to plan the motion. If you haven't installed it, please refer to our [curobo installation guide](https://roboverse.wiki/metasim/get_started/advanced_installation/curobo).
Note here, we can use the `pyroki` or `curobo` package to plan the motion. If you haven't installed it, please refer to our [pyroki installation guide](https://roboverse.wiki/metasim/get_started/advanced_installation/pyroki) or [curobo installation guide](https://roboverse.wiki/metasim/get_started/advanced_installation/curobo).

## Common Usage

Expand Down
24 changes: 9 additions & 15 deletions docs/source/metasim/get_started/quick_start/8_replay_demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@ python scripts/advanced/replay_demo.py --sim=isaacsim --task=close_box --num_env
```

task could also be:
- `PickCube`
- `StackCube`
- `CloseBox`
- `BasketballInHoop`
- `pick_cube`
- `stack_cube`
- `close_box`

## States replay

```bash
python scripts/advanced/replay_demo.py --sim=isaacsim --task=close_box --num_envs 4 --object-states
```
task could also be:
- `CloseBox`
- `BasketballInHoop`
- `close_box`

## Varifies commands

Expand All @@ -30,22 +28,18 @@ task could also be:
e.g.

```bash
python scripts/advanced/replay_demo.py --sim=isaacsim --task=LiberoPickButter
python scripts/advanced/replay_demo.py --sim=isaacsim --task=libero.pick_butter
```

Simulator:
- `isaacsim`
- `mujoco`

Task:
- `LiberoPickAlphabetSoup`
- `LiberoPickBbqSauce`
- `LiberoPickChocolatePudding`
- `LiberoPickCreamCheese`
- `LiberoPickMilk`
- `LiberoPickOrangeJuice`
- `LiberoPickSaladDressing`
- `LiberoPickTomatoSauce`
- `libero.kitchen_scene1_open_bottom_drawer`
- `libero.kitchen_scene1_open_top_drawer`
- `libero.kitchen_scene1_put_the_black_bowl_on_the_plate`


### Humanoid

Expand Down
4 changes: 2 additions & 2 deletions metasim/sim/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ def close(self) -> None:
self.physics_handler.close()
self.render_handler.close()

def set_dof_targets(self, obj_name: str, actions: list[Action]) -> None:
def set_dof_targets(self, actions: list[Action]) -> None:
"""Set the dof targets of the robot in the physics handler."""
self.physics_handler.set_dof_targets(obj_name, actions)
self.physics_handler.set_dof_targets(actions)

def _set_states(self, states: TensorState, env_ids: list[int] | None = None) -> None:
"""Set states in both physics and render handlers."""
Expand Down
6 changes: 5 additions & 1 deletion roboverse_learn/il/dp/models/ddpm_image_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ def conditional_sample(
# Set diffusion steps.
scheduler.set_timesteps(self.num_inference_steps)

# Ensure timesteps are on the same device as trajectory
device = trajectory.device
scheduler.timesteps = scheduler.timesteps.to(device=device)

step_kwargs = dict(self.scheduler_step_kwargs)
step_kwargs.update(kwargs)

Expand All @@ -109,7 +113,7 @@ def conditional_sample(
trajectory[condition_mask] = condition_data[condition_mask]

# 2. Predict model output.
t = t.to(device=trajectory.device)
# t = t.to(device=trajectory.device)
model_output = model(trajectory, t, local_cond=local_cond, global_cond=global_cond)

# 3. Compute previous sample x_t -> x_{t-1}.
Expand Down
2 changes: 1 addition & 1 deletion roboverse_learn/il/dp/runner/dp_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def evaluate(self, ckpt_path=None):
time_str = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
checkpoint = self.get_checkpoint_path()
# checkpoint = ckpt_path if checkpoint is None else checkpoint
checkpoint = ckpt_path if ckpt_path is None else checkpoint
checkpoint = ckpt_path if ckpt_path is not None else checkpoint
if checkpoint is None:
raise ValueError(
"No checkpoint found, please provide a valid checkpoint path."
Expand Down
38 changes: 22 additions & 16 deletions scripts/advanced/collect_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,20 +700,22 @@ def main():
task_cls = get_task_class(args.task)

if args.task in {"stack_cube", "pick_cube", "pick_butter"}:
dp_camera = True
dp_pos = (1.0, 0.0, 0.75)
elif args.task in {"close_box"}:
dp_pos = (0, 0, 0)
else:
dp_camera = args.task != "close_box"
dp_pos = (1.0, 0.0, 0.75)

is_libero_dataset = "libero_90" in args.task
# is_libero_dataset = "libero_90" in args.task

if is_libero_dataset:
dp_pos = (2.0, 0.0, 2)
elif dp_camera:
# import warnings
# warnings.warn("Using dp camera position!")
dp_pos = (1.0, 0.0, 0.75)
else:
dp_pos = (1.5, 0.0, 1.5)
# if is_libero_dataset:
# dp_pos = (2.0, 0.0, 2)
# elif dp_camera:
# # import warnings
# # warnings.warn("Using dp camera position!")
# dp_pos = (1.0, 0.0, 0.75)
# else:
# dp_pos = (1.5, 0.0, 1.5)

# libero specific camera position
# dp_pos = (0.8, -0, 1.6)
Expand Down Expand Up @@ -771,7 +773,7 @@ def main():
## Setup
# Get task description from environment
task_desc = getattr(env, "task_desc", "")
collector = DemoCollector(env.handler, robot, task_desc)
collector = DemoCollector(env.handler, robot, task_desc, demo_start_idx=args.demo_start_idx)
# pbar = tqdm(total=max_demo - args.demo_start_idx, desc="Collecting demos")
pbar = tqdm(total=args.num_demo_success, desc="Collecting successful demos")

Expand Down Expand Up @@ -830,13 +832,17 @@ def main():
stop_flag = False

while not all(finished):
if stop_flag:
pass

if tot_success >= args.num_demo_success:
log.info(f"Reached target number of successful demos ({args.num_demo_success}). Stopping collection.")
break
log.info(f"Reached target number of successful demos ({args.num_demo_success}).")
stop_flag = True

if demo_indexer.next_idx >= max_demo:
log.warning(f"Reached maximum demo index ({max_demo}). Stopping collection.")
break
if not stop_flag:
log.warning(f"Reached maximum demo index ({max_demo}), finishing in-flight demos.")
stop_flag = True

pbar.set_description(f"Frame {global_step} Success {tot_success} Giveup {tot_give_up}")
actions = get_actions(all_actions, env, demo_idxs, robot)
Expand Down
2 changes: 1 addition & 1 deletion scripts/advanced/replay_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def main():
obs = env.handler.get_states()

## XXX: hack
success = env.checker.check(env.handler)
success = env.checker.check(env.handler, obs)
if success.any():
log.info(f"Env {success.nonzero().squeeze(-1).tolist()} succeeded!")
if success.all():
Expand Down