Skip to content

Commit

Permalink
fixed bad commit. let's try again
Browse files Browse the repository at this point in the history
  • Loading branch information
RussTedrake committed Oct 5, 2014
1 parent f4e9fdc commit 2d1668b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
18 changes: 11 additions & 7 deletions solvers/NullConstraint.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
% this constraint does nothing, but having it is easier that handling the
% possibility of empty matrices in lists of constraints

function obj = NullConstraint(xdim)
obj = obj@Constraint([],[],xdim,inf);
methods
function obj = NullConstraint(xdim)
obj = obj@Constraint([],[],xdim,inf);
end
end

function varargout = constraintEval(obj,x)
varargout = cell(1,nargout);
% outputs are intentionally left empty

methods (Access = protected)
function varargout = constraintEval(obj,varargin)
varargout = cell(1,nargout);
% outputs are intentionally left empty
end
end
end
end
16 changes: 8 additions & 8 deletions systems/plants/@RigidBodyManipulator/RigidBodyManipulator.m
Original file line number Diff line number Diff line change
Expand Up @@ -745,14 +745,14 @@
if (model.num_contact_pairs>0)
nonpenetration_constraint = FunctionHandleConstraint(zeros(model.num_contact_pairs,1),inf(model.num_contact_pairs,1),model.getNumPositions,@nonpenetrationConstraint,2);
nonpenetration_constraint = nonpenetration_constraint.setName(cellstr(num2str([idxA;idxB]','non-penetration: body %d <-> body %d')));
else
nonpenetration_constraint = NullConstraint(model.getNumPositions);
end
if isempty(model.contact_constraint_id)
[model,id] = addStateConstraint(model,nonpenetration_constraint,1:model.getNumPositions);
model.contact_constraint_id = id;
else
model = updateStateConstraint(model,model.contact_constraint_id,nonpenetration_constraint,1:model.getNumPositions);
if isempty(model.contact_constraint_id)
[model,id] = addStateConstraint(model,nonpenetration_constraint,1:model.getNumPositions);
model.contact_constraint_id = id;
else
model = updateStateConstraint(model,model.contact_constraint_id,nonpenetration_constraint,1:model.getNumPositions);
end
elseif ~isempty(model.contact_constraint_id)
model = updateStateConstraint(model,model.contact_constraint_id,NullConstraint(model.getNumPositions),1:model.getNumPositions);
end

for j=1:length(model.loop)
Expand Down
4 changes: 2 additions & 2 deletions systems/plants/test/contactSensorTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

[ytraj,xtraj] = simulate(p,[0 T]);

v = p.constructVisualizer();
v.playback(ytraj,struct('slider',true));
%v = p.constructVisualizer();
%v.playback(ytraj,struct('slider',true));

% should find initial conditions for the brick which are resting on the
% ground.
Expand Down

0 comments on commit 2d1668b

Please sign in to comment.