Trajectory Optimization for The Block-move Example Based on the Direct Single Shooting Method

1. Problem Statement

This simple example is about how to move the block between two fixed points in a fixed amount of time referred to the Ref[1]. In order to simplify this problem, the block moves one unit of distance in one unit of time, and keeps stationary at both two points, shown in Figure 1.

Trajectory Optimization for The Block-move Example Based on the Direct Single Shooting Method

Figure 1. The illustration of the block-move example.
Obviously, it is quite easy to find many solutions that satisfy all of the problem requirements, illustrated in Figure 2. However, how to find the optimal trajectory for this problem?
Trajectory Optimization for The Block-move Example Based on the Direct Single Shooting Method
Figure 2. The feasible trajectories of the block-move…

2. Modelling

In this case, this block is modeled as a point-mass that travels in one dimension. Denote the control input (Force) as uu, Position as xx, Velocity as vv, and the mass of the block is 1. Then, the block-move’s system dynamics can be described as follows
x˙=v(1)\dot{x} = v \tag{1} v˙=u(2)\dot{v} = u \tag{2} As illustrated in Figure 1, the boundary conditions are given as follows
x(0)=0,x(1)=1v(0)=0,v(1)=0(3)x(0) = 0, x(1) = 1 \\ v(0) = 0, v(1) = 0\tag{3} The objective function can be used to mathematically describe the optimal index. In this example, the objective function is chosen as the minimal force squared, expressed as
minu(t),x(t),v(t)01u2(τ)dτ(4)\min _{u(t), x(t), v(t)} \int_{0}^{1} u^{2}(\tau) d \tau\tag{4} As this problem is simple, the full derivation of the analytical solution to the trajectory optimization problem is referred to the Ref[1], given as follows
u(t)=612t,x(t)=3t22t3(5)u^{*}(t)=6-12 t, \quad x^{*}(t)=3 t^{2}-2 t^{3}\tag{5}

3. Optimal Control Theory

Describe the dynamic system by
x˙(t)=f(x,u,t)i(6)\boldsymbol{\dot{x}}(t)=\boldsymbol{f}(\boldsymbol{x},\boldsymbol{u},{t})_i \tag{6} where xRn\boldsymbol{x}\in{R^n} is the state variables, uRm\boldsymbol{u}\in{R^m} is the control input. A general objective function is expressed in Bolza form
J=Ψ[t0,tf,x(t0),x(tf)]Mayer Term +t0tfΓ[τ,x(τ),u(τ)]dτLagrange Term (7)J=\underbrace{\Psi\left[t_{0}, t_{f}, \boldsymbol{x}\left(t_{0}\right), \boldsymbol{x}\left(t_{f}\right)\right]}_{\text {Mayer Term }}+\underbrace{\int_{t_{0}}^{t_{f}} \Gamma[\tau, \boldsymbol{x}(\tau), \boldsymbol{u}(\tau)] d \tau}_{\text {Lagrange Term }}\tag{7} Where the Mayer term is the final weighting function, and depends on the final state; the Lagrange term is the integral function. The block-move example here is in Lagrange Form.

4. Simulation

There are many direct methods to solve the optimal trajectory problem. Here, the direct single shooting method is applied to optimize the block’s trajectory. The simulation results are shown in Figure 3and Figure 4 compared with the analytical solution.
Trajectory Optimization for The Block-move Example Based on the Direct Single Shooting Method

Figure 3. The optimal trajectory for the block-move example.

Trajectory Optimization for The Block-move Example Based on the Direct Single Shooting Method
Figure 4. The optimal force input for the block-move example.

Referrence

[1] Kelly M. An Introduction to Trajectory Optimization: How to Do Your Own Direct Collocation[J]. Siam Review, 2017, 59(4): 849-904.