MatthewPeterKelly / OptimTraj

A trajectory optimization library for Matlab
MIT License
598 stars 207 forks source link

How to add time-varying control bounds #37

Closed Enigma000 closed 4 years ago

Enigma000 commented 4 years ago

How can I add a time-varying control bounds to my problem? Such as the control bounds varies with the state of the system.

MatthewPeterKelly commented 4 years ago

You can add a time-varying control bound to your problem by defining a path constraint function. In the help / documentation it shows up as:

% INPUT: "problem" -- struct with fields:
%
%   func -- struct for user-defined functions, passed as function handles
%
% ...
%       [c, ceq] = pathCst(t,x,u)
%               c = column vector of inequality constraints  ( c <= 0 )
%               ceq = column vector of equality constraints ( c == 0 )

For a bound, you probably want to specify an inequality constraint (c) rather than an equality constraint (ceq).