Analysis of rocket recovery

Recent developments in robotics and artificial intelligence allow us to solve problems that have long been considered difficult or unsolvable. The problem of planetary soft landing is one of the problems of optimal control theory that has recently attracted people's attention again.

This article presents a general approach to developing control systems that can be applied to a wide range of robotic applications, not necessarily rockets. We will walk through all the main steps of the analysis and design of the robotic control system using a rocket similar to the SpaceX Falcon9 as an example.

model assumptions

Let's build a simple rocket model and explore its landing behavior. First we assume there is no air friction. Of course, we can take it into account, however, we will ignore it just to keep the model as simple as possible without sacrificing accuracy.

Also, let's ignore that the rocket mass is not constant. Falcon9 consumes about 200 kg of fuel when it lands. We will simulate the last few seconds of the landing trajectory, so we can consider the mass to be constant.

Finally, let's only consider the dynamics in two dimensions, which means we can assume that the third coordinate requires no control, or in other words, the error along that axis is zero. We can add a third coordinate later. It's not a huge difference, but in 2D it's easier to observe how objects behave.

rocket dynamics

Let's assume that only 3 of the 9 engines in the rocket's first stage are used to control the rocket on the XZ plane. So our thrust will be split into two vectors a and (a + u) at slightly different angles

We add some noise to the equation defined by a random variable γ , where D is the distance between relative engines.

Thus, starting from the initial condition q = (x, ẋ, z, ż, a, ş) and the defined functions Fth(q, t) and u(q, t) , we can simulate the behavior of the rocket. Let's start by finding the rocket thrust function.

rocket thrust

Imagine we considered the opposite problem. The rocket takes off with constant thrust Fth . Its altitude and vertical velocity can be obtained from the following equations:

Therefore, solving backwards, we can easily find the required thrust Fth given the initial conditions z and ż :

Let's simulate and check how it works with initial conditions:
x = 1.5m  ,  ẋ = 0.5 m/s
z = 231m, ż =-50m/s ,
a = 0, ş = 0

The landing failed due to insufficient final horizontal velocity. However, the rocket's vertical velocity is close to zero, which is huge.

Engine Angle Controller

Let's now develop a controller that brings the remaining variables that define the rocket's motion close to zero. In other words, we need to find a function u = u(  x, ẋ, z, ż, a, ş) that will make all trajectories starting from the given initial conditions reach near (0, 0, 0 , 0, 0, 0).

Fortunately, when the rocket angle a is small enough, the equations describing the rocket's motion are almost linear. We can rewrite them after linearization as follows:

Let us now look at the so-called LQR controller, which is a powerful method for finding optimal control of systems that can be described by first-order linear differential equations. ( https://en.wikipedia.org/wiki/Linear%E2%80%93quadratic_regulator )

Linear QR

Since we have already found the controller for z, all we need is to solve for the other two variables x and a . Introducing v =  and w = ş as new variables, we can reduce the order of the differential equation as follows:

Therefore, the equation will look like this:

or

LQR allows us to find in the form u = -K p, where K is a matrix that minimizes a quadratic cost function defined as:

Q and R should be positive definite matrices. In general, for Q and R we can choose diagonal matrices. Let us choose a matrix with diagonal elements [0.5, 10, 1, 1] for Q and an identity matrix of rank 1 for R. We choose a small number for x and a number 20 times larger for ẋ because the deviation of x from zero is not as sensitive to horizontal velocity for a successful landing. In the image below, we can see that an error of 5m in the x-coordinate is not a problem at all.

For example, if using python, you might find the LQR solver in the scipy.linalg library.

You may notice that the real part of any eigenvalue of the matrix (A-BK) is negative, which means that the found control u = -Kq is stable.

Now let's simulate the behavior of the rocket with the found LQR controller:

And the side view of the rocket trajectory and the corresponding engine angle u -function:

in conclusion

In summary, I want to talk about a general approach to developing robot control systems. The first step is always to build the model. Once you have a model, you can use it, changing initial conditions, robot parameters, etc. This analysis can help you understand what the challenges are or where the problems lie.

You can then start designing your controller with an understanding of the type of problem you want to solve. You may end up coming up with different robot designs.

Guess you like

Origin blog.csdn.net/qq_41929396/article/details/132665504