Solve the deterministic finite-horizon optimal control problem with the iLQG (iterative Linear Quadratic Gaussian) or modified DDP (Differential Dynamic Programming) algorithm. Includes two demos, a linear control-constrained problem and a car-parking problem. For details see
Tassa, Mansard and Todorov, 'Control-Limited Differential Dynamic Programming', ICRA 2014
Yuval (2021). iLQG/DDP trajectory optimization (https://www.mathworks.com/matlabcentral/fileexchange/52069-ilqg-ddp-trajectory-optimization), MATLAB Central File Exchange. Retrieved .
Inspired: Belief Space Motion Planning using iLQG
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
@Mayuran Surendran
I change the part of code to
% dynamics second derivatives
if full_DDP
xu_Jcst = @(xu) finite_difference(xu_dyn, xu);
JJ = finite_difference(xu_Jcst, [x; u]);
JJ = reshape(JJ, [4 6 size(J,2) size(J,3)]);
JJ = 0.5*(JJ + permute(JJ,[1 3 2 4])); %symmetrize
fxx = JJ(:,ix,ix,:);
fxu = JJ(:,ix,iu,:);
fuu = JJ(:,iu,iu,:);
else
[fxx,fxu,fuu] = deal([]);
end
"You only need to update the follow code where you can easily locate it:
% dynamics second derivatives
N_J = size(J);
if full_DDP
xu_Jcst = @(xu) finite_diff(xu_dyn, xu);
JJ = finite_diff(xu_Jcst, [x; u]);
if length(N_J) <= 2
JJ = reshape(JJ,[4 6 N_J(2)]);
else
JJ = reshape(JJ, [4 6 N_J(2) N_J(3)]);
end"
This does not work for me, anybody has the solution to this problem? Thanks.
You only need to update the follow code where you can easily locate it:
% dynamics second derivatives
N_J = size(J);
if full_DDP
xu_Jcst = @(xu) finite_diff(xu_dyn, xu);
JJ = finite_diff(xu_Jcst, [x; u]);
if length(N_J) <= 2
JJ = reshape(JJ,[4 6 N_J(2)]);
else
JJ = reshape(JJ, [4 6 N_J(2) N_J(3)]);
end
I am not able to run the demo_car.m example with full_DDP = true;
Then I get an error on line 151 saying that reshaping needs to preserve size.
I've been trying to figure out what would fix the bug but no luck, anyone else?