For the current inspection mode of high-voltage transmission lines in power grid, it is mainly through manual hand-held instruments or naked eyes to inspect facility defects, which is not only difficult and intense, but also inefficient, and cannot adapt to the safe operation and development of modern power grid. In recent years, with the rapid development of unmanned aerial vehicle technology and related sensor technology, unmanned aerial vehicle has been widely used in electric inspection. Therefore, a real-time RTK and SLAM localization scheme based on lidar is proposed. The location information of UAV can be stably obtained both indoors and outdoors, ensuring the safe operation of the UAV.