To solve the problem of formation and cooperative obstacle avoidance of multi-wheeled robots in the environment with obstacles, an algorithm combining the leader-follower and improved potential field with rapidly exploring random trees(IPFRRT) is proposed in this paper. The kinematic model of multiple robots is established, and the control rate of the path following of the following robots is designed by the backsteeping according to the error differential equation, and the stable formation of the robots is realized. At the same time, the IPFRRT is used as the path planning method for the leader, and the improved artificial potential field method is used as the local obstacle avoidance algorithm for the followers in the formation, so that the multi-robot system can simultaneously avoid obstacles in the formation. The Matlab simulation experiment shows that the robot system can quickly form and maintain formation, continue to recover formation after avoiding obstacles, and make the following error tend to 0 after avoiding obstacles, which verifies the feasibility of the formation control method.