Is there a way to solve this problem with a neural network?

4 views (last 30 days)
Hello,
I want to preface this by stating that my knowledge of neural networks is not that large yet. I have looked through a number of resources on this topic, but I am still confused. Currently, I am trying to use a neural network to implement an optimal trajectory planner for a simple 2D linear point-mass 2nd-order system given initial and terminal conditions of the state, . This point-mass system is guided by a control law, , that guides the system to its terminal state, . The code below shows this simulated action in effect:
clc, clear all, close all
%% Initialization
% Initial State
xo1 = [0;0]; % Initial Position
xo2 = [1;1]; % Initial Velocity
xo = [xo1;xo2];
% Terminal State
z = [2;1]; % Terminal Position
vd = [2;2]; % Terminal Velocity
xf = [z;vd];
[t, x] = ode45(@(t,x) EqnMtn(x,xf,t), [0 1], xo);
function dx = EqnMtn(x, xf, t) % Equations of Motion
%% Parsing State Vector
x1 = x(1:2);
x2 = x(3:4);
%% Parsing Terminal State Vector
z = xf(1:2);
vd = xf(3:4);
%% Deriving Time-to-Go
tgo = 1.0001 - t;
%% Gain Tuning
n = 0; % Trajectory Tuning Parameter
k1 = (n+2) * (n+3);
k2 = -(n+1) * (n+2);
%% Output of Acceleration Command
control_term1 = (k1/tgo^2) * (z - x1 - tgo*x2);
control_term2 = (k2/tgo) * (vd - x2);
uu = control_term1 + control_term2; % u(t)
%% Derivatives
dx1 = x2;
dx2 = uu;
dx = [
dx1
dx2
];
return;
end
For the implementation of a neural network, I would hope to input both a given input, (1x4 vector), and terminal state, (1x4 vector), to the neural network and have it output a state trajectory for the point mass to get to its terminal state, x(1:2), and its velocity trajectory, x(3:4). I theorized that the neural net should be trained on five seperate optimal trajectories with different terminal positions and use a seperate trajectory for validation, . I believe that the training and validation data for the network should look something like this:
%% Parsing Training and Validation Data
% Inputs
xo_train = [x1(1,:),x2(1,:),x4(1,:),x5(1,:),x6(1,:)]; % Initial State Vectors
xf_train = [xf1,xf2,xf4,xf5,xf6]; % Terminal State Vectors
% Outputs
x_train = [x1(:,1:2);x2(:,1:2);x4(:,1:2);x5(:,1:2);x6(:,1:2)]; % Position State Trajectories
dx_train = [x1(:,3:4);x2(:,3:4);x4(:,3:4);x5(:,3:4);x6(:,3:4)]; % Velocity State Trajectories
% Validation Data
xo_valid = x3(1,:);
xf_valid = xf3;
x_valid = x3(:,1:2);
dx_valid = x3(:,3:4);
Also, I would like to train the data on a custom loss function which is described by:
where, are estimates of the optimal guidance trajectory at each time step.
At this point, this is where I am stuck since I do not know which neural network architecture to use to solve this problem. I believe that a feedforward network of some kind would help, but I am not even sure how to go about constructing it. Any advice on where to go from here would be greatly appreciated. Thanks in advance.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!