Rendezvous and docking between spacecrafts are key operation for many space missions. It is necessary to perform groundbased experiment before space missions. In this paper, based on the model of twodimensional rendezvous and docking, a guidance method using the idea of potential function was presented. A quasirectangle obstacle constraint described by superquadratic curves and a safety docking area constraint of the target spacecraft with heartshaped curve were considered. Then, a groundbased experiment system was built, and two simulators and an electromagnetic docking mechanism were developed. The experimental results showed the feasibility of the experimental system and the effectiveness of the guidance method.