RobotPURPOSESimulated robot constructor.
SYNOPSISfunction R=Robot(varargin)
DESCRIPTIONSimulated robot constructor. Defines a simulated robot that is latter on move and, after each motion, delivers the corresponding sensor readings. The sensor readings can be purely simulated or obtained from a log file resulting from a data collection with a real robot. The possible parameters are - Another robot. - A name for the robot plus a cell array with the sensors to be added to the sensor. CROSS-REFERENCE INFORMATIONThis function calls:
SOURCE CODE0001 function R=Robot(varargin) 0002 % Simulated robot constructor. 0003 % 0004 % Defines a simulated robot that is latter on move and, after each motion, 0005 % delivers the corresponding sensor readings. The sensor readings can be 0006 % purely simulated or obtained from a log file resulting from a data 0007 % collection with a real robot. 0008 % 0009 % The possible parameters are 0010 % - Another robot. 0011 % - A name for the robot plus a cell array with the sensors to be 0012 % added to the sensor. 0013 0014 switch nargin 0015 case 1 0016 % Copy constructor 0017 if isa(varargin{1},'Robot') 0018 R=varargin{1}; 0019 else 0020 error('Robot copy constructor used with an non-robot object'); 0021 end 0022 case 2 0023 R.name=varargin{1}; 0024 R.sensors=varargin{2}; 0025 0026 R.nSensors=size(R.sensors,2); 0027 R.time=0; 0028 R.nReadings=min(cellfun(@size,R.sensors)); 0029 0030 R=class(R,'Robot'); 0031 otherwise 0032 error('Wrong number of input arguments in Robot constructor'); 0033 end 0034 0035 0036 |