# Design of Demonstration-Driven Assembling Manipulator
## 2 Methods  
The proposed system shown in Figure 1 works in two phases: the demonstration phase and the automatic assembly phase. First, in the demonstration phase, one manually shows to the manipulator each step (e.g., move one workpiece on top of another) of a specific task. The 3D camera obtains the spatial positions of the workpiece dynamically during the demonstration, and then transform the positions based on the coordinate system of the industrial manipulator. According to the inverse kinematic model of the industrial manipulator, the control information of each manipulator joint is obtained for each position of the workpiece. Then, in the auto-assembly phase, the manipulator is driven to complete the task automatically based on the control information generated above. The proposed automatic assembly system consists of a manipulator, a control box, and a camera, as Figure 2 shows. NVIDIA Jetson TK1 was chosen as the image processing module for this system. Figure 1: Route chart of teaching a manipulator by vision guiding, without programming the device. YOLO (You Only Look Once) [19; 20] was adopted and implemented for object detection. It is a fast algorithm based on convolutional neural network that can detect the target of interest in the input image accurately. The detection speed is very fast, up to 45 frames per second. The robot control circuit uses STM32F103 embedded structure to control the movements of seven servomotors, six of which are the same joint servomotors, while the seventh is a claw servomotor. The time of execution of the control algorithm on the STM32 microcontroller is about 3 ms. The parameters of the robot dynamics of the six joint servomotors are shown in Table 1.  
The theoretical safety factor can be obtained as follows:  
\[N=\frac{M^{*}}{M}=\frac{3.7278\text{ N}\cdot\text{m}}{2.082\text{ N}\cdot\text{m}}=1.79 \tag{1}\]  
Here, \(M^{*}\) is the maximum output torque of the X20-8.4-50 steering gear and \(M\) is the theoretical total torque calculated from the actual mass and length. Therefore, the safety factor provides sufficient allowance for the uncalculated friction force and non-inertial force of the mechanism. The visual signal processing hardware (NVIDIA TK1), including a 3D camera, can recognize the objects in real-time and capture their motions. According to the signals given by TK1, the manipulator controller can grasp the object, move it to a specified place (as demonstrated by a human), and release it. A wireless communication module is used to increase the flexibility of the manipulator. The structure of the control box is shown in Figure 3.  
The underlying models for robot control are shown in Figure 4 below. The boxes with solid lines next to the green arrows represent the input image which contains target objects. The blue boxes represent the sensors and controller components (including a camera, upper computer, lower computer, and rudder). The boxes with solid lines next to the orange arrows represent the output of each component. The boxes with dotted lines next to the green arrows represent the transmission link. The control interface of the upper computer is written in C# language. It takes the position and shape of the target object as input. Given the arm length of the manipulator and the initial value of each joint, the rudder angles of each joint are solved by the D-H algorithm and are then sent to the lower machine. The upper computer can initialize and configure the minimum and maximum rotation angles of each joint rudder to ensure that there is no collision with the parts or environment. The upper computer also has several other functions which enables fast adjustment of the configurations of the manipulator. First, the rotation angle of each joint rudder can be adjusted and the initial values