xavierpuigf / virtualhome

API to run VirtualHome, a Multi-Agent Household Simulator
http://virtual-home.org
MIT License
445 stars 66 forks source link

How to execute the programs of the dataset using the simulator? #67

Open ltttpku opened 2 years ago

ltttpku commented 2 years ago

Hi,

I am also trying to use the scripts from the executable_programs to generate my own dataset, using version v1.0.0 of the simulator.

My current setting:

My code used to expand the scene:

comm.reset(graph_id - 1)
with open('init_and_final_graph/{}'.format(graph_file), 'r') as f:
    graphs = json.load(f)
    first_graph = graphs['init_graph']
comm.expand_scene(first_graph)

The expand_scene() function returned:

 (False,
 {'missing_prefabs': ['vacuumcleaner', 'microphone', 'laundrydetergent'],
  'unplaced': ['vacuumcleaner', 'microphone', 'laundrydetergent']})

Notice that the in the program is still unplaced.

Can anyone please advise on how to fix this?

ltttpku commented 2 years ago

I also tried removing the in the program, but it still didn't work.

The new program:

[FIND] <towel> (1.1000)
[FIND] <soap> (1.1002)
[WIPE] <soap> (1.1002)
[GRAB] <soap> (1.1002)
[PUTOBJBACK] <soap> (1.1002)
[FIND] <shampoo> (1.1003)
[GRAB] <shampoo> (1.1003)
[WIPE] <shampoo> (1.1003)
[PUTOBJBACK] <shampoo> (1.1003)
[FIND] <shampoo> (2.1004)
[GRAB] <shampoo> (2.1004)
[WIPE] <shampoo> (2.1004)
[PUTOBJBACK] <shampoo> (2.1004)

Every object here (towel, soap, and shampoo) should be in the graph of the expanded scene.

But when I run render_script(), I got the following error:

<Response [408]>
---------------------------------------------------------------------------
UnityEngineException                      Traceback (most recent call last)
/tmp/ipykernel_60215/3037315194.py in <module>
      7                                       recording=True,
      8                                       save_pose_data=True,
----> 9                                       file_name_prefix='relax')
     10 

~/virtualhome/simulation/unity_simulator/comm_unity.py in render_script(self, script, randomize_execution, random_seed, processing_time_limit, skip_execution, find_solution, output_folder, file_name_prefix, frame_rate, image_synthesis, save_pose_data, image_width, image_height, recording, save_scene_states, camera_mode, time_scale, skip_animation)
    371                   'time_scale': time_scale, 'skip_animation': skip_animation}
    372         response = self.post_command({'id': str(time.time()), 'action': 'render_script',
--> 373                                       'stringParams': [json.dumps(params)] + script})
    374         # print(response)
    375         try:

~/virtualhome/simulation/unity_simulator/comm_unity.py in post_command(self, request_dict, repeat)
     93             if resp.status_code != requests.codes.ok:
     94                 print(resp)
---> 95                 raise UnityEngineException(resp.status_code, resp.json())
     96             return resp.json()
     97         except requests.exceptions.RequestException as e:

UnityEngineException: (408, {'id': '1647007475.7863152', 'success': False, 'message': 'Timeout', 'value': 0, 'message_list': None})
xavierpuigf commented 2 years ago

Will look into this! Some of the object names we had in previous executable are not well mapped in the latest updates. Will follow up on this soon.

ByZ0e commented 1 year ago

@xavierpuigf Have you found the solution yet? I got the same error as @ltttpku .

TianHongZXY commented 1 year ago

I encountered the same issue, is this problem solved?