The invention discloses a mechanical structure of a pipeline grinding robot, which is used for grinding pipelines. The mechanical structure includes frame parts, pipe clamping device, motion system, and grinding assembly; the motion system drives the grinding assembly to move freely along three dimensions, namely, moving back and forth along the axis of the pipeline, moving circularly around the axis of the pipeline to be polished, and moving toward the The grinding pipeline moves back and forth in the radial direction, and the high-speed rotating motor assembled on the grinding assembly drives the grinding wheel, which can fully polish the area to be polished of the pipeline to be polished. The invention also discloses the working method of the mechanical structure. The motion system can move freely in three dimensions along the pipeline axis direction, the circumferential direction of the pipeline to be polished, and the radial direction of the pipeline to be polished. The grinding component is installed on the motion system, driven by the motion system Next, the grinding assembly can move freely along the above three dimensions, and the area to be polished of the pipeline to be polished is polished under the action of the high-speed rotating grinding wheel on the grinding assembly. Three-dimensional grinding, good flexibility and high grinding precision.