Adaptive Safe Distance Prediction Using MPC for Bridge Cranes Considering Anti-Swing in Dynamic Environment

—In dynamic environment, the suddenly appeared human or other moving obstacles can affect the safety of the bridge crane. For such dangerous situation, the bridge crane must predict potential collisions between the payload and the obstacle, keep safe distance while the swing of the payload must be considered in the mean time. Therefore, the safe distance is not a constant value, which must be adaptive to the relative speed of the bridge crane. However, as far as we know, the mathematical model between the safe distance and the relative speed of the bridge crane has never been fully discussed. In this paper, we propose a safe distance prediction method using model prediction control (MPC), which can make sure that the crane can stop before the obstacle, and avoid possible collisions, while the relative speed and anti-swing are both considered. The experimental results prove the effectiveness of our idea.


I. INTRODUCTION
W ITH the rapid development of industry, the demand for bridge crane is increasing in the process of industrial manufacture, such that the safety problem of crane within human co-existence environment has attracted wide attention of related industries. To detect the static and moving obstacles is not a difficult problem since the laser and vision sensors can be employed, but the safe control of the crane is complex and difficult since the load is not directly controlled by the motor, yet pulled by a steel rope connected to the trolley moving on the girder. Because of this special physical structure, the design of high performance controllers [1] - [4] of crane systems is very difficult and challenging. To meet the safety standard, the crane must stop quickly, and keep the swing angle of the load in a small range, which means anti-swing with non-zero initial velocity for safe braking must be considered. Previous methods employ human experiences as references to achieve  a better emergency stop performance for safety design of overhead cranes [19] - [21], which have not considered the safety distance prediction and anti-swing control with nonzero initial velocity.
The non-zero initial velocity state for braking can introduce strong residual vibrations of the load when the emergency stop is required. Although many works have been proposed to solve the stable control problem of the overhead crane, most of them assume the crane has zero initial velocity state, e.g., PID control [6], fuzzy control [7], [8], optimal control [9], sliding-mode control [10] - [12], model predictive control [13], [14], command shaping control [15] - [17]. To tackle non-zero initial velocity issue, Joaquim Maria Veciana et al. designed control inputs by measuring the initial states using a feedback sensor and introducing an appropriate processing time delay in [5]. Although this method can minimize the residual oscillation at the final stop, it can still cause a large load swing during the emergency stop. To solve the anti-swing problem, a new swing elimination tracking control approach in [22] is proposed which can achieve smooth transferring of payloads in a zero initial state. However, this method can not guarantee the expected swing constraints. In [23], a minimumtime motion online planning (MTMOLP) method is proposed for under-actuated overhead crane systems by considering both safety and physical constraints. Fang and Sun [24] convert the swing constraint into the control input constraint, such that the anti-swing becomes an optimization problem. However, these anti-swing methods only consider the situation that the load has zero initial velocity state.
In this paper, we propose an adaptive safe distance prediction method considering the anti-swing with non-zero velocity state, which includes two parts: First we propose a MPC based control scheme to stop the moving load in a short period while the swing angle is constrained in a small range. The MPC algorithm is used for planning a velocity trajectory, which make the load stop quickly and stably. Second, the safe distance is predicted according to the performance of the MPC and the relative velocity between the load and the obstacles. The mathematical model of the safe distance prediction function is derived by a statistical data analysis method. In this way, we can obtain the safe braking distance online in real time according to the relative velocity between the load and the obstacles, such that the crane can predict the possible collisions, and make control decisions in advance according to the situation of the dynamic environment. The contributions of this paper can be summarized as follows: (1) We are the first to propose an online safe distance prediction method for the overhead crane considering both the anti-swing and relative velocity between the load and obstacles.
(2) We propose a MPC based anti-swing method for crane with a non-zero initial velocity state, which can make sure the swing angle is kept in an expected range during braking.
(3) The statistical model of the safe distance prediction function is derived by analyzing the anti-swing performance of the MPC, which can be used to calculate the safe distance online, such that the possible collisions can be evaluated in advance.
The rest of the paper is organized as follows: Section II presents crane dynamic system and model transformations. Section III gives the details of the MPC controller design for anti-swing with non-zero initial velocity state. In section IV , the safe distance evaluation function is derived by a statistical analysis method. Then the simulation of the proposed idea is demonstrated and discussed in section V . Finally, the conclusion is given in section V I.

II. SYSTEM DESCRIPTION
This section describes the dynamic system of the overhead gantry crane as shown in Fig.1, which has a point mass and the cable has no bending moment and elasticity. The displacement and speed of the car, the swing angle of the load and the angular acceleration can be calculated by the control input and the dynamic equation. The two-dimensional dynamic characteristics of the bridge crane are described as follows [24]: where M and x represent the mass and moving distance of the trolley, m and θ denote the mass and swing angle of the load, l is the length of the massless rope, F is the force acting on the trolley, g is the gravity acceleration, respectively. The force F can be regarded as the system control input.
For safe braking distance with non-zero initial velocity state, we care about the velocity and swing angle, so we de define the state vector as x m (t) = [ θ vθ ] T , where v andθ are the linear speed and angular speed of the trolley respectively. According to (1) and (2) , we can simplify them to the following two equations:
According to equations (5) and (6), we can derive the state space expression of the system as follows:

C. Discrete system
By discretizing (7) and (8) which is the spatial state expression in the continuous temporal domain, we can obtain discrete state space equations as Furthermore, the future state variables can be expressed as follows: 10) where N p represents the prediction time domain, and N c represents the control time domain which is not larger than N p. The sampling time is expressed in terms of k i . When the information x m (k i ) is given, the future state variables can be predicted from time k i + 1 until time k i + N p . We can further write (10) as a compact matrix form as In this section, we propose a MPC based control method to stop a moving crane. The speed trajectory is designed according to different initial speed, such that the final speed is zero. The crane load can track the given speed trajectory and finally achieve a stable stop state, while the swing angle is constricted to a certain small range.

A. Online velocity trajectory modification
We introduce the velocity trajectory to control the moving load with non-zero initial speed, which is defined as where λ > 0 represents the convergence time factor, T is the sampling period, and represents the initial state of the crane, where v(t 0 ) represents the initial velocity, and the other two elements represent the initial angle and angular velocity. Based on (11) and (12), the tracking objective R v (k i ) of Y at k i can be represented as

B. Optimal solution
Our goal is to minimize the difference between the real velocity trajectory Y and velocity reference trajectory R v , so we can define cost function as We can substitute (11) and (13) into (14), and leave the polynomial with the variable U to be optimized. The cost function becomes where Q ∈ R 3Np×3Np denotes the weight coefficients of the three state variables.
Considering the existence of upper and lower limits of the input force and swing angle constraints, the control input boundary inequality is introduced as where maximum acceleration is defined as a max = √ lg T θ max − θ 2 (0) + l gθ 2 (0) according to [24]. where θ max is the maximum swing angle that we defined, and θ(0) andθ(0) denote the initial values of θ(t) andθ(t). For each control period, the initial values are equal to the final values of the previous control period.
The Lagrangian function associated with the optimization problem (16) , (17) and (18) is defined as where u 1 and u 2 are Lagrange multipliers of constraints (17), u 3 and u 4 are Lagrange multipliers of constraints (18) . The corresponding Karush-Kunh-Tucker conditions (KKT) are given by +µ 1, * − µ 2, * + µ 3, * − µ 4, * 0 ≤ µ 1, * , µ 2, * , µ 3, * , µ 4, * , We can derive the first value of optimal solution in the predicted time domain to ensure θ ≤ θ max . which is the input driving force of this period. With this driving force, we can further get the state of the crane. If the velocity of the crane is zero, then this displacement of the crane is the safe braking distance denoted as x d (v 0 ). Otherwise, the crane controller will accept next input force command to decrease the velocity.

IV. SAFE DISTANCE PREDICTION
In this section, we propose to use an off-line data learning method to model the relationship function between initial velocity and safe braking distance. This model can help to calculate the safe distance online according to the current velocity of the crane.  Fig. 2: The main algorithm structure of our method. The velocity reference trajectory is designed based on the given non-zero initial velocity state, and then the optimal control solution U of the next 20T cycles is predicted using the MPC algorithm. The first solution u is taken as the input of the controller of the crane in the next cycle, then we read the status of the next cycle to determine whether the load speed is zero. If it is zero, the final displacement is chosen as the safe braking distance X d at speed v 0 . If it is not zero, the controller continues to run.

A. Off-line learning
Based on the (19) and (20), we can get a safe braking distance according to the initial velocity of the crane. In this section, we want to find a statistical model between these two physical quantity. Firstly, we use the control scheme in Section III to record the safe braking distance at different velocity. Finally we get a group of measured safe braking distance related to different initial velocity. To construct a analytical function f (v) for safe braking distance, a least square polynomial curve fitting method is used, which can be seen in Fig.6.

B. Online calculation of safe braking distance
After the off-line learning in the determined system, the real time velocity information v of the crane is read for calculation of safe braking distance using the analytical function We show how the safe braking distance changes according to the velocity of the crane in Fig.3, where the load of the crane has length L, width w and height h,. We also use an expansion coefficient K to expand the size of the load, such that the safety of the crane is increased. The minimum safe braking distance in front of the crane is defined as which is depicted as orange color in Fig. 3. If the obstacle is inside of this orange area, a collision can happen. Therefore, the crane must predict such situation and take the brake decision according to its velocity and the distance to the obstacle. When the distance reaches the safe braking distance, the crane must stop using the proposed method.

V. SIMULATION RESULTS
To verify the effectiveness of the proposed idea, we here first introduce the MPC based control method, then discuss the The safe braking distance is changing according to the velocity of the crane, which is calculated online using our statistical model. Here we also expand the area of the load using an expansion coefficient. When the relative distance to the obstacle reaches the safe braking distance, the crane takes brake decision to stop before the obstacle, such that safety is ensured.
off-line learning of safe braking distance, and show how the on-line safe distance prediction can be used for safe running of the crane. We carry out simulation experiments using crane parameters as m = 4000kg, M = 20kg, l = 4m, g = 9.8m/s 2 and T = 0.05s.

A. MPC control with Anti-swing
We first show how MPC based anti-swing control can be used for crane to reach target position. As shown in [13], a reference trajectory can be generated by . The crane is controlled to follow this reference trajectory by the optimal driving force while the swing angle is constrained within desired range. The Fig.4 is the simulated results to  control a crane to reach the target position y d = 20m, which can be seen that the maximum swing angle is controlled to be constrained within 0.01rad. The maximum driving force does not exceed 150N , which means that the control scheme meets the input saturation conditions.

B. Off-line learning for safe braking distance estimation
The statistical relation between the safe braking distance and the initial velocity is estimated by a curving fitting method in an off-line manner as shown in Fig.5. We calculate the optimal safe braking distance for each initial velocity as following. A variable k ≤ 50 is used to control the sample step of the velocity. The initial velocity is equal to 0.01k. Therefore, we finally get 50 initial velocities with its corresponding safe braking distances as shown in Fig.6 which are labelled as asterisk points. Next, we run a least square curve fitting method to find the statistical relation between the safe braking distance and initial velocity. The final curve is shown in red in Fig.6. The function expression is x d = 15.2x 3 -4.3x 2 +3.7x. According to the same method, we get the fitting curve in the Here we calculated 50 velocity samples from 0m/s to 0.5m/s as shown in black asterisk points. The fitted curve function is estimated using a least square method as shown in red curve.
case of m = 40kg as shown in Fig.7. The function expression is x d = 3.5x.

C. Online safe distance prediction and collision avoidance
In this section, we simulate a collision scenario between the crane and an obstacle which is located at 15m ahead of the crane. A heavy load with mass 4000kg and a light load with mass 40kg are used separately to demonstrate the performance of the proposed algorithm as shown in Fig.8 and Fig.10 respectively, where the dark red is the expansion part of the load, and the shallow red part is the safe braking distance. We can seen that the safe braking distance is increasing as the velocity is increasing while the swing angle is controlled within a small range. For the heavy load, its size is l = 4m, w = 1m, h = 1m with an expansion coefficient K = 0.8. The crane continuously calculates its safe braking distance, and finds a possible collision at time t = 52.35s with corresponding speed 0.41m/s,then our MPC based braking control is taken to decrease its speed until Here we calculated 50 velocity samples from 0m/s to 0.5m/s as shown in black asterisk points. The fitted curve function is estimated using a least square method as shown in red curve.
Fig. 8: This figure shows our online safe braking distance prediction for a heavy load with mass 4000kg. A human as an obstacle stands at x = 15m ahead of the crane. The purple area is the area of the load, the yellow area is the expansion area of the load, and the shallow red area is the safe braking distance which is changing according to the online velocity of the load. When the distance to the obstacle is less than the safe braking distance, the crane starts to decrease its speed until stop using the proposed anti-swing MPC method, such that the swing angle is constrained within a small range as shown in Fig.9.
stop at x = 13.69m while the maximum swing angle is less than 0.01rad as shown in Fig.9. For the light load, its physical size is l = 1m, w = 1m, h = 1 with an expansion coefficient K = 0.8. The crane takes the brake decision at time t = 4.3s with the speed 2.78m/s. Finally, the crane , swing angle (c) and braking distance (d) of the heavy load crane when the obstacle is inside of the safe braking distance. The obstacle is at 15m ahead of the crane. The load has the maximum speed 0.41m/s before taking the brake decision and stops at 13.69m after braking, while the maximum swing angle is less than 0.01rad using our MPC method.
Fig. 10: This figure shows our online safe braking distance prediction for a light load with mass 40kg. A human as an obstacle stands at x = 15m ahead of the crane. The purple area is the area of the load, the yellow area is the expansion area of the load, and the shallow red area is the safe braking distance which is changing according to the online velocity of the load. When the distance to the obstacle is less than the safe braking distance, the crane starts to decrease its speed until stop using the proposed anti-swing MPC method, such that the swing angle is constrained within a small range as shown in Fig.11.
stops at x = 14.12m while its maximum swing angle is less than 0.12rad as shown in Fig.11. , swing angle (c) and braking distance (d) of the light load crane when the obstacle is inside of the safe braking distance. The obstacle is at 15m ahead of the crane. The load has the maximum speed 2.78m/s before taking the brake decision and stops at 14.12m after braking, while the maximum swing angle is less than 0.12rad using our MPC method.

VI. CONCLUSION
To handle with the safe problem of the bridge crane in the dynamic environment, e.g., human co-existence environment, we here propose an online safe braking distance prediction method to avoid potential collisions, while the anti-swing is considered based on MPC control. As far as we know, this is the first work to estimate safe braking distance according to the online velocity of the crane. The MPC based anti-swing method is proposed to control the crane to follow a predefined velocity trajectory, such that the safe braking distance can be estimated given an initial velocity. We then use an offline statistical learning method to model the mathematical relation between the safe braking distance and the velocity of the crane. In this way, we can predict whether a possible collision can happen according to the relative velocity between the crane and the obstacles. The simulated results prove that the proposed idea in this paper can be very useful to avoid collision and protect human considering anti-swing. In future, we would like to demonstrate our method on a real bridge crane.