Share this

Intelligent control algorithm and simulation for 2D obstacle avoidance in SCARA robots

2026-04-06 06:40:40 · · #1

Abstract: This paper addresses the trajectory planning problem for SCARA robots to avoid obstacles in a horizontal plane. Based on geometric and artificial intelligence theories, an intelligent control algorithm is proposed to generate the joint coordinate sequence along the obstacle avoidance path of the SCARA robot. Simulation results show that the proposed control algorithm can quickly and effectively achieve two-dimensional obstacle avoidance of the SCARA robot in the XY plane, demonstrating strong engineering applicability.
Keywords: SCARA robot; 2D obstacle avoidance; intelligent control; A* algorithm

1. Introduction
Currently, SCARA robots are widely used in industries such as electronics, automotive, plastics, and food, primarily for handling and assembly tasks. As manufacturing processes become increasingly complex and precise, SCARA robots on assembly lines often need to work collaboratively with other industrial equipment, inevitably leading to the risk of collisions with obstacles. Therefore, planning the motion trajectory of SCARA robots in the presence of obstacles within their working range is particularly important.

Path planning refers to selecting a path from the starting point to the target point, given environmental obstacle conditions and the positions of the starting and target points, so that a SCARA robot can safely and without collisions pass through all obstacles. This autonomous obstacle avoidance and task completion is an important aspect of SCARA robot research. The essence of path planning is to pre-define the sequence of joint coordinate values ​​along the SCARA robot's working path, causing it to move along the predetermined path. For a four-axis robot, the longitudinal movement of joint 3 and the grippered movement of joint 4 are highly flexible and can be controlled in real-time with simple motion commands to avoid obstacles. The associated movements of joints 1 and 2 in the horizontal plane largely determine the main pose of the SCARA robot and are the dominant factors in obstacle avoidance. Therefore, rationally planning the sequence of joint coordinate values ​​for joints 1 and 2 in the horizontal plane is a prerequisite and key to achieving obstacle avoidance. This paper addresses the two-dimensional obstacle avoidance problem of SCARA robots, proposing an intelligent control algorithm based on geometric and artificial intelligence theories and verifying it through simulation.

2. Design of Two-Dimensional Obstacle Avoidance Intelligent Control Algorithm
Although actual obstacles in industrial settings have various planar shapes, any shape of obstacle can be enclosed by its circumscribed cylinder. To simplify the problem description without losing generality, this paper assumes that the actual obstacle is a cylindrical structure, which, when mapped onto the XY horizontal plane, is a circular region. The overall idea of ​​this algorithm is as follows: First, the joint space q1-q2 formed by joints 1 and 2 is rasterized into a finite number of small squares, and each small square is numbered and assigned coordinate values; then, the circular obstacle region in the Cartesian coordinate system XY is transformed into a group of unreachable small squares in the joint space, their numbers are calculated, and values ​​are assigned to the reachability matrix; next, the A* algorithm, which has heuristic search in artificial intelligence theory, is used to find the sequence of obstacle avoidance path points in the joint space; finally, this sequence of numbers is converted into the corresponding joint coordinate value sequence, and joints 1 and 2 move sequentially by taking the corresponding joint angle values ​​to achieve two-dimensional obstacle avoidance control.

2.1 Joint space q1-q2 rasterization
Assuming the motion range of joints 1 and 2 of the SCARA robot is [-120, 120], and the subdivision precision is set to 6 (the subdivision precision can be flexibly selected according to the actual situation), the joint coordinate axes q1 and q2 can be divided into [120-(-120)] / 6 = 40 equal small line segments. Parallel lines to the q1 axis and q2 axis are drawn at the endpoints of each small line segment. All parallel lines intersect, and the joint space plane can be divided into 40*40 = 1600 small squares of equal area, thus realizing the gridding of the joint space q1-q2, as shown in Figure 3.
Then, each small square is numbered and its joint coordinate value is set. Following the principle of increasing from left to right and from bottom to top, the numbering is taken as an integer between [1, 1600]. In Figure 3, the small square in the lower left corner is numbered 1, the small square in the upper right corner is numbered 1600, the small square directly above the small square is numbered 41, and so on, so that the unique and distinct numbering value of all small squares can be obtained.
Finally, coordinate values ​​are assigned to each small square. To ensure a uniform distribution of coordinate values, the center coordinates (q1, q2) of each small square are taken as its coordinate values. Thus, the coordinates of small square 1 are (-117, -117), the coordinates of small square 1600 are (117, 117), the coordinates of small square 41 are (-117, -111), and so on, thus obtaining the unique and distinct coordinate values ​​of all small squares.

2.2 Identify the obstacle area
In the Cartesian coordinate system shown in Figure 1, O is the origin. OA2 and A2B2 represent the upper and lower arms of the SCARA robot, respectively. Using the right-hand rule, the solid line OA2B2 indicates the pose of the robot at joint coordinates (-117, -117), corresponding to square 1 in the joint space. The dashed line OMN indicates the pose when the robot is aligned with the positive X-axis. The dashed line OA1B1 indicates the pose at joint coordinates (117, 117), corresponding to square 1600 in the joint space. The space enclosed by the blue and black dashed lines is the robot's active area. Within this area, two circular obstacles, K1 and K2, are assumed to exist, with known radii. Since this algorithm requires planning obstacle avoidance paths in the joint coordinate system, the obstacle area in the Cartesian coordinate system must first be converted into the corresponding numbered group in the joint coordinate system.

When the upper arm is between OG1 and OJ1, the forearm may collide with circle K1. Considering only the right-hand joint coordinate system, any q1 value within this interval has two corresponding q2 values: q20 and q21. q20 is the joint 2 angle at the start of the collision, and q21 is the joint 2 angle at the end of the collision. The difference between them is an angle value similar to twice the angle Q1G1F1. Using a geometric method, let pose OG1F1 be a limiting state where the forearm end collides with circle K1, and OG1Q1 be the pose when the forearm extension is tangent to circle K1, with the tangency point at Q1. From the geometric relationship shown in the figure, the angle value of Q1G1F1 can be calculated. Adding twice the angle value of Q1G1F1 to q20 gives q21.
The situation is completely similar in the left-hand joint coordinate system, and will not be elaborated further. Based on this, the maximum and minimum values ​​of q2 for each possible collision range of q1 can be calculated, thereby determining the boundary values ​​of obstacle K1 in joint space.
The boundary value of the circular obstacle K2 in the joint space can also be obtained using the same method.
According to the principle of connectivity, a closed circular region in Cartesian coordinates must also be a closed circular region in joint space. By connecting the calculated boundary values, the closed region is the obstacle region in the joint coordinate system, and the group of small squares covered by these regions is the obstacle region mapped from the circular obstacle region to the obstacle region in joint space.

The algorithm requires a reachability matrix with dimensions 1600*1600. Each element is either 0 or 1, where 0 indicates that two small squares are not reachable, and 1 indicates that they are reachable. The row and column corresponding to each obstacle region number in the reachability matrix are set to 0. Furthermore, to ensure that each small square can only connect to its eight adjacent small squares (small squares at the four corners of the joint space can only connect to their three adjacent small squares, and small squares on the four sides can only connect to their five adjacent small squares), and to prevent skipping steps, a value of 0 should be assigned to the corresponding position in the reachability matrix.

2.3 Search for obstacle avoidance path numbering sequence
Searching for obstacle avoidance paths in joint space is fundamental to this algorithm, and the search method has a decisive influence. This algorithm uses the A* algorithm for the search. The A* algorithm is a typical heuristic search algorithm in artificial intelligence, widely used in real-time systems and intelligent control. Its intelligence is mainly reflected in the fact that it can automatically search for the optimal obstacle avoidance path only requires the known starting point S, the target point G, and the obstacle region numbering group, without external conditions or human judgment.

This algorithm first establishes two tables, OpenList and ClosedList, to store the numbers of small squares generated but not expanded during the search process and the numbers of expanded small squares, respectively. Then, an evaluation function f(n) = g(n) + h(n) is defined to determine the search direction and expansion target, where g(n) represents the joint coordinate distance between the starting point S and the current small square N, and h(n) represents the distance between the current small square N and the target point G. At each search step, the small square with the smallest corresponding f(n) value is selected for expansion, and the path number is stored sequentially in the ClosedList table. The search ends when the number of the current small square N equals the number of the target point G. Finally, backtracking the numbers in ClosedList yields the desired obstacle avoidance path number sequence.

2.4 Determine the sequence of joint coordinate values ​​for the obstacle avoidance path
As can be seen from the joint space rasterization process, the small square number value and the joint coordinate value are uniquely corresponding. After obtaining the obstacle avoidance path number sequence, it is only necessary to correspond the number to the joint coordinates in sequence to obtain the final obstacle avoidance path joint coordinate value sequence. When the SCARA robot's joints 1 and 2 move by taking each coordinate value in this sequence in sequence, the entire two-dimensional intelligent obstacle avoidance process from the initial pose to the target pose is reflected in the Cartesian coordinate system.

3. Simulation Examples
Taking the SCARA robot MR-401-600 independently developed by Shenzhen Zhongweixing CNC Technology Co., Ltd. as an example, simulation verification was conducted. The arm and forearm lengths of MR-401-600 are 350mm and 250mm respectively. The value range and spatial division of joint 1 and joint 2 are based on the data in Section 2.1. Let the starting point S in the joint space be small square number 1, and the target point G be small square number 1600. The center coordinates of circular obstacles K1 and K2 in the rectangular coordinate system are (350, 400) and (200, -420) respectively, and the radii are 80mm and 60mm respectively. The value range of joint 1 that may collide is divided into 180 discrete points to fully approximate the obstacle area in the joint space. The simulation experiment was conducted using MATLAB language. The search time for path planning of this two-dimensional obstacle avoidance intelligent control algorithm is 1.5449 seconds. The simulation results are shown in Figures 2 to 4. Figure 2 shows the obstacle area under the left and right arm systems; Figure 3 shows the planning result of the two-dimensional obstacle avoidance path in the joint coordinate space, with the green pentagram in the lower left corner as the starting point, the red pentagram in the upper right corner as the target point, the red dot matrix as the obstacle area, and the line connecting the green dots as the obstacle avoidance path, indicating that the MR-401-600 starts from a pose where both the upper and lower arms have negative maximum angles and successively avoids two circular obstacles, reaching a pose where both the upper and lower arms have positive maximum angles; Figure 4 shows the dynamic demonstration process of the MR-401-600 achieving two-dimensional obstacle avoidance in the Cartesian coordinate system, with black representing the state of the upper arm at each moment, blue representing the state of the lower arm at each moment, and the green dashed line representing the actual movement trajectory of the lower arm end. Simulation results show that the SCARA robot MR-401-600 can successfully avoid obstacles and complete the predetermined path task, achieving collision-free movement from the starting point to the target point.






4. Conclusion
The proposed two-dimensional obstacle avoidance intelligent control algorithm can effectively plan optimized paths and successfully solve the obstacle collision avoidance problem of SCARA robots in a plane, demonstrating significant theoretical research value and strong practical application potential. It should be noted that since this algorithm is based on searching small squares in a graphic, the subdivision accuracy of the joint space has a significant impact on the algorithm's efficiency. Excessive subdivision accuracy will reduce search speed, while insufficient subdivision accuracy will reduce search precision. Therefore, users should select an appropriate value based on process requirements and actual conditions to maximize the algorithm's effectiveness.

References
[1] Huang Xianlong, Liang Bin, et al. A review of robot collision avoidance planning [J]. Control Engineering. 2000(6), pp. 28-35.
[2] Ding Fuqiang, Fei Yanqiong, et al. Real-time collision-free motion planning for dual-arm SCARATES robot [J]. Journal of Shanghai Jiaotong University. 37(11), pp. 1690-1693, 2003.
[3] Qian Donghai, Ma Yixiao, et al. Fast algorithm for establishing C-space of dual-arm SCARA robot [J]. Mechanical Science and Technology. 18(1), pp. 65-68, 1999.

Read next

CATDOLL 146CM Ya TPE (Customer Photos)

Height: 146cm A-cup Weight: 26kg Shoulder Width: 32cm Bust/Waist/Hip: 64/54/74cm Oral Depth: 3-5cm Vaginal Depth: 3-15c...

Articles 2026-02-22