allenai / allenai/ai2thor

Several InitialRandomSpawn/Remove Object issues

未关闭
#773 22 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
C#
星标
1.8k
派生
297
PR 合并指标
30 天内没有已合并 PR

描述

When I run the following 3 times, on ai2thor==3.0.0:

```python
import copy
import os
from ai2thor.controller import Controller

controller = Controller(scene="FloorPlan1", gridSize=0.1, width=84, height=84)
included_receptacles = "CounterTop"
included_objects = ["Knife"]

# Remove objects from the scene except for the ones we're looking for
event = controller.step("Pass")
scene_objects = copy.deepcopy(event.metadata["objects"]) # Make sure we're not refetching the list as we remove objs
for obj in scene_objects:
if obj["objectType"] not in included_objects and obj["pickupable"]:
event = controller.step('RemoveFromScene', objectId=obj["objectId"])

if not event.metadata["lastActionSuccess"]:
print(f"Removing {obj['objectType']} failed with {event.metadata['errorMessage']}")

# Check objects before randomization
event = controller.step("Pass")
pickupable_objects = [obj for obj in event.metadata['objects'] if obj["pickupable"]]
print(f"Before random, objs: {[obj['objectType'] for obj in pickupable_objects]}")

# Randomize the environment, only spawning into the desired receptacles
event = controller.step("Pass")
receptacle_types = {obj["objectType"] for obj in event.metadata['objects'] if obj["receptacle"]}
excluded_receptacles = receptacle_types - set(included_receptacles)
seed = int.from_bytes(os.urandom(4), byteorder="little")
print(f"Seeding with {seed}")
event = controller.step("InitialRandomSpawn", excludedReceptacles=list(excluded_receptacles), seed=seed)

# Check where objects are in the room
pickupable_objects = [obj for obj in event.metadata['objects'] if obj["pickupable"]]
print(f"After random, Objs: {[obj['objectId'] for obj in pickupable_objects]}")

# Check where objects are placed
parent_receptacles = [obj['parentReceptacles'] for obj in event.metadata['objects'] if obj['objectType'] in included_objects]
print(f"Parents: {parent_receptacles}")
```

I get:
```
Removing PaperTowelRoll failed with PaperTowelRoll|-02.06|+01.01|-00.82 could not be found in this scene, so it can't be removed
Removing Statue failed with Statue|+01.96|+00.17|-02.54 could not be found in this scene, so it can't be removed
Before random, objs: ['Knife', 'PaperTowelRoll', 'Statue']
Seeding with 3137338953
After random, Objs: ['Knife|-01.68|+00.79|-00.24', 'PaperTowelRoll|-02.06|+01.01|-00.81', 'Statue|+01.95|+00.18|-02.54']
Parents: [['Drawer|-01.56|+00.84|-00.20']]

Removing PaperTowelRoll failed with PaperTowelRoll|-02.06|+01.01|-00.82 could not be found in this scene, so it can't be removed
Removing Statue failed with Statue|+01.96|+00.17|-02.54 could not be found in this scene, so it can't be removed
Before random, objs: ['Knife', 'PaperTowelRoll', 'Statue']
Seeding with 580241517
After random, Objs: ['Knife|-01.68|+00.79|-00.24', 'PaperTowelRoll|-02.06|+01.01|-00.81', 'Statue|+01.95|+00.18|-02.54']
Parents: [['Drawer|-01.56|+00.84|-00.20']]

Removing PaperTowelRoll failed with PaperTowelRoll|-02.06|+01.01|-00.82 could not be found in this scene, so it can't be removed
Removing Statue failed with Statue|+01.96|+00.17|-02.54 could not be found in this scene, so it can't be removed
Before random, objs: ['Knife', 'PaperTowelRoll', 'Statue']
Seeding with 1040437699
After random, Objs: ['Knife|-01.68|+00.79|-00.24', 'PaperTowelRoll|-02.06|+01.01|-00.81', 'Statue|+01.95|+00.18|-02.54']
Parents: [['Drawer|-01.56|+00.84|-00.20']]
```

The following are the issues I see:
1. Why are some objects that I just fetched from the scene "not found in the scene" to be removed? (The objects do not appear twice in the scene_objects list.) Sometimes "Egg" is also not able to be removed, though not in the 3 runs shown.
2. Even though I'm seeding with different numbers, the locations of the pickupable objects are always the same after RandomInitialSpawn.
3. I'm specifying that only CounterTop should be an allowed receptacle, but nevertheless the knife is spawning in the Drawer. (Drawer does indeed appear in "excluded_receptacles.") The CounterTops are definitely not all full.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。