Home > src > Bridge > service_management > get_observations.m

get_observations

PURPOSE ^

GET_OBSERVATIONS - check if the services detect

SYNOPSIS ^

function observations = get_observations( services, sensors, targets, allocs )

DESCRIPTION ^

 GET_OBSERVATIONS - check if the services detect
      anything and if so update the knowledge of the system

 GET_OBSERVATIONS( SERVICES, SENSORS, TARGETS )


 AUTHOR  Ronnie Johansson
 CREATED 2004-12-02
 ALTERED 2004-12-10 - minor correction
 ALTERED 2004-12-17 - minor correction
 ALTERED 2004-12-20 - minor changes
 ALTERED 2004-12-21 - randomized calculation of observed_position

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function observations = get_observations( services, sensors, targets, allocs )
0002 % GET_OBSERVATIONS - check if the services detect
0003 %      anything and if so update the knowledge of the system
0004 %
0005 % GET_OBSERVATIONS( SERVICES, SENSORS, TARGETS )
0006 %
0007 %
0008 % AUTHOR  Ronnie Johansson
0009 % CREATED 2004-12-02
0010 % ALTERED 2004-12-10 - minor correction
0011 % ALTERED 2004-12-17 - minor correction
0012 % ALTERED 2004-12-20 - minor changes
0013 % ALTERED 2004-12-21 - randomized calculation of observed_position
0014 
0015 observations = struct('sensor_id', {}, 'target_id', {}, 'data_format', {}, 'data', {}, 'accuracy', {});
0016 
0017 noOfSensors = length( sensors );
0018 noOfTargets = length( targets );
0019 
0020 % for each sensor check if it detects any of the targets
0021 
0022 for s=1:noOfSensors 
0023   sensor = sensors( s );
0024   service = services( find_sensor_services( sensor, services ) );
0025   
0026   for t=1:noOfTargets
0027     plts = targets( t ).plt;
0028     noOfPlts = length(plts);
0029     
0030     for p=1:noOfPlts
0031       detection_degree = feval(sensor.detection_model, sensor, plts(p));
0032       if ( detection_degree == 1 ) % the certainty in a detection
0033     % I.e., target t has been detected by sensor s
0034         disp(['Observation occurred for sensor: ' sensor.id ' of enemy platoon: ' plts(p).id]);
0035         % real observation noise
0036         noise = rand(1,2)*service.quality.accuracy;
0037         observed_position = cog( plts(p).real_pos ) + noise;
0038 
0039     observations( end+1 ) = struct('sensor_id', sensor.id, 'target_id', plts(p).id, 'data_format', 'position', 'data', observed_position, 'accuracy', service.quality.accuracy);
0040       end
0041     end
0042   end
0043 end
0044 
0045 
0046

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