Aiming at the difficulty in obtaining the accuracy of position and attitude estimation of spherical robot in real time and accurately in motion control, an attitude calculation algorithm based on the fusion of complementary filter and particle filter is presented. In order to avoid the problem of the large error in pitch and roll angles caused by magnetometer data participating in the quaternion calculation, the yaw angle of the spherical robot is calculated by the complementary filtering of gyroscope and magnetometer independently. And the weight of the magnetometer in the complementary filtering is adjusted dynamically by evaluating the noise of the magnetometer using information entropy. Experimental results show that, the error of the yaw angle is less than 3° in the external magnetic field interference experiment. And it is about 0.3° in the dynamic and static experiments of the spherical robot, and the errors of pitch and roll angles can be controlled within 0.1°. Therefore, the algorithm can guarantee the real-time performance of the attitude calculation of the spherical robot, enhance the accuracy and the anti-interference ability, and effectively improve the motion control precision of the spherical robot.