ai2thor icon indicating copy to clipboard operation
ai2thor copied to clipboard

Bug with AutoSim and DropHeldObject

Open d-val opened this issue 3 years ago • 2 comments

Hey @mattdeitke, thanks for the quick turn-around. New issue since I don't have the privileges to re-open https://github.com/allenai/ai2thor/issues/861

Unless I am missing something, I don't think this fixes the problem.. As you can see in this colab, this will not work because as soon as the object is dropped using "DropHeldObject", isSceneAtRest becomes True. And so stepping does not work (also I tried getting individual frames and it does not work..)

d-val avatar Aug 27 '21 16:08 d-val

Ah, yes. I should have mentioned I changed the loop from a while loop to a do-while loop. This is because, as you found, on the first frame after calling DropHeldObject with physics paused, the object has not yet moved and the scene is technically at rest. But, once AdvancePhysicsStep is called for the first time, isSceneAtRest becomes False until the dropped object falls into rest.

Try replacing:

# this will not work because as soon as the object is dropped using "DropHeldObject", isSceneAtRest becomes True

while not controller.last_event.metadata["isSceneAtRest"]:
    controller.step(
        action="AdvancePhysicsStep",
        timeStep=0.01
    )

with:

# scene doesn't start off at rest
def autosim():
    event = controller.step(
        action="AdvancePhysicsStep",
        timeStep=0.01
    )


autosim()
while not controller.last_event.metadata["isSceneAtRest"]:
    autosim()

mattdeitke avatar Aug 27 '21 17:08 mattdeitke

additionally, the commit fixing this issue (ad1c45a) is not part of the live release yet, but will be included in the next version update.

winthos avatar Aug 27 '21 23:08 winthos