Multi-robot system has great potential than one single robot due to the flexibility. By adjusting formations of the system, complex tasks can be accomplished. However, formation control may conflict with obstacle avoidance in clutter environments. Therefore, we propose a distributed motion planner for multi-mobile robot systems to balance formation control and obstacle avoidance. Caging behavior is designed for the system to achieve desired formations. For obstacle avoidance, the artificial potential filed algorithm is improved, in which the force caused by formation control is considered. Thus, conflicted forces can be avoided and tangential directional forces can be enrolled. Simulation results demonstrate the system can keep desired formations in multi-obstacle environments. Moreover, the proposed algorithms is distributed, and the priority between the two tasks can be adjusted.