As the demand for on-orbit servicing, satellite refueling, and modular space missions continues to grow, autonomous docking and undocking systems are becoming critical components in future space operations. Traditional docking procedures are often based on manual control or rigid pre-programmed sequences, which can increase the risk of errors and limit adaptability in changing environments. In response, our student-led project presents a compact, hardware-software integrated system designed to enable autonomous docking and undocking between small spacecraft focusing primarily on CubeSats and microsatellite platforms. The system is built using two modular robotic platforms that simulate spacecraft units in a controlled testing environment. Each platform includes a microcontroller (such as Arduino or Raspberry Pi), a set of ultrasonic and infrared sensors, magnetic docking mechanisms, and motorized wheels for movement. The docking procedure is guided by sensor feedback and uses PID (Proportional-Integral-Derivative) control to fine-tune the position and orientation during approach. The entire process follows a step-by-step flow: detection, approach, alignment, soft capture, and firm docking, all triggered by measured distances and programmed thresholds. The software runs both onboard and in a ground-based simulation setup. The navigation code is designed to adapt in real time, allowing the system to successfully dock even when there are small position errors or inconsistent sensor readings. The undocking sequence is also automated, triggered by specific conditions or mission events, and it ensures the two units separate smoothly without collision. To handle minor faults, such as failed alignments or lost signals, the system can automatically retry the procedure without manual intervention. To prepare for real-world application and improve test reliability, we’ve also created a virtual testbed using Gazebo and the Robot Operating System (ROS). This lets us simulate docking movements, adjust timing and control settings, and observe how the system would behave in microgravity-like conditions. The simulation helps us fine-tune the entire process before moving to physical experiments. This project shows how students can contribute meaningful solutions to real challenges in space mission design. By combining affordable components, smart control logic, and automated decision-making, we present a working model for future in-orbit servicing missions involving nanosatellites or modular orbital structures. The potential applications include autonomous assembly, satellite repair, and swarm coordination.