ai2thor
ai2thor copied to clipboard
GetShortestPath
trafficstars
Hi @mattdeitke I saw the action "GetShortestPath" in allenact and I want to use it in ai2thor. I have set the gridSize=0.25 and snapToGrid=True, but the action return the path ignore the gridSize. Here is part of my code:
controller = Controller(scene="FloorPlan212",
visibilityDistance=1.5,
gridSize=0.25,
snapToGrid=True)
event = controller.step(action="GetReachablePositions")
positions = event.metadata["actionReturn"]
initial_position = random.choice(positions)
event = controller.step(action="GetShortestPath",
objectType='Television',
position=initial_position,
allowedError=0.05)
if event.metadata["lastActionSuccess"]:
shortest_path = event.metadata["actionReturn"]["corners"]
Here is some samples of shortest_path :
{'x': -0.75, 'y': 0.010305345058441162, 'z': 0.0}
{'x': -1.0121546978325568e-07, 'y': 0.010305345058441162, 'z': 5.623087417916395e-08}
{'x': -2.0, 'y': 0.010305345058441162, 'z': -0.5}
{'x': -0.5399999618530273, 'y': 0.010305345058441162, 'z': -0.26999974250793457}
{'x': 0.0, 'y': 0.010305345058441162, 'z': -0.25}
{'x': -3.75, 'y': 0.010305345058441162, 'z': -0.5}
{'x': -0.5399999618530273, 'y': 0.010305345058441162, 'z': -0.26999974250793457}
{'x': 0.0, 'y': 0.010305345058441162, 'z': -0.25}
I am wondering if the action "GetShortestPath" still available in ai2thor. I didn't find any code related to this action.
Also find this problem.