A digital twin for a multifunctional technology for flexible manufacturing on an assembly, disassembly, and repair mechatronics line (A/D/RML), assisted by a complex autonomous system (CAS), is presented in the paper. The hardware architecture consists of the A/D/RML and a six-workstation (WS) mechatronics line (ML) connected to a flexible cell (FC) and equipped with a six-degree of freedom (DOF) industrial robotic manipulator (IRM). The CAS has in its structure two driving wheels and one free wheel (2DW/1FW)-wheeled mobile robot (WMR) equipped with a 7-DOF robotic manipulator (RM). On the end effector of the RM, a mobile visual servoing system (eye-in-hand MVSS) is mounted. The multifunctionality is provided by the three actions, assembly, disassembly, and repair, while the flexibility is due to the assembly of different products. After disassembly or repair, CAS picks up the disassembled components and transports them to the appropriate storage depots for reuse. Disassembling or repairing starts after assembling, and the final assembled product fails the quality test. The virtual world that serves as the digital counterpart consists of tasks assignment, planning and synchronization of A/D/RML with integrated robotic systems, IRM, and CAS. Additionally, the virtual world includes hybrid modeling with synchronized hybrid Petri nets (SHPN), simulation of the SHPN models, modeling of the MVSS, and simulation of the trajectory-tracking sliding-mode control (TTSMC) of the CAS. The real world, as counterpart of the digital twin, consists of communication, synchronization, and control of A/D/RML and CAS. In addition, the real world includes control of the MVSS, the inverse kinematic control (IKC) of the RM and graphic user interface (GUI) for monitoring and real-time control of the whole system. The “Digital twin” approach has been designed to meet all the requirements and attributes of Industry 4.0 and beyond towards Industry 5.0, the target being a closer collaboration between the human operator and the production line.