Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Error in sym/privsubsasgn (line 1040)
L_tilde2 = builtin('subsasgn',L_tilde,struct('type','()','subs',{varargin}),R_tilde);
%Clean up
clear;
% Load simple robot model
mdl_planar2;
% Code Generator (disable Simulink block generation to speed-up)
CGen = CodeGenerator( p2 );
CGen.genslblock = false;
%Generate symbolic equations
CGen.geneverything;
function tau = friction(l, qd)
% (...)
tau = l.B * abs(l.G) * qd;
if issym(l)
%-----------Original code:-----------------
% tau = tau + l.Tc;
%--------------Bugfix:---------------------
tau = tau + 0.5 * ( sign(qd) + 1 ) * l.Tc(1) + ...
0.5 * ( sign(qd) - 1 ) * l.Tc(2);
elseif qd > 0
tau = tau + l.Tc(1);
elseif qd < 0
tau = tau + l.Tc(2);
end
tau = -abs(l.G) * tau; % friction opposes motion
end % friction()
edit friction %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Torque = FRICTION(ROBOT, QD, j)
%
% Computes torque based on viscous friction and Coulomb friction for the
% joint j.
%
% The torque is computed as:
% tau = G^2*B*qd + abs(Tc)*abs(G);
%
% The viscous friction parameter for each joint j must be stored in the
% variable robot.motors.Viscous, whereas the vector robot.motors.Coulomb
% positive or negative parameters of the Coulomb friction
%
% Author: Arturo Gil. Universidad Miguel Hernandez de Elche.
% email: arturo.gil@umh.es date: 26/06/2012
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 2012, by Arturo Gil Aparicio
%
% This file is part of ARTE (A Robotics Toolbox for Education).
%
% ARTE is free software: you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% ARTE is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU Lesser General Public License for more details.
%
% You should have received a copy of the GNU Leser General Public License
% along with ARTE. If not, see <http://www.gnu.org/licenses/>.
function torque = friction(robot, qd, j)
%torque due to viscous friction
%torque = robot.motors.G(j)^2*robot.motors.Viscous(j)*qd(j);
torque = robot.motors.G(j)*robot.motors.Viscous(j)*qd(j);
%Add torque due to Coulomb friction
if qd(j) > 0
torque = torque + abs(robot.motors.G(j))*robot.motors.Coulomb(j,1);
elseif qd(j) < 0
torque = torque + abs(robot.motors.G(j))*robot.motors.Coulomb(j,2);
end
function tau = friction(l, qd)
%Link.friction Joint friction force
%
% F = L.friction(QD) is the joint friction force/torque for link velocity QD
tau = 0.0;
tau = l.B * qd;
if qd > 0
tau = tau + l.Tc(1);
elseif qd < 0
tau = tau + l.Tc(2);
end
tau = -tau; % friction opposes motion
endfunction % friction()
--
You received this message because you are subscribed to a topic in the Google Groups "Robotics & Machine Vision Toolboxes" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/robotics-tool-box/bt12EoKiZFc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to robotics-tool-...@googlegroups.com.
To post to this group, send email to robotics...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotics-tool-box.
For more options, visit https://groups.google.com/d/optout.