Commit 4d61d33e authored by Sylvain Calinon's avatar Sylvain Calinon

Distinction of finite/infinite horizon in demos

parent 7972af03
...@@ -58,7 +58,7 @@ model = EM_tensorGMM(Data, model); ...@@ -58,7 +58,7 @@ model = EM_tensorGMM(Data, model);
%% Reproduction with LQR for the task parameters used to train the model %% Reproduction with LQR for the task parameters used to train the model
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('Reproductions with LQR...'); disp('Reproductions with finite-horizon LQR...');
DataIn = [1:s(1).nbData] * model.dt; DataIn = [1:s(1).nbData] * model.dt;
for n=1:nbSamples for n=1:nbSamples
%Retrieval of attractor path through task-parameterized GMR %Retrieval of attractor path through task-parameterized GMR
...@@ -69,7 +69,7 @@ end ...@@ -69,7 +69,7 @@ end
%% Reproduction with LQR for new task parameters %% Reproduction with LQR for new task parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('New reproductions with LQR...'); disp('New reproductions with finite-horizon LQR...');
for n=1:nbRepros for n=1:nbRepros
for m=1:model.nbFrames for m=1:model.nbFrames
%Random generation of new task parameters %Random generation of new task parameters
...@@ -143,8 +143,6 @@ for n=1:nbRepros ...@@ -143,8 +143,6 @@ for n=1:nbRepros
end end
axis(limAxes); axis square; set(gca,'xtick',[],'ytick',[]); axis(limAxes); axis square; set(gca,'xtick',[],'ytick',[]);
%print('-dpng','outTest1.png');
%Plot additional information %Plot additional information
figure; figure;
%Plot norm of control commands %Plot norm of control commands
...@@ -168,6 +166,5 @@ plot(r(n).FF(k,:),'b-','linewidth',2); ...@@ -168,6 +166,5 @@ plot(r(n).FF(k,:),'b-','linewidth',2);
legend('ddx feedback','ddx feedforward'); legend('ddx feedback','ddx feedforward');
xlabel('t'); ylabel(['ddx_' num2str(k)]); xlabel('t'); ylabel(['ddx_' num2str(k)]);
%print('-dpng','outTest2.png');
%pause; %pause;
%close all; %close all;
...@@ -58,7 +58,7 @@ model = EM_tensorGMM(Data, model); ...@@ -58,7 +58,7 @@ model = EM_tensorGMM(Data, model);
%% Reproduction with LQR for the task parameters used to train the model %% Reproduction with LQR for the task parameters used to train the model
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('Reproductions with LQR...'); disp('Reproductions with infinite-horizon LQR...');
DataIn = [1:s(1).nbData] * model.dt; DataIn = [1:s(1).nbData] * model.dt;
for n=1:nbSamples for n=1:nbSamples
%Retrieval of attractor path through task-parameterized GMR %Retrieval of attractor path through task-parameterized GMR
...@@ -69,7 +69,7 @@ end ...@@ -69,7 +69,7 @@ end
%% Reproduction with LQR for new task parameters %% Reproduction with LQR for new task parameters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
disp('New reproductions with LQR...'); disp('New reproductions with infinite-horizon LQR...');
for n=1:nbRepros for n=1:nbRepros
for m=1:model.nbFrames for m=1:model.nbFrames
%Random generation of new task parameters %Random generation of new task parameters
...@@ -143,8 +143,6 @@ for n=1:nbRepros ...@@ -143,8 +143,6 @@ for n=1:nbRepros
end end
axis(limAxes); axis square; set(gca,'xtick',[],'ytick',[]); axis(limAxes); axis square; set(gca,'xtick',[],'ytick',[]);
%print('-dpng','outTest1.png');
%Plot additional information %Plot additional information
figure; figure;
%Plot norm of control commands %Plot norm of control commands
...@@ -168,6 +166,5 @@ plot(r(n).FF(k,:),'b-','linewidth',2); ...@@ -168,6 +166,5 @@ plot(r(n).FF(k,:),'b-','linewidth',2);
legend('ddx feedback','ddx feedforward'); legend('ddx feedback','ddx feedforward');
xlabel('t'); ylabel(['ddx_' num2str(k)]); xlabel('t'); ylabel(['ddx_' num2str(k)]);
%print('-dpng','outTest2.png');
%pause; %pause;
%close all; %close all;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment