In this paper, aiming at the problem of rapid orientation of small satellites to the upper stage rocket, the attitude control scheme of small satellites to the upper stage rocket is designed, and the fourth order runge-kutta integral algorithm and hierarchical saturated PD control algorithm based on gyro are designed. Firstly, the correctness of the attitude control scheme and attitude control algorithm is preliminarily verified through mathematical simulation. On this basis, a semi-physical simulation platform of the small satellite attitude control system is built, and corresponding simulation software is developed to carry out semi-physical simulation of the small satellite attitude control system of flywheel open-loop tracking and flywheel closed-loop tracking, which further verifies the correctness of the attitude control scheme and attitude control algorithm design. Finally, the correctness of the attitude control system is proved by the fly test.