Skip to content

Commit

Permalink
Merge branch 'fixing_videos' of https://github.com/Learning-and-Intel…
Browse files Browse the repository at this point in the history
  • Loading branch information
wmcclinton committed Nov 2, 2023
2 parents 70f7f8b + 3e0e9dc commit 745d024
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
11 changes: 11 additions & 0 deletions behavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,18 @@ python predicators/main.py --env behavior --approach oracle --option_model_name
* Be sure to set `--plan_only_eval True`: this is necessary to account for the fact that the iGibson simulator is non-deterministic when saving and loading states (which is currently an unresolved bug).
* Example command: `python predicators/main.py --env behavior --approach oracle --option_model_name oracle_behavior --num_train_tasks 0 --num_test_tasks 1 --behavior_train_scene_name Pomaria_2_int --behavior_test_scene_name Pomaria_2_int --behavior_task_list "[opening_packages]" --seed 1000 --offline_data_planning_timeout 500.0 --timeout 500.0 --behavior_option_model_eval True --plan_only_eval True`.
## Creating and Saving Video
The codebase is also equipped with functionality to create and save videos of robot execution. For most videos, you'll want to do actual motion planning for navigation, but teleport the hands for grasping/placing (you can do actual motion planning for these as well, but it tends to get rather slow).
Here is an example command that creates and saves video:
```
python predicators/main.py --env behavior --approach oracle --option_model_name oracle_behavior --num_train_tasks 0 --num_test_tasks 1 --behavior_train_scene_name Pomaria_2_int --behavior_test_scene_name Pomaria_2_int --behavior_task_list "[collecting_aluminum_cans]" --seed 456 --offline_data_planning_timeout 500.0 --timeout 500.0 --behavior_option_model_eval True --plan_only_eval True --behavior_mode iggui --behavior_save_video True --sesame_task_planner fdopt --simulate_nav True --behavior_option_model_rrt True
```
## Troubleshooting
### Common Error Messages
- `invalid render device choice 0 < 0`. This means there is a CUDA driver-related mismatch. If this wasn't happening before and starts happening suddenly, then just run `sudo reboot` to reboot your machine and it should go away.
### Visualizing what the robot is doing
If a lot of plans are failing in refinement, then visualization can be an extremely powerful debugging tool (e.g. it's often the case that samplers are simply struggling to find good samples to accomplish a particular action). Unfortunately, due to OpenGL version issues on MIT SuperCloud, visualization cannot be done on SuperCloud itself and requires a local installation. Moreover, some minor file editing is required:
1. Open the `igibson/render/mesh_renderer/shaders/450/optimized_vert.shader` within the `iGibson` repo (remember, this should be the LIS fork of iGibson!).
Expand Down
2 changes: 1 addition & 1 deletion predicators/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,7 @@ def all_ground_nsrts_fd_translator(
prob_str = create_pddl_problem(objects, init_atoms, goal, "mydomain",
"myproblem")
with nostdout():
sas_task = downward_translate(dom_str, prob_str)
sas_task = downward_translate(dom_str, prob_str) # type: ignore
for operator in sas_task.operators:
split_name = operator.name[1:-1].split() # strip out ( and )
nsrt = nsrt_name_to_nsrt[split_name[0]]
Expand Down
7 changes: 4 additions & 3 deletions scripts/cluster_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import subprocess
from dataclasses import dataclass
from typing import Any, Dict, Iterator, List, Tuple
from typing import Any, Dict, Iterator, List, Optional, Tuple

import yaml

Expand Down Expand Up @@ -140,8 +140,9 @@ def run_cmds_on_machine(
cmds: List[str],
user: str,
machine: str,
ssh_key: str = None,
allowed_return_codes: Tuple[int, ...] = (0, )) -> None:
ssh_key: Optional[str] = None,
allowed_return_codes: Tuple[int, ...] = (0, )
) -> None:
"""SSH into the machine, run the commands, then exit."""
host = f"{user}@{machine}"
ssh_cmd = f"ssh -tt -o StrictHostKeyChecking=no {host}"
Expand Down
6 changes: 3 additions & 3 deletions scripts/configs/behavior_pick_place_evaluation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ FLAGS: # general flags
behavior_override_learned_samplers: True
behavior_ignore_discover_failures: True
num_train_tasks: 10
num_test_tasks: 0
START_SEED: 463
NUM_SEEDS: 2
num_test_tasks: 10
START_SEED: 456
NUM_SEEDS: 10
USE_GPU: False
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
version="0.1.0",
packages=find_packages(include=["predicators", "predicators.*"]),
install_requires=[
"mypy",
"numpy>=1.22.3",
"pytest",
"gym==0.26.2",
"matplotlib",
"imageio",
"imageio-ffmpeg",
"pandas",
"torch",
"torch==2.0.1",
"scipy",
"tabulate",
"dill",
Expand Down Expand Up @@ -44,7 +45,5 @@
"yapf==0.32.0",
"docformatter==1.4",
"isort==5.10.1",
"mypy@git+https://github.com/python/mypy.git@9bd651758e8ea2494" +
"837814092af70f8d9e6f7a1",
]
})
2 changes: 1 addition & 1 deletion tests/envs/test_base_env.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Test cases for the base environment class."""

import pytest
from test_oracle_approach import ENV_NAME_AND_CLS
from test_oracle_approach import ENV_NAME_AND_CLS # type: ignore

from predicators import utils
from predicators.envs import BaseEnv, create_new_env, get_or_create_env
Expand Down

0 comments on commit 745d024

Please sign in to comment.