For unmanned vehicles, accurately locating their own position is a very important function. In this paper, an unmanned vehicle is used to make it move freely with irregular trajectories on a map with random distribution of environmental marks, so as to achieve the perception of the surrounding environment and gradually build an environmental map. In order to correct the positioning of unmanned vehicles to obtain more accurate positioning, this paper compares the path, heading, and observed landmarks. The average error in the X direction is 0.530m, and the average error in the Y direction is 0.265m. After using the EKF-SLAM (Extended Kalman Filter-Simultaneous Localization and Mapping) algorithm, the average error in the X direction is 0.32m, and the average error in the Y direction is 0.18m. The research shows that the method proposed in this paper is helpful for autonomous localization and precise navigation of unmanned vehicles.