System constraints

Replaces stateConstraint method logic with a list of constraint objects for each DrakeSystem.  These can handled more elegantly (preserving the structure of the constraints, and avoiding function handles) by the optimization classes.  

Taking another crack at finishing and merging this (just had a rough time bringing it back in line w/ master).  

That seemed like the most straightforward (to avoid updating indices, etc).  what do you think?
On Oct 5, 2014, at 7:15 PM, Hongkai Dai <notifications@github.com> wrote:

> In systems/@DrakeSystem/DrakeSystem.m:
> 
> > +      typecheck(con,'Constraint');
> > +      if nargin<3, 
> > +        xind = 1:obj.num_x; 
> > +      else
> > +        assert(all(xind>=1) && all(xind<=obj.num_x));
> > +      end
> > +      assert(con.xdim == length(xind),'DrakeSystem:InvalidStateConstraint','xdim mismatch');
> > +
> > +      obj.state_constraints{end+1} = con;
> > +      obj.state_constraint_xind{end+1} = xind;
> > +      obj.num_xcon_eq = obj.num_xcon_eq + sum(con.lb == con.ub);
> > +      obj.num_xcon_ineq = obj.num_xcon_ineq + sum(con.lb ~= con.ub);
> > +      id = numel(obj.state_constraints);
> > +    end
> > +
> > +    function obj = updateStateConstraint(obj,id,con,xind)
> So if we want to delete a state constraint, we should call updateStateConstraint, replace it with a NullConstraint object?
> 
> —
> Reply to this email directly or view it on GitHub.
>