allenai / allenai/ai2thor

controller.last_event.object_id_to_color not updated after 'SetObjectPoses' or 'InitialRandomSpawn'

Ouverte
#872 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C#
Étoiles
1.8k
Forks
296
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

The object_id_to_color dict isn't updated after calling 'SetObjectPoses' or 'InitialRandomSpawn' as you can see in the code snippet below:

```
import ai2thor.controller
import numpy as np

ENV_ARGS = dict(
agentMode="arm",
scene="FloorPlan1_physics",
visibilityDistance=1.5,
gridSize=0.1,
renderDepthImage=True,
renderInstanceSegmentation=True,
width=500,
height=500,
fieldOfView=100,
agentControllerType="mid-level",
server_class=ai2thor.fifo_server.FifoServer,
useMassThreshold=True,
massThreshold=10,
autoSimulation=True,
autoSyncTransforms=True,
)

controller = ai2thor.controller.Controller(**ENV_ARGS)

controller.reset(ENV_ARGS["scene"])

for object in controller.last_event.metadata["objects"]:
if "Mug_77db6e4d" in object["name"]:
object_id_init = object["objectId"]

controller.step(action="InitialRandomSpawn",
randomSeed=0,
forceVisible=True,
numPlacementAttempts=5,
placeStationary=True,
numDuplicatesOfType=[{"objectType": "Mug", "count": 3}],
excludedReceptacles=["Cabinet", "Fridge", "GarbageCan", "Microwave", "Sink",
"SinkBasin", "StoveBurner", "Shelf", "CoffeeMachine"],
)

for object in controller.last_event.metadata["objects"]:
if "Mug" in object["name"]:
print(object["name"])
print(object["objectId"])

controller.step(
action='SetObjectPoses',
objectPoses=[
{
"objectName": "Mug_77db6e4d",
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"position": {
"x": -0.4,
"y": 1.1512253284454346,
"z": -0.05
}
}])

for object in controller.last_event.metadata["objects"]:
if "Mug_77db6e4d" in object["name"]:
object_id = object["objectId"]

print("object_id_to_color")
for key in controller.last_event.object_id_to_color.keys():
if "Mug" in key:
print(key)

print("object_id_init", object_id_init)
print("object_id", object_id)
print(controller.last_event.object_id_to_color[object_id_init])
print(controller.last_event.object_id_to_color[object_id])
```

Output:
```
Mug_77db6e4d(Clone)_random_copy_1
Mug|-00.20|+01.11|-00.25
Mug_77db6e4d(Clone)_random_copy_0
Mug|+01.10|+00.91|-02.41
Mug_77db6e4d
Mug|+00.36|+01.11|+00.25
object_id_to_color
Mug|-01.76|+00.90|-00.62
Mug
object_id_init Mug|-01.76|+00.90|-00.62
object_id Mug|-00.40|+01.15|-00.05
(80, 55, 124)
Traceback (most recent call last):
File "/home/markus/.conda/envs/test/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/markus/.conda/envs/test/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/markus/bug_reproduce.py", line 74, in
print(controller.last_event.object_id_to_color[object_id])
KeyError: 'Mug|-00.40|+01.15|-00.05'
```

As you can see from the output, object_id_to_color doesn't contain 'Mug|-00.40|+01.15|-00.05', it only contains the inital objectId from the Mug.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.