This study considers the problem of formation control for second-order multiagent systems. We propose a distributed nonlinear formation controller where the control input of each follower can be expressed as a product of a nonlinear term that relies on the distance errors under the leader–follower structure. In the leader–follower structure, a small number of agents are assumed to be the leaders, and they are responsible for steering a group of agents to the specific destination, while the rest of the agents are called followers. The stability of the proposed control laws is demonstrated by utilizing the Lyapunov function candidate. To solve the obstacle avoidance problem, the artificial potential approach is employed, and the agents can avoid each possible obstacle successfully without getting stuck in any local minimum point. The control problem of multiagent systems in the presence of unknown constant disturbances is also considered. To attenuate such disturbances, the integral term is introduced, and the static error is eliminated through the proposed PI controller, which makes the system stable; the adaptive controller is designed to reduce the effect of time-varying disturbances. Finally, numerical simulation results are presented to support the obtained theoretical results.