Home > src > BN_pol_rec > Hsand > initializeEnemy.m

initializeEnemy

PURPOSE ^

INITIALIZEENEMY - set the initial values of enemy data structures

SYNOPSIS ^

function [struct_enemy_comp, noOfEnemyCompanies] = initializeEnemy;

DESCRIPTION ^

 INITIALIZEENEMY - set the initial values of enemy data structures
 
 20041221- RJ - added variable max_speed
 20041209- RJ - removed radius field in target struct, added particles instead
 0503 -R2/S/J- initialize stucts that are used to represent
 dynamic data about enemy units 
 0517 - RJ - changed max_vel field to max_speed
 0520 - RJ - lowered max_speed to 2
 0521 - RJ - some small changes to enemy properties
 20050105 - RJ - added field particles
 2005-01-25 - RJ - added field obs_pos
 2005-02-09 - RJ - added printed output

 E.g. struct_enemy_comp(1).plt(3).est_pos returns estimate of position of 
 platoon three that belongs to compani one

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [struct_enemy_comp, noOfEnemyCompanies] = initializeEnemy;
0002 % INITIALIZEENEMY - set the initial values of enemy data structures
0003 %
0004 % 20041221- RJ - added variable max_speed
0005 % 20041209- RJ - removed radius field in target struct, added particles instead
0006 % 0503 -R2/S/J- initialize stucts that are used to represent
0007 % dynamic data about enemy units
0008 % 0517 - RJ - changed max_vel field to max_speed
0009 % 0520 - RJ - lowered max_speed to 2
0010 % 0521 - RJ - some small changes to enemy properties
0011 % 20050105 - RJ - added field particles
0012 % 2005-01-25 - RJ - added field obs_pos
0013 % 2005-02-09 - RJ - added printed output
0014 %
0015 % E.g. struct_enemy_comp(1).plt(3).est_pos returns estimate of position of
0016 % platoon three that belongs to compani one
0017 global verbose;
0018 global simulationTime;
0019 noOfEnemyCompanies = 3;
0020 max_speed = 5;
0021 
0022 
0023 global noOfParticles;
0024 noOfParticles = 30;
0025 noOfStateAttributes = 4;
0026 defaultParticles = zeros( noOfParticles, noOfStateAttributes ); % not in use, use initParticles() instead.
0027 
0028 % target struct
0029 % field: id - platoon name (string)
0030 % field: obs_time - time stamp for latest observation
0031 % field: radius - position uncertainty radius (not used anymore)
0032 % field: particles - a MxN matrix of particles (for particle filter tracking) (M particles and N attributes)
0033 % field: obs_pos - latest observed position
0034 % field: est_pos - latest estimated position (based on particle filter estimation)
0035 % field: real_pos - the real position of the target
0036 % field: velocity - the real velocity of the target
0037 % field: est_vel - the estimated velocity
0038 
0039 %change: field: est_vel put to FIVE instead of two
0040 platoon = struct('id',{}, 'obs_time',{},'particles',{},'obs_pos', {}, 'est_pos',{}, ...
0041          'real_pos',{},'velocity',{},'est_vel', {}, 'max_speed', ...
0042          {});
0043 struct_enemy_comp = struct('id',{},'plt', {});
0044 
0045 % for each company
0046 for comp_id = 1:noOfEnemyCompanies
0047 
0048   pos_new = getGround_TruthPos(comp_id);
0049 
0050   platoon(1) = struct('id',['cmp' num2str(comp_id) '.plt1'], ...
0051             'obs_time',simulationTime,'particles', ...
0052               initParticles( noOfParticles, ...
0053                      noOfStateAttributes, cog( pos_new(1:3,:)), max_speed ), 'obs_pos', cog(pos_new(1:3,:)),'est_pos',pos_new(1:3,:),'real_pos',pos_new(1:3,:),'velocity',zeros(3,2), 'est_vel', zeros(3,2), 'max_speed', max_speed); 
0054 
0055   platoon(2) = struct('id',['cmp' num2str(comp_id) '.plt2'], ...
0056             'obs_time',simulationTime,'particles', ...
0057               initParticles( noOfParticles, noOfStateAttributes, ...
0058                      cog( pos_new(4:6,:)), max_speed ), 'obs_pos', cog(pos_new(4:6,:)), 'est_pos',pos_new(4:6,:),'real_pos',pos_new(4:6,:),'velocity',zeros(3,2),'est_vel', zeros(3,2), 'max_speed', max_speed); 
0059   
0060   platoon(3) = struct('id',['cmp' num2str(comp_id) '.plt3'], ...
0061             'obs_time',simulationTime,'particles', ...
0062               initParticles( noOfParticles, noOfStateAttributes, ...
0063                      cog( pos_new(7:9,:)), max_speed ), 'obs_pos', cog(pos_new(7:9,:)), 'est_pos',pos_new(7:9,:),'real_pos',pos_new(7:9,:),'velocity',zeros(3,2),'est_vel', zeros(3,2), 'max_speed', max_speed); 
0064 
0065   struct_enemy_comp(comp_id) = struct('id',['cmp' num2str(comp_id)],'plt', ...
0066                       platoon);
0067   
0068 end;
0069 
0070 if verbose
0071   disp('Initialize Enemy: Begin')
0072   noOfEnemyCompanies
0073   max_speed
0074   noOfParticles
0075   disp('Initialize Enemy: End')
0076 end

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