STK Aviation Simulation (4) Sensors

1. Add sensors to the aircraft

Open MATLAB and run the following script to create the scene and aircraft:

%打开一个STK应用实例
uiapp = actxserver('STK10.application');
%获取STK用户界面
root = uiapp.Personality2;
%显示界面
uiapp.visible = 1;  
%创建一个新场景并设定时区
root.NewScenario('open_STK');  
%设置时间日期格式为UTCG
root.UnitPreferences.Item('DateFormat').SetCurrentUnit('EpSec');
root.UnitPreferences.Item('Distance').SetCurrentUnit('m');
 
aircraft = root.CurrentScenario.Children.New('eAircraft', 'MyAircraft');
aircraft.VO.Model.ModelData.set('Filename',
'STKData\VO\Models\Air\b-52_stratofortress.mdl');
 
route = aircraft.Route; 
ptsArray = {37.5378,101,5000,20,5; 
            47.2602,30.5517,5000,20,5;
            47.2602,30.5517,5000,20,5;
            39.5378,14.2207,5000,20,5;}; 
route.SetPointsSmoothRateAndPropagate(ptsArray); 
%Propagate the route 
route.Propagate; 

Then add the sensor:

%添加传感器
sensor1=aircraft.Children.New('eSensor','sensor1');

The sensor points to the machine frame (British coordinate system)  Z axis by default. The sensor has independent subclasses and interfaces, and some automation settings can be done with MATLAB .

2. Common sensor types

The sensor type in STK can be set in Definition under the sensor properties window :

 The default type is a simple cone at 45° . There are several types of sensors in STK , use the MATLAB command line to get the current sensor type:

 sensor1.PatternType()

(1) simple cone ( simple conic )

The default half-vertex angle is 45° . The larger the half top angle, the larger the cover area, for example, read the half top angle to 60° :

 Use MATLAB to set the sensor type to simple cone:

% 设置传感器类型为简单圆锥
%sensor1.SetPatternType('eSnSimpleConic');
% 设置圆锥体的半顶角
%sensor1.Pattern.set('ConeAngle',30);
% 设置角度分辨率
%sensor1.Pattern.set('AngularResolution',1);

 (2) Complex Conic

The complex cone is composed of two cones inside and outside. By adjusting the semi-vertex angle and the circumference angle of the bottom surface of the two cones, a complex detection area can be constructed. The detection area is the space area sandwiched between the two cones . For example, construct two detection cones with half-vertex angles of 30° and 45° :

 

 Change the bottom circumference angle to 180° to get a horseshoe-shaped detection area:

 

 Use MATLAB to set the sensor type to complex cone:

% 设置传感器类型为复杂圆锥体
sensor1.SetPatternType('eSnComplexConic');
% 设置内层圆锥体半顶角
sensor1.Pattern.set('InnerConeHalfAngle',30);
% 设置外层圆锥体半顶角
sensor1.Pattern.set('OuterConeHalfAngle',60);
% 设定底面圆周起始角度
sensor1.Pattern.set('MinimumClockAngle',30);
% 设置底面圆周终止角度
sensor1.Pattern.set('MaximumClockAngle',120);

 (3) Rectangular detector (Rectangular)

 

Adjust the ray angles in the horizontal and vertical directions to get different detection rectangles, for example, change the horizontal angle to 60°:

 Then change the vertical direction to 15° :

Use MATLAB to set the sensor type to a rectangular detector:

% 设置传感器类型为矩形
sensor1.SetPatternType('eSnRectangular');
% 设置水平方向射线角度
sensor1.Pattern.set('VerticalHalfAngle',20);
% 设置垂直方向射线角度
sensor1.Pattern.set('HorizontalHalfAngle',60);

 (4) Synthetic Aperture (SAR)

 Synthetic aperture can generate a more complex detection space, including front and rear exclusion zone and inner cone exclusion zone, the purpose is to increase the detection range of the sides of the fuselage. For example, change the angle range of the front exclusion zone to 60° :

 Then change the angle of the rear exclusion zone to 80° :

 

 Adjusting the lower limit of the ray angle can change the coverage of the outer layer, for example, change min to 30° :

 Outer coverage is reduced. Change max to 60° , and the coverage of the inner exclusion zone increases:

 Another option of the SAR sensor is Track parent altitude . After selecting, the altitude of the sensor is automatically set to the altitude of the aircraft. If it is not selected, it is a fixed value.

Use MATLAB to set the sensor type to SAR :

% 设置传感器类型为合成孔径
sensor1.SetPatternType('eSnSAR');
% 传感器载机高度
sensor1.Pattern.set('ParentAltitude',10);
% 射线倾角起始值
sensor1.Pattern.set('MinElevationAngle',20);
% 射线倾角终止值
sensor1.Pattern.set('MaxElevationAngle',30);
% 前排除角度
sensor1.Pattern.set('ForeExclusionAngle',60);
% 后排除角度
sensor1.Pattern.set('AftExclusionAngle',60);

Notice

When Track parent altitude is selected in the sensor properties window :

 run

sensor1.Pattern.set('ParentAltitude',10);

 An error will be reported, because the ParentAltitude property is read-only at this time.

 3. Sensor pointing type

The sensor pointing can be set under Pointing in the properties window :

Pointing Type sets the sensor pointing type, About Boresight sets whether the sensor sight line rotates with the set pointing, hold means not follow the rotation, Rotate means follow the rotation, commonly used sensor pointing types are:

(1) Fixed with the fuselage (Fixed)

 Adjusting the azimuth ( Azimuth ) and elevation angle ( Elevation ) can change the sensor pointing. For example

 The sensor pointing becomes:

 Use MATLAB to set:

% 单独设置传感器指向为固定指向
sensor1.SetPointingType('eSnPtFixed');

%设置指向同时设定参数
%(1)高低角指向定位方法
% 设定高低角和方位角,第一个值是方位角,第二个值是高低角
%eAzElAboutBoresightRotate表示传感器瞄准线跟随旋转
 sensor1.CommonTasks.SetPointingFixedAzEl(-30,30,'eAzElAboutBoresightRotate');
% 设定高低角和方位角,eAzElAboutBoresightHold表示传感器瞄准线不跟随旋转
 sensor1.CommonTasks.SetPointingFixedAzEl(-30,30,'eAzElAboutBoresightHold');
 
%(2)欧拉角指向定位方法,旋转顺序是121,更多顺序定义参见:
% https://blog.csdn.net/anbuqi/article/details/120380097 4.矢量指向定位方法
sensor1.CommonTasks.SetPointingFixedEuler('e121',30,30,30);

%(3)四元数指向定位,参数顺序是:qx,qy,qz,qs
 sensor1.CommonTasks.SetPointingFixedQuat(0.1,0.1,0.1,0);
 
%(4) 偏航、俯仰和滚转(YPR),参数顺序:旋转序列,yaw,pitch,roll,
sensor1.CommonTasks.SetPointingFixedYPR('ePRY',0.,-30,60)

(2) Fixed in a certain coordinate system (Fixed in Axes)

 The default reference system is aircraft system (UK).

The difference between fixed and fixed in a certain coordinate system

Fixed pointing : refers to the fixed pointing in space, and the reference system is the absolute coordinate system of the simulation environment.

Fixed pointing in a certain coordinate system : the pointing of the sensor has no relative movement with this coordinate system, but this reference coordinate system can move relative to the absolute coordinate system.

Use MATLAB to see which coordinate systems you can use:

 sensor1.Pointing.AvailableAxes

Setting the sensor orientation in  MATLAB is basically similar to (1) , except that there is an additional coordinate system definition:

%2.设定指向在某个坐标系中固定
%单独设置在某个坐标系中固定
sensor1.SetPointingType('eSnPtFixedAxes');

%(1)高低角指向定位方法
% 设定高低角和方位角,参数:参考坐标系,方位角,高低角
sensor1.CommonTasks.SetPointingFixedAxesAzEl('Aircraft/MyAircraft Body Axes',
-30,30,'eAzElAboutBoresightRotate');

%(2)欧拉角指定方位,参数:参考坐标系,旋转顺序,三个欧拉角
 sensor1.CommonTasks.SetPointingFixedAxesEuler('Aircraft/MyAircraft Body Axes',
'e121',30,-30,30)
 
%(3)四元数
 sensor1.CommonTasks.SetPointingFixedAxesQuat('Aircraft/MyAircraft Body Axes',
0.1,0.1,0.1,0)
 
%(4)姿态角
sensor1.CommonTasks.SetPointingFixedAxesYPR('Aircraft/MyAircraft Body Axes',
'ePRY',0.,-30,60)

(3) fixed axis rotation (spinning)

When set to fixed axis rotation, the orientation of the sensor will rotate around a fixed axis in space:

(4) Altitude and azimuth offset (Grazing Alt)

%4.单独设定为切入高度,这一般用于航天中
 sensor1.SetPointingType('eSnPtGrazingAlt');
%设定为切入高度同时设定参数,参数顺序:方位角偏移,高度
 sensor1.CommonTasks.SetPointingGrazingAlt(60,10);

Guess you like

Origin blog.csdn.net/anbuqi/article/details/120435718