stepjam / RLBench

A large-scale benchmark and learning environment.
https://sites.google.com/corp/view/rlbench
Other
1.11k stars 226 forks source link

Task PutUmbrellaInUmbrellaStand crashes with BoundaryError #14

Closed adamconkey closed 4 years ago

adamconkey commented 4 years ago

I got the following terminal output when trying the PutUmbrellaInUmbrellaStand task, which instructed me to raise an issue:

Traceback (most recent call last):
  File "/home/adam/venv3/lib/python3.5/site-packages/rlbench/task_environment.py", line 71, in reset
    randomly_place=not self._static_positions)
  File "/home/adam/venv3/lib/python3.5/site-packages/rlbench/backend/scene.py", line 104, in init_episode
    raise e
  File "/home/adam/venv3/lib/python3.5/site-packages/rlbench/backend/scene.py", line 97, in init_episode
    self._place_task()
  File "/home/adam/venv3/lib/python3.5/site-packages/rlbench/backend/scene.py", line 386, in _place_task
    min_rotation=min_rot, max_rotation=max_rot)
  File "/home/adam/venv3/lib/python3.5/site-packages/rlbench/backend/spawn_boundary.py", line 172, in sample
    raise BoundaryError('Could not place within boundary.'
rlbench.backend.exceptions.BoundaryError: Could not place within boundary.Perhaps the object is too big for it?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "collect_rlbench_data.py", line 94, in <module>
    collect_demos(env, [task_class_name], h5_root, args.demos_per_task, len(args.task))
  File "collect_rlbench_data.py", line 37, in collect_demos
    demo = task.get_demos(1, live_demos=True)[0]
  File "/home/adam/venv3/lib/python3.5/site-packages/rlbench/task_environment.py", line 239, in get_demos
    demos = self._get_live_demos(amount)
  File "/home/adam/venv3/lib/python3.5/site-packages/rlbench/task_environment.py", line 248, in _get_live_demos
    self.reset()
  File "/home/adam/venv3/lib/python3.5/site-packages/rlbench/task_environment.py", line 76, in reset
    % self._task.get_name()) from e
rlbench.task_environment.TaskEnvironmentError: Could not place the task put_umbrella_in_umbrella_stand in the scene. This should not happen, please raise an issues on this task.

Here are the snippets from my code that are relevant:

obs_config = ObservationConfig()
obs_config.set_all(True)
action_mode = ActionMode(ArmActionMode.ABS_JOINT_VELOCITY)
env = Environment(action_mode, obs_config=obs_config, headless=args.headless)
env.launch()

task = env.get_task(PutUmbrellaInUmbrellaStand)
demo = task.get_demos(1, live_demos=True)[0]

My system:

stepjam commented 4 years ago

Hi, Thanks for raising. What happens if you run your script a few times? Does it always give this error?

Best, Stephen

adamconkey commented 4 years ago

No it's not every time. The demo = task.get_demos(1, live_demos=True)[0] line is actually in a for loop that tries to get 100 demos in a row (note I only get 1 at a time because I'm rendering a progress bar on the terminal). I can sometimes collect 15-20 demos before I get the error.

I can post my full code if that's helpful but I think I picked out the parts that are RLBench-specific.

adamconkey commented 4 years ago

I just got the same error for OpenBox as well after successfully getting 18 demos.

stepjam commented 4 years ago

Hi Adam, OK, so first let me explain why this is happening. When you get a demo, the task is placed randomly inside the workspace boundary. RLBench does this by sampling. Sometimes you can get unlucky and get bad samples and if it samples too many times, it assume the task has been badly designed. But I know that the 2 tasks you refer to are fine, so I either need to increase the sampling threshold, or I need to adjust the task so it doesn't reach the current threshold. Regardless, for now I suggest wrapping the get_demos call in a try-catch clause. I'll take a look at the tasks after I get back from CoRL.

adamconkey commented 4 years ago

Thanks for your help, Stephen. I will note that I'm running data collection on all 100 tasks and I see this error come up occasionally in many of them. The try/except approach works fine though and it often recovers after one error. I put it in a while-loop to make 10 consecutive attempts just to be robust to consecutive errors.