In the process of navigation, unmanned ships can avoid obstacles through path planning. Because obstacles of different sizes have different effects on the navigation safety of unmanned ships. This paper presents an improved a * algorithm, which can navigate to different degrees according to the area of obstacles, which is reflected in the distance between the unmanned ship and obstacles. At the same time, on the premise of ensuring security, the path nodes planned by the improved algorithm are optimized to obtain a more efficient path. In addition, for dynamic obstacles, this paper proposes to dynamically adjust the speed of unmanned ships to avoid collision. Finally, the simulation results show that compared with the traditional a * algorithm, the improved algorithm reduces the algorithm time by 64.32% at the cost of only increasing the path length by 6%, and improves the safety, reflecting the advantages of the planning strategy proposed in this paper.