This study focuses on a robot vision localization method for coping with the operational task of automatic nasal swab sampling. The application is important in the detection and epidemic prevention of Corona Virus Disease 2019 (COVID-19) to alleviate the large-scale negative impact of individuals suffering from pneumonia owing to COVID-19. In this method, the idea of a hierarchical decision network is used to consider the strong infectious characteristics of the COVID-19, which is followed by processing the robot behavior constraint condition. The visual navigation and positioning method using a single-arm robot for sampling is also planned, which considers the operation characteristics of medical staff. In the decision network, the risk factor for potential contact infection caused by swab sampling operations is established to avoid the spread among personnel. A robot visual servo control with artificial intelligence characteristics is developed to achieve a stable and safe nasal swab sampling operation. Experiments demonstrate that the proposed method can achieve good vision positioning for the robots and provide technical support for managing new major public health situations.