allenai / ai2thor

An open-source platform for Visual AI.
http://ai2thor.allenai.org
Apache License 2.0
1.17k stars 217 forks source link

Agents are easy to get stuck in narrow places #432

Open yang9004-sudoer opened 4 years ago

yang9004-sudoer commented 4 years ago

Agents are easy to get stuck in narrow places.

For example, when I manually control the agent to explore the room "FloorPlan28" with girdsize=0.25 rotateleft rotateright with degree=15.0, it is very easy for agents to stuck in some strange narrow places (usually in some corner). When it stuck, the error message (event.metadata) keeps showing "wall_panel_32_5 (17) is blocking Agent 0 from moving 0" . My question is, if the robot can walk into a narrow space, shouldn't it be able to get out of the place smoothly?

Thank you for your attention!

winthos commented 4 years ago

Could you provide a bit more information to help debug this issue? FloorPlan28 does not contain any of the "wall_panel" objects, so that is very strange. Could you please give an example of the syntax you are using to run the episode as well as what version of THOR you are using.

winthos commented 4 years ago

Thank you for the screenshot but that does not help to debug your issue.

Could you please provide: -snippets of your code to see how you are initializing the scene as well as the exact actions your agent performs in order to get stuck. This will allow us to attempt to replicate the issue on our end. -the exact version of THOR you are using (different versions might have different capabilities)

yang9004-sudoer commented 4 years ago

Sorry for the last incomplete post due to the unstable network After many trails, I rewrite the sample code as following, which can precisely reproduce the stuck problem I said Just run the code, you can find the agent is stuck by the baseborad

errorMessage: Baseboard.018 is blocking Agent 0 from moving 0

ai2thor version = 2.4.6

from ai2thor.controller import Controller def run():

controller = Controller(scene='FloorPlan29', gridSize=0.15, width=300, height=300)

for i in range(15):
    event = controller.step(action="MoveAhead")

for i in range(9):
    event = controller.step(action="RotateRight", degrees=15.0)

# in the step agent already stuck
for i in range(10):
    event = controller.step(action="MoveAhead")

# now try to escape from stuck by rotateleft action
for i in range(5):
    event = controller.step(action="RotateLeft", degrees=15.0)
    print(event.metadata['errorMessage'])

# but fail
for i in range(10):
    event = controller.step(action="MoveAhead")
    print(event.metadata['errorMessage'])

# let's try again
for i in range(5):
    event = controller.step(action="RotateLeft", degrees=15.0)
    print(event.metadata['errorMessage'])

# fail .... 
for i in range(10):
    event = controller.step(action="MoveAhead")
    print(event.metadata['errorMessage'])
    # errormessage shows blocking
pass

run()

looking for your reply! The ithor platform is very awesome!

yang9004-sudoer commented 4 years ago

Hi! winthos,

I have solved the problem by adding the snaptoGrid=False to Controller init. However, I also find that the grid design can still trigger similar problem: when the agent drop an object (e.g., drop a cup with lookdown degree=15.0 or 30.0), and the fallen object may stuck the agent. I began to wonder whether it was the object collision judgment problem: the space occupied by the object conflicts with the agent. looking for your reply!

winthos commented 4 years ago

This issue with the agent dropping a held object while looking down is not linked to the grid. The agent's collision is represented as a capsule, and when looking down at more extreme angles, held object will clip inside this capsule. Normally, there is a check that makes it so an object cannot be dropped if it is clipping in the agent. If you pass in forceAction=True this check is ignored, allowing objects to be dropped no matter what. However, when an object is dropped inside the agent's collider it will cause this behavior you are seeing where the object gets stuck or gets shoved out of the agent collision.