AI2-THOR 2.2.0 Release

January, 2020

AI2-THOR 2.2.0 Overview

In version 2.2.0 of AI2-THOR, we primarily focused on usability fixes when using a Controller. In particular, we have simplified how users initialize a controller and added support for a context manager.

Merging start, reset, and initialize

In previous versions of AI2-THOR, users had to initialize a Controller with the following code:

from ai2thor.controller import Controller

controller = Controller()
controller.start(<height, width>)
controller.reset(<scene>)
controller.step(action='Initialize', gridSize=0.25)

We have simplified the initialization of a Controller a great deal, where the above code can now be written as:

from ai2thor.controller import Controller

controller = Controller(<height, width, scene, gridSize, other_kwargs>)

We still support the former way to instantiate a Controller, although it is not recommended.

Changing scenes

Previously, to change scenes in AI2-THOR, one would have to call reset and step(action='Initialize', <kwargs>) each time a scene was changed:

controller.reset('FloorPlan27')
controller.step(action='Initialize', <kwargs>)

controller.reset('FloorPlan28')
controller.step(action='Initialize', <kwargs>)

controller.reset('FloorPlan29')
controller.step(action='Initialize', <kwargs>)

Not calling step(action='Initialize', <kwargs>) might have resulted in unexpected bugs. Internally, we now store the <kwargs> passed in, when initializing a Controller(<kwargs>), and combine the reset and step(action='Initialize', <kwargs>) commands. For instance, the previous example can now be written as:

controller.reset('FloorPlan27')
controller.reset('FloorPlan28')
controller.reset('FloorPlan29')

We still support the former way to change a scene, although it is not recommended and might take longer.

Context Manager

Initializing a Controller can now be done using a context manager. The following code chunk displays an example of how to initialize a Controller with a context manager:

from ai2thor.controller import Controller

with Controller() as c:
  for _ in range(20):
    c.step(action='MoveAhead')

Of course, we still support the previous method to initialize a Controller, where the code above could be rewritten as

from ai2thor.controller import Controller

c = Controller()
for _ in range(20):
  c.step(action='MoveAhead')
c.stop()