A Preliminary Study of Inverse Kinematics Analysis and Experimental Validation of a 3-DOF SCARA Robot Mechanism

Robot arms have been developed for decades, and they essentially facilitate the growth of modern manufacturing automation. Recently, with the rapid development in electronics and communications, building a robot arm from scratch becomes feasible for undergraduate students. However, the associated kinematic dynamics, and control are usually more challenging. This article mainly focuses on studying the inverse kinematics of a self-built 3-DOF SCARA robot manipulator served as the test bed for designing robot arms in the future. Utilizing a series of kinematic equations, we are able to describe the relation between the end effector and each joint angle analytically. Consequently, it is reasonable to simulate the trajectory of the end effector in MATLAB, making it possible to analyze the path planning. In parallel, the SCARA robot arm is also realized by hiring aluminum structural elements and three servo motors and using an Arduino board to communicate with the LabVIEW interface in host computer for realizing manipulation and control of the SCARA mechanism. Meanwhile, Wiimote and IR-LEDs are also integrated to serve as external position sensors for monitoring the configuration of the mechanism. Finally, kinematical analyses are validated by that test article using several simple trajectories.


Introduction
Industry 4.0 [1], which is a name for the current trend of automation and data exchange in manufacturing technologies, is believed to bring the next generation of industrial revolution.
In a manufacturing process, achieving high quality and efficiency with low cost is always the main purpose.This goal could not be accomplished without extensively using robot arms for realizing automation.A robot arm, which is usually programmable, is able to function as a human arm for dealing with repeating tasks with high accuracy.In 1981, a type of assembly robot called Selective Compliance Assembly Robot Arm (SCARA) was presented by Sankyo Seiki, Pentel, and NEC to initiate a new branch of assembly robots [2].The links of a SCARA robotic arm are connected by several joints, enabling both translational and rotational motions.In other words, the arm is rigid in the Z-axis and pliable in the XYaxis, allowing it having the ability to complete many types of works while having flexibility up to a certain extent.Therefore, the study of a SCARA system could be simplified to a 2-D kinematic model and what matters is the relation between the position and orientation of the end effector and the joint angles.As a result, this makes it convenient by using a SCARA robot as a basis for studying robot kinematics and control.
In previous works, a lot of researches have been performed for robot manipulators, including controller design, mechanical design, and kinematic analysis [3][4][5][6][7].However, the high cost in data processing units and key components as well as the user-unfriendly computational environment impose severe barriers for studying robotics.
Recently, with the wide spreading of low cost data communication electronics and protocol such as Arduino and servo motor modules, it is now possible to build simple while effective robot arms from scratch for studying the mechanics and control of robots in a reasonable cost and time duration.
Motivated by the above-mentioned issues, the goal of this work is to study robot kinematics by realizing a comprehensive 3-DOF SCARA robot and its associated monitoring system for test and validation.Fig. 1 is the research flow of this work, presenting the overall plan in kinematic analysis and experimental validation.In this study, we mainly focus on the kinematic analysis and trajectory simulation of the SCARA mechanism.
In parallel, a SCARA prototype is also built for validating the developed inverse kinematics by conducting path experiments.
Meanwhile, Wiimote is also used for monitoring the position of each joint, providing data for validation and modification.With the realization of the 3-DOF SCARA robot prototype and the validation of kinematics, the analysis of dynamics and development of feedback control schemes can then be followed.And this allows us gaining insights in developing robots for handling more complicated tasks.

Mathematical Model
In robots, an end effector is a device at the free end of the chain of links that provides the functionality of the manipulator [3], which is designed for carrying various tasks.As described in Fig. 1, it is necessary to establish a mathematical model for correlating the rotating angle of each joint to the final position of the end effector first, which respects to a simplified 3R manipulator as shown in Fig. 2.There are three links with three revolute joints in this study.By rotating the three joints, the end-effector of the manipulator is able to move along a designated path.The relation between the end effector and the joints can be described by forward kinematics, which refers to the process of using kinematic equations to compute the position and orientation of the end effector from the given joint variables θ 1 , θ 2 , θ 3 and link lengths l 1 , l 2 , l 3 .Referring to Fig. 2, the related equations are expressed as [4]: On the other hand, the inverse kinematics is a process of using kinematic equations to determine the required joint variables by the desired position and orientation of an end effector [3].Based on the Eqs.(1a) to (1c), it is possible to find the required joint variable (θ 1 , θ 2 , θ 3 ) under the circumstance that the position and orientation of end effector (i.e., (x, y) and φ) is confirmed and the relationship can be shown as [3][4] [5]: where γ is expressed as and X, Y are defined as: Furthermore, it is important to point out that the inverse kinematics usually results in multiple solutions.For example, from Eq.(2a), one can see that for a given position, there are two robot configuration satisfied.In general, which solution to select depends on the actual movement of the manipulator and the imposed constraints, which should be further considered during motion planning.
In this study, the solution of minus sign in Eq.(2a) is selected based on the smoothness of movement, and either the position or joint angle can be solved and the solving process can be carried by numerical computational tool efficiently.Consequently, simulations and experiments for various paths are able to be conducted based on this mathematical model.Fig. 2. Simplified 3R manipulator

Inverse Kinematics Test
On the basis of previous development, it is possible to utilize MATLAB to perform kinematics analysis.Using the manipulator shown in Fig. 2 as the example.Suppose the desired position and orientation of end effector are (20 , 20) and φ = 0˚.The goal is to solve for the joint angles with l 1 =18 (cm), l 2 =9 (cm), l 3 =6 (cm).By using the kinematic equations shown in Section 2 (i.e., Eqs.(2a) to (2c)), the inverse kinematics simulation for a single destination is performed in MATLAB and the result is shown in Fig. 3.As mentioned earlier, there are two solutions for every target position and both of them are feasible if no further constraints are imposed.

Trajectory simulation
After validating the inverse kinematics simulation for a single location, it is possible to extend the simulation for trajectory planning since a line can be regarded as a set of points in mathematics.That is, a specific path can also be divided into a set of intermediate points.Therefore, the moving of the end effector can be considered as sliding through these points.By combining a series of single point simulation, the required joint variables for a specific path is able to be created.In this study, we apply the for loop command in MATLAB to find the value of each joint variable for every point on the path.For instance, suppose the desired path is a circle, which is a simple but representative example.The path is divided into 20 intermediate points and the joint angles for every intermediate point are calculated sequentially by the MATLAB-based inverse kinematics analysis.Fig. 4(a) shows the simulated circular trajectory with the coordinates of every joint.Meanwhile, the history of each joint angle is also shown in Fig. 4(b) for providing more detailed technical information.The computational time for each iteration is estimated as less than 0.1 second, which is less than the time required for moving and the computation can be treated as in situ for future integration in real robot manipulation.
In summary, the trajectory simulation and path planning has been established by the developed inverse kinematics with MATLAB.It is now to present our effort in designing a prototype of SCARA robot mechanism for experimental validation and for subsequent studies in trajectory planning and feedback control.

SCARA mechanism realization
In order to implement the prototype of the SCARA mechanism efficiently, as shown in Fig. 5, three standard commercially-available structural aluminum members and three servo motors kits are used as the linkages and the actuator, respectively.The associated parameters for links and models for motors are shown in table 1.The first servo motor is set on the lower left corner of the foundation, while the others are attached at the end of the corresponding linkage.For recording the trajectory of end effector, a marker is mounted and served as the end effector to draw the path during the movement.An Arduino (MEGA2560) board is used to control the three servo motors.By typing a desired angle, the control board can send the corresponding PWM signal to the servo motor.This makes it possible to realize the trajectory simulation with a series of joint angles, which are calculated by means of applying inverse kinematics.The more detailed control method will be discussed in Section 5.2.

Joint variable sensor integration
For determining the position of the end effector and the rotating angle of each joint, Wiimote 2D localization scheme previously developed by us [8] is applied.This scheme utilizes Wiimote, the primary controller for Nintendo's Wii console, to serve as an external sensor.Utilizing the built-in CMOS image sensor, it can receive the signal from up to four IR LEDs, which are located at the end effector and at the end of each linkage.As shown in Fig. 6, the sensing range is 45˚ in x-direction and 35˚ in y-direction, forming a sensing zone with a resolution of 1024x768 pixels [9].The detected IR LED images are sent to the host computer via Bluetooth.Finally, the pixel coordinates are converted into their corresponding physical coordinates with a known sensing distance.The spatial resolution is dependent on the sensing distance between a Wiimote and its corresponding IR LEDs.From Chen's research, the relation can be expressed as: P = 0.0075 x Z + 0.0045 (5) Where P (mm) represents pixel length, and Z (cm) is the sensing distance.Utilizing this equation, we are able to find the required sensing zone with reasonable resolution by adjusting the sensing distance.As a result, it is possible to monitor the position of every joint instantly by taking advantage of the LabVIEW program.In addition, based on the coordinate information from Wiimote, one can calculate the joint angles.This also makes it possible to calculate the difference between the theoretical and experimental position values, providing space for further modifications.In summary, the SCARA prototype, host computer and its interface, and the external position sensor have been introduced in this section.With this experimental setup ready, it is possible to conduct experiments in trajectory following to validate the kinematics and simulations, developed in Section 2 and 3.

Experiment Setup
The overall experiment setup for realizing the trajectory simulation is shown in Fig. 7.With the marker mounted on the end effector, the trajectory on the paper can be recorded during the moving process.Using the system address in Section 4, we can validate our single point and trajectory simulation.The Wiimote is fixed at a sensing distance of 80 cm from the ground to monitor the position of every joint.By Eq.( 5), the corresponding spatial resolution should be 0.60 (mm).Although not addressed in this work, by combining these two parts (i.e., SCARA and Wiimote), it is possible to establish a feedback control system in the near future.

Software Interface
The equations from the analysis of inverse kinematics (i.e., Eqs.(2a) to (4b)), which are used in MATLAB for trajectory simulation, can be modified to be applicable in Arduino IDE as shown in Fig. 8(a).Therefore, with the Arduino board connected with computer through USB, the calculation and control of the servos can be completed simultaneously.On the other hand, LabVIEW is used for receiving and analyzing data from the Wiimote.In this study, both LabVIEW and Arduino have been integrated to form a remote control and the interface is shown in Fig. 8(b).As shown in Fig. 8(b), we can manipulate the position of end effector c by sliding the slider for x and y, while the orientation is controlled by the φ slider.Meanwhile, the position of each joint is captured by the CMOS image sensor in Wiimote, and the coordinate information is shown in the IR Sensor plot.Based on the information in the plot, the corresponding coordinates can be obtained from related calculation with the resolution of 1024x768.

Experiment Results
The first experiment mainly deals with a circular trajectory and the result is shown in Fig. 10(a).In this test, a set of joint angles are prepared for the circular path, which are calculated in MATLAB in advance and then imported into the Arduino IDE.The program is executed repeatedly, and the end effector indeed move along an askew circle.However, this result is not satisfied with the huge errors in each joint.These errors result from the gear-shaped adapter of motor, which causes the offset of each joint.To find the error in each joint, the Wiimote-based 2D localization is introduced.Therefore, another single point experiment is conducted to improve the performance.The purpose of this test is to find out the error between the ideal and real position by using Wiimote to monitor the position of every joint.As shown in Fig. 9, the position of every joint is plotted for simulation result and Wiimote monitoring data.Thus, it is possible to eliminate the error in joint angles based on the result.The result of modified circular trajectory is shown in Fig. 10(b).Although it still contains some discrepancies between the simulation and experimental results, the results are significantly improved.It is concluded that with the information provided by Wiimote, the trajectory of end effector can be improved.
Trajectories with other shapes such as L shape is also performed and shown in Fig. 11.Again, although the results are primitive and need to be improved, these kinematics analyses are somehow verified and this work also provides necessary infrastructure and systems for future studies.

Discussion and Conclusion
In this study, the forward and inverse kinematics are developed to analyze the position and orientation of the end effector of a SCARA mechanism as well as the corresponding trajectory simulation.An experimental prototype is established to validate the analysis by conducting experiments for a representative circular trajectory and others.Meanwhile, the Wiimote is used to serve as an external sensor.Although it is still not a feedback system, the associated data from Wiimote 2D localization provides the foundation for modifying the error in joint angles.Despite the result is still primitive, the trajectory has been improved by taking advantage of the data from Wiimote monitoring system.
In summary, by integrating kinematic analysis, SCARA mechanism, and Wiimote-based localization, a preliminary system with comprehensive schemes has been developed, which is the goal of this work.A more comprehensive study involving feedback control is currently underway.It is believed that the prototype established in this study should be useful for either analyzing kinematics or developing methods for robot control.