As an important part of the automation industrial system, the mechanical arm robot plays an important role in service, exploration, automation engineering and other fields, and has broad application prospects. The traditional mechanical arm and Sobel edge detection methods have some shortcomings: 1. The PID method is separated from the ontology model and only carries out simple and multiple calculations according to the code of the steering engine, which is not stable enough and will take more time; 2. In some complex environments, while Sobel edge detection detects the shape of objects, the separation between the subject and background is not clear, making it impossible to obtain accurate object information. Therefore, this paper proposes a new PID method and Canny edge detection algorithm: 1. The PID method combined with three-dimensional coordinate system modeling, achieves a more stable, faster and more robust calculation formula, to complete the mechanical arm grasping function; 2. Use of Canny edge detection and the three-dimensional coordinate system to analyze the object image to obtain accurate information about the target object.