Skip to content

Commit

Permalink
Fixed compile time bug and also made it so you can set all the target…
Browse files Browse the repository at this point in the history
…s at once.
  • Loading branch information
davisking committed May 30, 2015
1 parent c4e4cd0 commit c9d60d9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dlib/control/mpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ namespace dlib
matrix<double,S,S> temp = diagm(Q);
for (unsigned long c = 0; c < horizon; ++c)
{
lambda += trans(B)*temp*B;
lambda += trace(trans(B)*temp*B);
temp = trans(A)*temp*A + diagm(Q);
}

Expand Down Expand Up @@ -153,6 +153,14 @@ namespace dlib
target[time] = val;
}

void set_target (
const matrix<double,S,1>& val
)
{
for (unsigned long i = 0; i < horizon; ++i)
target[i] = val;
}

void set_last_target (
const matrix<double,S,1>& val
)
Expand Down
9 changes: 9 additions & 0 deletions dlib/control/mpc_abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,15 @@ namespace dlib
- #get_target(time) == val
!*/

void set_target (
const matrix<double,S,1>& val
);
/*!
ensures
- for all valid t:
- #get_target(t) == val
!*/

void set_last_target (
const matrix<double,S,1>& val
);
Expand Down

0 comments on commit c9d60d9

Please sign in to comment.