You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you set snapToGrid to False, GetReachablePositions may or may not return positions that are directly on the grid points. Here's an example:
fromai2thor.controllerimportController# Spawn in FloorPlan1 with snapToGrid disabledcontroller=Controller(snapToGrid=False)
# reachable floor XZ coordinates are multiples of .25, the default gridSize parameterevent=controller.step("GetReachablePositions")
print(event.metadata["actionReturn"])
# Walk to the left and around the kitchen islandcontroller.step("RotateLeft")
foriinrange(12):
controller.step("MoveAhead")
controller.step("RotateLeft")
foriinrange(11):
controller.step("MoveAhead")
# reachable floor XZ coordinates are no longer multiples of .25!event=controller.step("GetReachablePositions")
print(event.metadata["actionReturn"])
Notice that the first reachable positions printed have the XZ coordinates rounded to .25 (the gridSize), and the second ones do not. The extra digits always seem to occur at the 7th decimal point, which is around where 32-bit precision lies, so it makes me wonder a 32-bit float is being used where a 64-bit one should be on the unity side somewhere.
This was an issue for us because we were doing exact matching over the coordinate values while looking for a path through the scene. There's a method in Controller.py called key_for_point (also used for path finding of some sort), and it seems to account for this discrepancy by always rounding to 3 decimal places (although, of course, if gridSize is very small this will not work). For now I'm using the same workaround.
The text was updated successfully, but these errors were encountered:
If you set
snapToGrid
toFalse
,GetReachablePositions
may or may not return positions that are directly on the grid points. Here's an example:The output will look like this:
Notice that the first reachable positions printed have the XZ coordinates rounded to .25 (the
gridSize
), and the second ones do not. The extra digits always seem to occur at the 7th decimal point, which is around where 32-bit precision lies, so it makes me wonder a 32-bit float is being used where a 64-bit one should be on the unity side somewhere.This was an issue for us because we were doing exact matching over the coordinate values while looking for a path through the scene. There's a method in
Controller.py
calledkey_for_point
(also used for path finding of some sort), and it seems to account for this discrepancy by always rounding to 3 decimal places (although, of course, if gridSize is very small this will not work). For now I'm using the same workaround.The text was updated successfully, but these errors were encountered: