Parallel self-assembly is an efficient approach to accelerate the assembly process for modular robots. However, these approaches cannot accommodate complicated environments with obstacles, which restricts their applications. This paper considers the surrounding stationary obstacles and proposes a parallel self-assembly planning algorithm named SAPOA. With this algorithm, modular robots can avoid immovable obstacles when performing docking actions, which adapts the parallel self-assembly process to complex scenes. To validate the efficiency and scalability, we have designed 25 distinct grid maps with different obstacle configurations to simulate the algorithm. From the results compared to the existing parallel self-assembly algorithms, our algorithm shows a significantly higher success rate, which is more than 80%. For verification in real-world applications, a multi-agent hardware testbed system is developed. The algorithm is successfully deployed on four omnidirectional unmanned surface vehicles, CuBoats. The navigation strategy that translates the discrete planner, SAPOA, to the continuous controller on the CuBoats is presented. The algorithm's feasibility and flexibility were demonstrated through successful self-assembly experiments on 5 maps with varying obstacle configurations.