3.1. Traditional Artificial Potential Field Algorithm
In APF, the robotic arm is subjected to two forces when moving to the target point. One force is the attractive force that pulls the robot towards the target position, while the other force is the repulsive force exerted by obstacles on the robot. Under the combined force of these two forces, the robotic arm can quickly reach the target position without colliding with obstacles in this process. The force analysis of the robotic arm in the potential field is shown in
Figure 1. The force on each joint and link of the robotic arm is shown in
Figure 2.
represents the repulsive force; represents the attractive force; and is the combined force of the two forces, which makes the manipulator reach the target position.
The attraction field produced by
can be obtained by Equation (4):
where
is the attraction field,
is the correction coefficient of the attractive potential field,
q represents the current position configuration of the robot,
represents the position configuration of the robot when reaching the target position, and
is the distance between the robot and the target position.
The repulsive potential field produced by
can be obtained by Equation (5):
where
is the repulsive potential field,
k is the correction coefficient of the repulsion potential field,
represents the position configuration of the robot when colliding with an obstacle,
is the real-time distance between the robotic arm and the obstacle, and
represents the influence radius of the obstacle. When
, the repulsion field will not affect the movement of the robot.
The total potential energy function can be expressed as Equation (6):
3.2. The Gradient of the Potential Field Function
The potential energy function is only dependent on joint angles for a robotic arm. We use the gradient descent method to minimize the potential energy function and determine a set of angles so that the robotic arm can reach the target position in the direction of the fastest potential energy descent without a collision with obstacles.
The attraction
is the negative of the gradient of the attraction potential field
, and it can be expressed as (7):
q is the current position configuration of the robot, and
is the position configuration of the robot when reaching the goal position. If the manipulator is entirely composed of revolute joints,
q can be assumed to be
, and
can be assumed to be
. Then,
can be expressed as (8):
If the manipulator comprises both prismatic joints (from joint 1 to joint
j) and revolute joints (from joint
j + 1 to joint
n), in this case,
q can be assumed to be
,
qgoal can be assumed to be
, and we assign a weight
to the prismatic joint and a weight
to the revolute joint to eliminate the units of nonhomogeneous form. Then,
can be expressed as (9):
The repulsive force
is the negative of the gradient of the repulsive potential field
can be expressed as (10):
We use the gradient descent to minimize the potential energy function in Equation (6). Equation (11) presents the generalized formula utilized for the
sth iteration of gradient descent. and Equation (12) shows how the learning rate
is calculated.
represents the position configuration of the robot arm at the
sth cycle.
The learning rate is dynamic, and it depends on the distance between the end-effector and goal point and the distance between the joints of robot and obstacle. are positive constants. 1 specifies the basic learning rate and specify the sensitivity to the position of manipulator. As the end-effector approaches the goal point and the joint of the robot approaches the obstacle, the learning rate decreases. This is performed to avoid collision with obstacles and reach the goal point more accurately. If faster algorithm execution is desired, the values of , , and can be increased accordingly. In this paper, 1, , and are adjusted within the range of 0.5–1.
The gradient of the attractive potential field is easy to calculate, while the gradient of the repulsive potential field is difficult to calculate, because the shortest distance between the robotic arm and the obstacle is difficult to calculate. This section focuses on the calculation of the shortest distance when facing different obstacles.
There are two types of obstacles on the factory assembly line usually, which are obstacles with complex shapes and obstacles with regular shapes. The obstacle can be simulated using the ball envelope method [
25], as shown in
Figure 3 and
Figure 4.
The parameters describing the obstacle are , where a, b, c represent the spatial location coordinates of the obstacle and r represents the radius of the ball envelope obstacle.
For an obstacle with a complex shape, it can be enveloped by a single sphere. According to the conclusion of
Section 2, the position configuration coordinates of
q are determined by a series variable of the joint angle, and can be solved by kinematics. Therefore, the coordinates of
q can be expressed as
. Then, the shortest distance between the joint of the robot and the obstacle can be expressed as (13):
where
r1 denotes the radius of the enveloping obstacle sphere and
r2 denotes the thickness of the joint.
For an obstacle with a regular shape, it can be enveloped by a series of spheres whose coordinate parameters are denoted by . The distance between the joint and the nearest sphere is the shortest distance between the joint and the obstacle with a regular shape. In order to make the motion of the robotic arm smooth, the manipulator receives repulsive forces from the two sources, one is the nearest ball, and the other is the ball adjacent to the nearest ball.
On the left side of
Figure 5, ball 2 is closest to the joint, and the robotic arm is subject to the repulsive force of ball 2 and the adjacent ball 1. When the robotic arm moves to the next state, as shown in the right side of
Figure 5, ball 3 is closest to the joint and the robot is subject to the repulsive force of ball 3 and the adjacent ball 2.
The derivative of Equation (13) can lead to Equation (14):
The analytic formula of the gradient of the repulsive potential field can be obtained by substituting Equations (13) and (14) into Equation (10), and it is determined by the series variable of the joint angle. This algorithm has a very high real-time performance because it only needs to calculate the potential field function once per cycle.
3.4. Joint Angle Constraints
Typically, each joint of a robotic arm has angle limitations. To ensure that the joint angles of the robotic arm do not exceed their respective limits during obstacle avoidance, the algorithm proposed in this paper must satisfy the following requirements.
Taking an n-degree-of-freedom robotic arm as an example, we assume that the joint angle limits for each joint of the robotic arm are in the range of [, ].
Solution 1: In the first step of the algorithm, the initial and target positions of the robotic arm can be transformed from Cartesian space to joint space using inverse kinematics. can be assumed to be and can be assumed to be . Due to the existence of multiple solutions in inverse kinematics, it is necessary to select an appropriate solution in this step, ensuring that and .
Solution 2: The algorithm imposes limitations on the magnitude of attraction Fatt and repulsion forces Frep during the computation (such as ). This serves to prevent the joint angles from exceeding the constraint range.
Solution 3: During obstacle avoidance, it is possible that the strong repulsive force from an obstacle may cause one of the joint angles of the robotic arm to exceed the specified limit. In the case depicted in
Figure 7, we can appropriately reduce the repulsive force by adjusting the repulsion coefficient
k. This allows the robotic arm to complete the obstacle avoidance task while ensuring that the joint angles remain within the allowed range.