Home > src > BN_pol_rec > Hsand > initializeSensors.m

initializeSensors

PURPOSE ^

INITIALIZESENSORS - initialize sensors

SYNOPSIS ^

function [sensor, noOfSensors] = initializeSensors(varargin);

DESCRIPTION ^

 INITIALIZESENSORS - initialize sensors

 0504 -RS- initializes stucts that are used to represent sensors
 0511 -RJ- changes to the structure of the sensor struct (e.g.,
           added field home_base)
 0520 -RJ- changed initial time_to_target from 0 to NaN
 0527 -RJ- removed unnecessary code line, and added
           detection_model
 0529 -RJ- added support for alternative sensordata files
 2004-12-20 - RJ - changed some comments and added 'plan' field to
                   sensor struct
 2005-01-19 - RJ - changed field plan to sensor_plan
 2005-02-09 - RJ - added print output

------------------------load sensorData----------------------------

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [sensor, noOfSensors] = initializeSensors(varargin);
0002 % INITIALIZESENSORS - initialize sensors
0003 %
0004 % 0504 -RS- initializes stucts that are used to represent sensors
0005 % 0511 -RJ- changes to the structure of the sensor struct (e.g.,
0006 %           added field home_base)
0007 % 0520 -RJ- changed initial time_to_target from 0 to NaN
0008 % 0527 -RJ- removed unnecessary code line, and added
0009 %           detection_model
0010 % 0529 -RJ- added support for alternative sensordata files
0011 % 2004-12-20 - RJ - changed some comments and added 'plan' field to
0012 %                   sensor struct
0013 % 2005-01-19 - RJ - changed field plan to sensor_plan
0014 % 2005-02-09 - RJ - added print output
0015 %
0016 %------------------------load sensorData----------------------------
0017 
0018 if nargin == 0
0019   load sensorData; 
0020 elseif nargin == 1
0021   if isa(varargin{1}, 'char') == 1
0022    load(varargin{1});
0023   else
0024    error('Please supply a sensor data filename')
0025   end
0026 else
0027   error('Too many input arguments!');
0028 end
0029 % UAV_Mx = [pos_UAV1; .. ; pos_UAVn]; Marc_Mx = [Marc_1; .., Marc_n];
0030 
0031 % SENSOR STRUCT
0032 % id - sensor name (string)
0033 % type - sensor type (string)
0034 % available - available resource or not
0035 % pos - the current position of the sensor (1x2 numeric)
0036 % max_speed - maximum allowed speed for this sensor platform
0037 % cost - the cost of using the sensor per timestep
0038 % time_to_target - the number of timesteps until detection
0039 %                  (obsolete)
0040 % target_id - the name of the target the sensor is looking for
0041 %             (should be unnecessary and managed by service)
0042 %             (string)
0043 % home_base - the position of the home base of the sensors (2x1
0044 %             numeric)
0045 % detection_model - to apply to check if a sensor can detect a
0046 %                   target
0047 % range - (momentanous) detection range of the
0048 %                sensor; beyond this range the service is
0049 %                not expected to detect anything
0050 % sensor_plan - the plan of a sensor; is sensor dependent (for a UAV this
0051 %        may be a matrix of planned observation points)
0052 %-------------------------------------------------------------------
0053 
0054 [noOfUAVs dummy] = size(UAV_Mx);
0055 [noOfMarcus dymmy] = size(Marc_Mx);
0056 uav_detection_model = @uav_detection_func;
0057 markus_detection_model = @markus_detection_func;
0058 
0059 UAV_range = 25;
0060 Markus_range = 10;
0061 
0062 sensor = struct('id',{}, 'type', {}, 'available',{},'pos',{}, ...
0063         'max_speed',{},'cost',{}, 'time_to_target', {}, ...
0064         'target_id',{}, 'home_base', {}, 'detection_model', ...
0065         {}, 'range', {}, 'sensor_plan', {});
0066 for UAV_id = 1:noOfUAVs
0067     sensor(UAV_id) = struct('id',['UAV' num2str(UAV_id)], 'type', ...
0068                 'UAV', 'available',1,'pos', ...
0069                 UAV_Mx(UAV_id,:),'max_speed', ...
0070                 20,'cost', UAV_cost , 'time_to_target', ...
0071                 nan, 'target_id',['none'], 'home_base', ...
0072                 UAV_Mx(UAV_id,:), 'detection_model', ...
0073                 uav_detection_model, 'range', UAV_range, ...
0074                             'sensor_plan', []);
0075 end;
0076 
0077 for Marc_id = 1:noOfMarcus
0078     sensor(Marc_id + noOfUAVs) = struct('id',['Markus' num2str(Marc_id)], ...
0079                     'type', 'Markus', ...
0080                     'available',1,'pos', ...
0081                     Marc_Mx(Marc_id,:),'max_speed', ...
0082                     1,'cost', Marc_cost , ...
0083                     'time_to_target', nan, ...
0084                     'target_id',['none'], ...
0085                     'home_base', Marc_Mx(Marc_id,:), ...
0086                                         'detection_model', ...
0087                                         markus_detection_model, 'range', Markus_range, 'sensor_plan', []);
0088 end;
0089 
0090 noOfSensors = noOfUAVs + noOfMarcus;
0091 
0092 global verbose
0093 if verbose
0094   noOfSensors
0095   UAV_range
0096   uav_detection_model
0097   Markus_range
0098   markus_detection_model
0099 end
0100 
0101

Generated on Wed 16-Mar-2005 09:17:47 by m2html © 2003