Localization is one of the core technologies for mobile robots to achieve full autonomous movement, and is a prerequisite for other autonomous tasks. The robot working environment is dynamic in most cases, so the localization algorithm must overcome the effects of dynamic changes in the environment. The paper proposed a localization algorithm that allows the robot to perform robust and life-long localization in dynamic environment. The algorithm filter out high-dynamic objects and update semi-static object on the map at the same time, it can also use the information provided in semi-static objects to improve localization performance. In this paper, the processing of dynamic objects is divided into two parts: filtering of high-dynamic objects and updating of semi-static objects. For high dynamic object filtering, a dynamic object detection method combining a delay comparison method and a tracking method is proposed by observed the characteristics of localization system; For the update of semi-static objects, this paper uses the pose graph optimization and occupancy map to implement the dynamic update of the map. The combination of the two methods allows the robot to achieve long-term stable localization in a dynamic environment. The experimental results demonstrate that the proposed method allows the robot achieve long-term localization, overcome the effects of high-dynamic objects and keeping the map always consistent with the environment.