Manned space program in China has entered the space station stage. Space astronauts have very limited time. In order to free space astronauts from some routine repetitive tasks, various free-flyingr robots in space appear. The measurement of their position and attitude is the premise of their autonomous flight and remote operation. Thus, the position and attitude measurements system of Astronaut Assistant Robot (AAR) is designed. Because of the limitation of the cabin space, with the movement of the robot, sometimes only the local image of targets can be captured by camera. So how to carry out the local image tracking and pose calculation is a difficult point. The paper proposes an integration method of target feature template and local search to track moving target in real time, so that the position and attitude of the camera is calculated by using PnP algorithm, which has solved the problem stated above. The position and attitude measurements system is modeled and simulated. Furthermore, a series of measures are taken to improve the real-time performance, and the accuracy is verified. The simulation results show that the measurement system meets the requirements of real time and precision.