To measure the real assembly force of industrial robots precisely in aircraft assembly, a method of gravity identification and online compensation for the robot end-effector based on the laser tracker is proposed. With the help of external measuring equipment such as a laser tracker, the global kinematics model of the robot system is set up to realize the accurate acquisition of the end-effector pose of the robot. Then, Kalman filtering is utilized to process the force/torque signal to obtain more exact and stable external information, and the relationship between the gravity component and the pose of the end-effector is established, considering the influence of the zero-point bias of the sensor and the error of the robot installation. Finally, an online gravity compensation experiment of the robot end-effector is conducted and demonstrates the effectiveness of the proposed method.