I understand that you want to use A* algorithm for finding the shortest path, you can use ‘plannerAStarGrid’, it creates an A* path planner. The planner performs an A* search on an occupancy map and finds shortest obstacle-free path between the specified start and goal grid locations as determined by heuristic cost.
For more information, you can refer to the documentation link below –