ai2thor icon indicating copy to clipboard operation
ai2thor copied to clipboard

GetShortestPath

Open pioneer-innovation opened this issue 3 years ago • 1 comments
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.

pioneer-innovation avatar Aug 11 '22 11:08 pioneer-innovation

Also find this problem.

zhaowei-wang-nlp avatar Apr 17 '24 12:04 zhaowei-wang-nlp