Stormworks: Build and Rescue

Stormworks: Build and Rescue

63 ratings
Advanced Radar to GPS (XYZ)
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
188.798 KB
Feb 19 @ 7:35pm
Feb 20 @ 6:48pm
2 Change Notes ( view )

Subscribe to download
Advanced Radar to GPS (XYZ)

Description
Optimal Single Target Tracking



Specifications
Outputs filtered target coordinates, velocity, and acceleration from a radar (that have been processed using an Unscented Kalman Filter UKF). It also maintains the original selected track by finding which of the 8 targets are closest to the estimate (meaning it ignores chaff (anti-chaff) or any other misdetections).

The HUD is only really just a visualization of the radar to GPS. Not much thought went into the system tbh.




In addition to the Kalman filter, it also exploits a weird quirk with SW radars that allow for extra filtering with no added downsides (Time since detection filtering).

The time since detection output of radars isn't actually the time since it first detected a target. Instead, every few ticks the radar takes a snapshot of the azimuth, elevation, and range to each of it's targets. For the next 8 or however many ticks random noise is just applied to this snapshot. Meaning if you were to average the radar data over this period of 8 ticks, you could get a better estimate of the true data.

This time since update period varies with the max range of the radar though. So a radar with 28 km range may have a period of 9 ticks where the radar output is just the same values with random noise applied each tick. A radar with a max range under 2km has no delay (time since detection never starts counting).



Because of this, the Kalman filter may be the optimal solution under some circumstances. Kalman filters are known to be optimal filters for normally distributed noise with linear dynamics. Normally, SW radar noise is uniformly distributed, but by sampling many uniformly distributed variables the resulting average begins to resemble a normal distribution. The more points sampled (higher time since detection/max radar range) the more it approaches a normal distribution.

However, a normal Kalman filter would still suffer since it assumes a linear transformation from measurement space to state space. To get from polar radar coordinates (azimuth, elevation, range) to global cartesian coordinates, a bunch of non-linear trig functions have to be used. Filters like the extended Kalman filter (EKF) and unscented Kalman filter (UKF) account for these non-linear transforms.

The main reason I picked the UKF over the EKF, is just because the UKF was less work for this application. Like for the EKF you have to figure out a bunch of partial derivatives (or write some program to compute them for you), but for the UKF it doesn't require any background work. The UKF samples a bunch of points surrounding the position estimate, and then converts these points to the radar's polar coordinates. Doing so, we can get better estimate of variance.


To Do
-Constant-turn state transition matrix (instead of acceleration based transition matrix)

Operation
By toggling 1, the radar will enter a mode where it'll lock the first target it picks up. It will then try to maintain this lock even if other targets enter the FOV.

Customisation
"Process Noise"
If you find that the Kalman filter estimate is too unresponsive try increasing the process noise property value.
Likewise, if you want the filter to give a more accurate (but unresponsive) value try lowering process noise.

"Initial Covariance"
I've also added a dropdown for the initial covariance, a higher value will start the estimate off with more sensitivity (keep in mind that no matter what you set this initial value to it'll eventually converge to the same covariance).

"Timeout (seconds)"
If the radar is no longer detecting a target, it'll keep predicting where that target will be until it times out.




Permissions
Feel free to re-upload this radar system on your own vehicles, so long as you provide the link to this WS page.
41 Comments
SMITHY  [author] 7 hours ago 
Just add me on discord @smithy3141 you can find me on stormworks official server
尤利 13 hours ago 
gotta talk to you.
SMITHY  [author] May 3 @ 5:19pm 
Iirc it does output acceleration
[AIM] scrapguy May 2 @ 4:03am 
what would i need to do to also get the mass and the xyz acceleration of the target?
SMITHY  [author] Apr 19 @ 7:30pm 
Just this alone, only a few hours. A lot of this was just repurposed from other projects I had tbh. Like I learnt how kalman filters worked while making the jpdaf tws. But yeah a pretty long time if you consider all the research I had to do for other projects.
Zinnia Later Apr 19 @ 3:41pm 
Neat! How long did it take you to make?
SMITHY  [author] Feb 26 @ 12:37pm 
Target size can only be calculated with the old radars, but I could add range at some point
Babou Feb 26 @ 3:21am 
It would be nice to add a target size estimator to try to make the system more dynamic and versatile
Babou Feb 26 @ 3:15am 
good work, functional and efficient :steamthumbsup:
SMITHY  [author] Feb 25 @ 1:27pm 
Btw just throwing this out here, if you want to track a very manoeuvrable target increase the process noise a bit