Jump to content

Basic Radar [example code]


Nero.ger

Recommended Posts

device: avSimpleRadar

 

So, since i am bad at explaining stuff i made a small package which should get you quickly started if you want to make your own radar for your MOD.

if both the Simpleweaponsystem and simplerader devices are present and working, you can fire SARH missles without extra coding(this does not work if you mix it with any FC3 avionics (or any other avionics) like the popular su25t).

Edit: to be more precise, you can mix the radar with the su25t avionics, but you will not be able to use any A2A missle besides HeatSeakers

 

heres how this should look like if it works(minus the HUD) :)

 

 

 

and the code package:

https://drive.google.com/open?id=1334tCEQVcLXCqWmI7PmEPr6G3Z3TcpBb

 

 

other examples:

BasicRadar

Terrain Functions

BasicRWR


Edited by Nero.ger
  • Thanks 1

'controlling' the Ka50 feels like a discussion with the Autopilot and trim system about the flight direction.

Link to comment
Share on other sites

Hey Nero, that was so cool of you to share this... I will have to take a good look into it as soon as I can to see what I was doing wrong... Again, invaluable information in a few lines of code, thanks a lot for this!!

My DCS modding videos:

 

Modules I own so far:

Black Shark 2, FC3, UH-1H, M-2000C, A-10C, MiG-21, Gazelle, Nevada map

Link to comment
Share on other sites

Nero, do you know how to extract terrain data?

As I remember DCS mission script environment allow to get data for terrain elevation.

But does it work? Did you tried work with terrain to simulate signal attenuation from radar by mountains?


Edited by BR=55=Sevas
Link to comment
Share on other sites

Nero, do you now how to extract terrain data?

As I remember DCS mission script environment allow to get data for terrain elevation.

But does it work? Did you tried work with terrain to simulate signal attenuation from radar by mountains?

you can get terrain data(mainly Altitude and type) from specific spots in "Aircraft-enviroment" via a DLL call (Terrain.dll), and the avSimpleRadar itsself features Groundclutter (ill get back with an example for the terrain.dll later)

 

the issue is, getting terrain data many times a second or Frame slows down the simulation significantly. unless you prebuild your own "terraindatabase"

'controlling' the Ka50 feels like a discussion with the Autopilot and trim system about the flight direction.

Link to comment
Share on other sites

What about extract terrain data to some array,chunk, and then calculate everything you need without constant repeatedly polling simulation?

Probably this should work. Damn, I need go back to dcs modding, but I forgot almost everything.


Edited by BR=55=Sevas
Link to comment
Share on other sites

Another question - does your radar works wih guided missiles?

If you locked target, does missile understand it as target?

Long time ago I have launch missiles with my mod with external fm, but missiles flies just through the straight line

As I remember there was something like launchstation(0) command.

Link to comment
Share on other sites

i am fireing aim7s in the video ;)

i think the trick is to "selectStation(x)" first and then "LaunchStation(x)"

unless its bugged in 2.5 the missle automaticaly follows the locked target (the video is from 1.5.8 )

'controlling' the Ka50 feels like a discussion with the Autopilot and trim system about the flight direction.

Link to comment
Share on other sites

Jesus Christ, the radar is working!

 

The most valuable thing to extract from this example, IMO, is how DCS expects you to interact with the radar. As I understood so far:

 

The contact's data is contained the "RADAR_CONTACT_[number]_" param in conjunction with the "RANGE", "AZIMUTH", etc. params. Now I look in the strings extracted from the CockpitBase.dll (as indicated in this thread: https://forums.eagle.ru/showthread.php?t=182020 ) and I see strings like

 

RADAR_CONTACT_%02d_

RANGE

AZIMUTH

etc.

 

Now how on earth you discovered that those strings, among the zillion other strings in the same file, would be used as params (and after concatenating them) is what right now I can't understand. These params don't appear in the list when you call list_cockpit_params() from the cockpit lua environment... (unlike "RADAR_TDC_RANGE", "RADAR_TDC_AZIMUTH", etc.). I still have things to test and figure and this example is helping a lot... thanks again!

My DCS modding videos:

 

Modules I own so far:

Black Shark 2, FC3, UH-1H, M-2000C, A-10C, MiG-21, Gazelle, Nevada map

Link to comment
Share on other sites

you absolutly need the avSimpleElectricsystem, without that the radar cannot be switch on and you dont see the parameters. but you also dont get an error message.

also i think the file i read most was the dump of the cockpitbase.dll :-D

 

also confusing, some of the paramters (....TDC....) can be set while others are read only.

time and trail and error is the way to go here and i am pretty sure i havent discovered everything in regards to the radar


Edited by Nero.ger

'controlling' the Ka50 feels like a discussion with the Autopilot and trim system about the flight direction.

Link to comment
Share on other sites

  • 1 year later...

i realized i forgot some parameters in my orignal example:

so here is a full list:

 

RADAR_CONTACT_01_RCS_COEFF:0.334631
RADAR_CONTACT_01_VZ:-5.376554
RADAR_CONTACT_01_RANGE:3336.165527
RADAR_CONTACT_01_NOISE:0.000000
RADAR_CONTACT_01_NCTR:"Su-25"
RADAR_CONTACT_01_TIME:4.140000
RADAR_CONTACT_01_VY:-3.621754
RADAR_CONTACT_01_AZIMUTH:0.062180
RADAR_CONTACT_01_ELEVATION:-0.002366
RADAR_CONTACT_01_FRIENDLY:-1.000000
RADAR_CONTACT_01_RCS:7.000000
RADAR_CONTACT_01_VX:138.504089
RADAR_CONTACT_01_RND:0.630329

parameters are counted 01..02....98..99..100..101..


Edited by Nero.ger
  • Thanks 1

'controlling' the Ka50 feels like a discussion with the Autopilot and trim system about the flight direction.

Link to comment
Share on other sites

  • 1 year later...
  • 5 weeks later...
  • 2 years later...
  • 1 month later...

This is pretty nice!
There's one big problem though, avSimpleRadar can't track targets less than 300 m away and tends to unlock for no reason.

By the way, how awesome would it be if we could get other "simple" devices like a laser designator or camera?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...