This paper addresses two substantial aspects in the field of robotics: trajectory planning and trajectory tracking for multi-robot systems. The collective movement of the multi-wheeled mobile robots is based on a formation control with a leader–follower strategy. To ensure safe navigation toward the destination within a workspace containing multiple obstacles, we skillfully combine the Modified Artificial Potential Field (MAPF) method and the Improved Particle Swarm Optimization (IPSO) algorithm for a group of nonholonomic mobile robots. A global planner based on IPSO algorithm is assigned to the leader robot, to find the optimal collision-free path. Compared to recent nature-inspired methodologies, the improvement suggested enhance the search capabilities of the algorithm, resulting in a 2% reduction in path length and a 29% decrease in computation time. Simultaneously, the follower robot has the ability to employ either a formation policy or a local planner using MAPF. The proposed modifications address the primary limitations of the conventional method, notably the susceptibility to local minima and the challenge of reaching goals near obstacles. Furthermore, this local planner is adept at evading both static and dynamic obstacles. Extensive real hardware experiments are conducted within multiple scenarios using the mobile robot Qbot-2e to corroborate the obtained simulation results and validate the effectiveness of the proposed approaches both in tracking the desired trajectories, finding the optimal feasible collision-free path and avoiding static and dynamic obstacles for multi-robot systems.