A novel hybrid self-reconfigurable modular robot is designed which is composed of several basic modules. Each basic module consists of a master module and a slave module which are the shape of the triangular prism. In the master module, there are three driving motors and gear reducers In the slave module, there are two driven motors and two pairs of rack-pinions. With the special structure and different speeds of two pairs of rack-pinions, two pegs of the slave module connect with two docking holes of the master module. Finally, a simulation of three basic modules is shown to finish the morphing process effectively. It can finish the morphing task from the line shape to the hexagon shape. The result shows that the basic module of the proposed robot has a compact structure, it can realize the morphing process effectively by docking and detaching.