PERTURB Return robot object with perturbed dynamic parameters ROBOT = PERTURB(ROBOT, P) Return a new robot object in which the dynamic parameters (link mass and inertia) have been perturbed. The perturbation is multiplicative so that values are multiplied by random numbers in the interval (1-P) to (1+P). Useful for investigating the robustness of various model-based control schemes. The name string of the perturbed robot is prefixed by 'P/'.
0001 %PERTURB Return robot object with perturbed dynamic parameters 0002 % 0003 % ROBOT = PERTURB(ROBOT, P) 0004 % 0005 % Return a new robot object in which the dynamic parameters (link mass and 0006 % inertia) have been perturbed. The perturbation is multiplicative so that 0007 % values are multiplied by random numbers in the interval (1-P) to (1+P). 0008 % 0009 % Useful for investigating the robustness of various model-based control 0010 % schemes. 0011 % 0012 % The name string of the perturbed robot is prefixed by 'P/'. 0013 % 0014 0015 % Copyright (C) 1999-2008, by Peter I. Corke 0016 % 0017 % This file is part of The Robotics Toolbox for Matlab (RTB). 0018 % 0019 % RTB is free software: you can redistribute it and/or modify 0020 % it under the terms of the GNU Lesser General Public License as published by 0021 % the Free Software Foundation, either version 3 of the License, or 0022 % (at your option) any later version. 0023 % 0024 % RTB is distributed in the hope that it will be useful, 0025 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0026 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0027 % GNU Lesser General Public License for more details. 0028 % 0029 % You should have received a copy of the GNU Leser General Public License 0030 % along with RTB. If not, see <http://www.gnu.org/licenses/>. 0031 0032 function r2 = perturb(r, p) 0033 0034 if nargin == 1, 0035 p = 0.1; % 10 percent disturb by default 0036 end 0037 0038 0039 for i=1:r.n, 0040 l2{i} = r.link{i}; 0041 s = (2*rand-1)*p + 1; 0042 l2{i}.m = l2{i}.m * s; 0043 s = (2*rand-1)*p + 1; 0044 l2{i}.I = l2{i}.I * s; 0045 end 0046 0047 r2 = robot(r, l2); % clone the robot 0048 r2.name = ['P/' r.name];