Create A Dynamic Sensor Body Mask for Analysis


This article is to help setup a dynamic BodyMask that will be taken into account while computing access from sensors to access objects.

There is a main script and two functions that are using in the main script with nothing to be changed in the function scripts.

The most important thing about the script is that you must change the folder path and object names to what works in your scenario. The folder is where all the sensor masks will get stored which will be referenced during analysis. The main driving force of the dynamic mask is the sensors, obscuring objects, and access objects.
User-added image
The sensors are the sensors in STK which are stored as “sensor” variables. The obscuring objects are whatever objects are getting in the way of the sensor as it tries to track another object, which are the “obscure” variables. The final are the access objects which are the objects that are seen by the sensor, which are the “obj” variables.

The code works by creating a sensor mask file throughout the scenario at the specified time step. It creates these by taking the obscuring objects into account for each sensor that were specified.

Once the masks are created, the code manually calculates access each time step that it generated a mask for while using the same mask in the access calculation.
It does this in a nested for loop, which encompasses the majority of the code. The for loop cycles through sensors, and access objects.
User-added image
At this point the code was able to successfully compute accesses while taking the obscuring objects into account. There is an optional section that is used to parse the data for different uses.

Optional Part A is used for looking at the edge cases of access and merges them when switching between body masks.
Optional Part B is used to take the parsed data and store it into an interval file for use within STK to represent the access that takes the obscuring objects into account.
Optional Part C is for creating the time interval component in STK without having the need of using an interval file. This way, you can apply the time interval into the temporal constraint of the sensor without the use of an external file.

It is very helpful to also read through the comments in the Matlab code (and not skimming them)!