The problem of the collision avoidance and obstacle avoidance in the cooperative control of fleet systems is studied. Fleet collisions can be avoided by applying the virtual structure method and adding the relative collision function into the potential function. The purpose of obstacle avoidance is also achieved by setting safety routes. According to the characters of the kinematics and the dynamics of vessels, the controller for fleet formation is designed using Lyapunov theory. Finally, a simulation is given to verify the correctness and effectiveness of the proposed controller.