Jump to content

Recon camera info for script


ESAc_matador

Recommended Posts

[ame]

[/ame]

 

If we assume that your camera is looking straight down, has a 50 degree field of view, and makes circular instead of rectangular photos, it will see an area in the shape of a circle -- the intersection between a cone projected by the camera and the ground.

 

Half of that cone is a triangle with a right angle and we know the altitude and the field of view of the camera, so we can use trigonometry to figure out the radius of that circle.

 

aircraft *
        /|\        -
       /ɑ| \       |
      /  |  \      |
     /   |   \     | altitude
    /    |    \    |
   /     |     \   |
  +======+======+  -

  |------|
      r

tan(ɑ) = r / altitude
r = tan(ɑ) * altitude

 

In your example, the angle alpha would be 25 degrees (half of the field of view).

 

In Lua, like in most programming languages, the trigonometric functions use degrees instead of radians, so you have to factor in a conversion factor:

 

function getReconCircleRadius(fovAngleDegree, altitude)
   local fovAngleRadians = fovAngleDegree / 180 * math.pi
   local halfFovAngleRadians = fovAngleRadians / 2
   return math.tan(halfFovAngleRadians) * altitude
end


Edited by [FSF]Ian
Link to comment
Share on other sites

Ian;2806859']

 

If we assume that your camera is looking straight down, has a 50 degree field of view, and makes circular instead of rectangular photos, it will see an area in the shape of a circle -- the intersection between a cone projected by the camera and the ground.

 

Half of that cone is a triangle with a right angle and we know the altitude and the field of view of the camera, so we can use trigonometry to figure out the radius of that circle.

 

aircraft *
        /|\        -
       /ɑ| \       |
      /  |  \      |
     /   |   \     | altitude
    /    |    \    |
   /     |     \   |
  +======+======+  -

  |------|
      r

tan(ɑ) = r / altitude
r = tan(ɑ) * altitude

 

In your example, the angle alpha would be 25 degrees (half of the field of view).

 

In Lua, like in most programming languages, the trigonometric functions use degrees instead of radians, so you have to factor in a conversion factor:

 

function getReconCircleRadius(fovAngleDegree, altitude)
   local fovAngleRadians = fovAngleDegree / 180 * math.pi
   local halfFovAngleRadians = fovAngleRadians / 2
   return math.tan(halfFovAngleRadians) * altitude
end

 

That is the idea!!!

 

I also want to put some restrictions in roll... So the camera does not work if rolled more than le say 15 degrees...

 

For IIww instead of tv camera we can make pictures, i mean with a counter, you can take only 10-15 pics. So 10-15 opportunities to locate targets. Hehhe

Link to comment
Share on other sites

  • 1 month later...

hello everyone...

 

I have done a draft of the script, works perfect but it still not dependant on the height. I am having problems with this.

 

local Position_vec3 = Unit.getByName('recon1'):getPoint()
local _elevation = land.getHeight({x = Position_vec3.x, y = Position_vec3.z})
local _height = Position_vec3.y - _elevation
_reconradius = math.sin(0.45) * _height

-- this works fine so far, gives you a radius, depending on the height ( I estimate the camera angle is about 50º so, i did Sin(25º))

 

the problem is that in the function mist. getUnitsLOS does not work with the variable _reconradius. I check the table and it is always empty. It seems a format problem..

 

local redunits = mist.makeUnitTable({'[red][vehicle]'})
local blueunits = mist.makeUnitTable({'recon1'})        
LOSData = mist.getUnitsLOS(blueunits,2,redunits,2,_reconradius)

Link to comment
Share on other sites

  • 1 month later...

I have seen some specifications n the F5 real Manual, the angle of the cameras in the F5 is 41° so I made it work with that angle.

 

How this works?? easy!.

 

 

You have a menu via F10, called RECON FLIGHT, this has two submenus.

 

- START RECORDING: it will be taking pictures every 3 seconds displaying a message "RECORDING", during one minute, you will receive a message saying STOP RECORDING, TYPE FULL". You can do as many times as you want, but for entertaining purposes, until I fix it, I would use just 3 o 4 "shots", once you do 2 or 3 times, come back home!!!. If the aricraft is banking or pitching more than 15° the Camera will not work. (we interpret the picture is wrong).

 

- REVEAL PICTURES: by pressing this, there will be a message with all information about enemy units collected. Once you land, just select this option, and write the info in a paper. You can do it during fligt coming back, if you want, but this would not be so realistic.

 

See attached how the info is displayed. Do not make HUGE recon missions because you can leave no space for dsiplay!!!Or just do not to put many many groups in the area, there is a line for group. This is a buisy airbase... you can see. The aricrafts are groups non activated, SAMs, Air Defenses, Trucks, Tanks... The camera got everything inside a radius, depending on the altitude.

 

High altitude, and low altitude recon, has its own adventages, depending on the threat expected. Higher, you get more info, but you have other possible enemies and SAMs coming at you. Lower, you have small caliber an IR missiles... up to you!!!!! Also, it uses LOS, so if you fly low, and there is a mountain you will miss the target.

 

 

REmember that any good recon pilot, uses the camara and visual!!!

 

 

TO INSTALL>

You need Mist, and call your group name and aircraft name "recon1" like in the mission.

 

For squadrons that like long campaigns, this is really funny, collecting info before launch an attack. And plan according the collected data.

planerecon.lua

recontest1.0.miz

Screen_160817_150548.thumb.jpg.a7e6e243737419683cce8f73b9b3d2e0.jpg


Edited by ESAc_matador
Link to comment
Share on other sites

 

- REVEAL PICTURES: by pressing this, there will be a message with all information about enemy units collected. Once you land, just select this option, and write the info in a paper. You can do it during fligt coming back, if you want, but this would not be so realistic.

 

Very nice :thumbup:

You could check aircraft's speed and altitude < 1 to allow this menu

People fly planes, pilots fly helicopters

Link to comment
Share on other sites

That is a cool script. I will try to make my radar app to be fed by your script (as a step towards more realism) rather than export via LoGetWorldObjects(). Thanks!

i5-9600K@4.8GHz 32Gb DDR4 Asus TUF rtx3080 OC Quest Pro Warthog on Virpil base

Link to comment
Share on other sites

I am new programing so my code is everything but elegant. Feel free to use it or part of it!.

 

Checking the speed is a good idea.

 

To be completed, would be better with a chronometer, so you have 5 minutes for record, in total. Have you guys tested?

 

I will do a real mission with it, with navigation and Random Spawned enemies

Link to comment
Share on other sites

You can use a flag for that. As far as I know triggers are checked every second, so if you count one flag up with a continous trigger, you should have the amount of seconds stored in that flag

 

Really nice script by the way, a few days ago I asked whether it is possible to get a list of units currently in my TGP / Skhval / Viviane view, which seems to be only possible through complicated access to the export.lua. Maybe I can use this script instead. Thanks for the great work


Edited by MasterZelgadis

"Sieh nur, wie majestätisch du durch die Luft segelst. Wie ein Adler. Ein fetter Adler."

http://www.space-view.net

Link to comment
Share on other sites

You can use a flag for that. As far as I know triggers are checked every second, so if you count one flag up with a continous trigger, you should have the amount of seconds stored in that flag

 

Really nice script by the way, a few days ago I asked whether it is possible to get a list of units currently in my TGP / Skhval / Viviane view, which seems to be only possible through complicated access to the export.lua. Maybe I can use this script instead. Thanks for the great work

 

For Gazelle. I have another scrip released, very alpha, but it works. You can give position to CAS fligths. I need to adapt it yet, and I want to learn MOOSE yet.


Edited by ESAc_matador
Link to comment
Share on other sites

Ha i put this in the wish list a few days ago! Is there any way to actually take screenshots pointed down though?

 

you would have to render a graphic view on the area. I don;t think this is possible with lua scripting.

 

What would be possible is to draw a map with the 'photographed' targets on it since their coordinates are already gathered by this script. So, basically, the recon script could produce a text file with all the recon data, and another standalone application would generate a map picture based on that.

i5-9600K@4.8GHz 32Gb DDR4 Asus TUF rtx3080 OC Quest Pro Warthog on Virpil base

Link to comment
Share on other sites

I have another script similar... but is the infantry who supplies the information of groups that are line of sight. They can even mark enemies with simulated mortars if the enemy is less than 1800.

 

It is very good for CAS missions. You can also put som IA doing CAS.

 

Works only for blue side (as the plane recon). I need to do it both sides.... I know.

Link to comment
Share on other sites

Confused; what is Mist?

 

It is a scritpt to do other scripts... Long story short.

 

Programming is difficult for most of the people. Mist, is a series of functions coded and loaded before your own script, so you can use such predefined functions very easyly in your scripts, but in order to make your script understand such functions, you need to pre-load such code.

 

Example.

 

You want to spawn a unit in a zone randomly. In lua, you should do a code similar to this below (is just an example)

function mist.teleportInZone(gpName, zone, disperse, maxDisp) -- groupName, zoneName or table of Zone Names, keepForm is a boolean
	if type(gpName) == 'table' and gpName:getName() then
		gpName = gpName:getName()
	else
		gpName = tostring(gpName)
	end

	if type(zone) == 'string' then
		zone = trigger.misc.getZone(zone)
	elseif type(zone) == 'table' and not zone.radius then
		zone = trigger.misc.getZone(zone[math.random(1, #zone)])
	end

	local vars = {}
	vars.gpName = gpName
	vars.action = 'tele'
	vars.point = zone.point
	vars.radius = zone.radius
	vars.disperse = disperse
	vars.maxDisp = maxDisp
	return mist.teleportToPoint(vars)
end

 

So, unless you know lua programming, you will never do this. BUT

if you load mist script file, via ME triggers, the function is already loaded and you already has this function predefined, so you only need to give it the details. Which unit, which zone y f you want it disperse, and which dispersion distance. So, you go to the ME triggers and do this two simpel triggers.

 

Once- Timer more 2 seconds- Do script file (Mist.lua)

Once - TIme more 4 seconds (always after the mist functions has been loaded) - DO SCRIPT:

 

and then in the box you write.

 

mist.teleportInZone('badass', 'LZ', true, 30) 

where:

badass is the name of the group you want to teleport (needs to be between ' )

LZ is the name of the triggerzone previously set in the ME

true, says you want them disperse

30, dispersion is 30 meters.

 

 

So, at the second 4 of the game, the group called baddass will be teleported to a random place inside the zone called LZ, each unit will be dispersed with a distance of 30 from the leader.

 

This can be much complicated, but there are many simple functions that can give you much better missions, for teleporting, for moving, for many things. Also, you can use them for bigger things, as tools, get distances, get unit inside zones to activate a trigger, to see if a unit is Line of SIght to others... it is a world itself, but once you get into it, is really POWERFULL.

 

 

for most functions ( or most of them)

http://wiki.hoggit.us/view/Category:MIST

 

enjoy it

 

PSS: MOOSE is also similar, a good combination between this two is what I am aiming to.


Edited by ESAc_matador
Link to comment
Share on other sites

  • 3 weeks later...

Ok, guys, I made a modification. Mr Pikey asked me to include Static Objects in the script... sounded a good idea to me, so you can fly, looking for enemy camps, or just some suspicious buildings. Even Static Objects like Aircrafts or Helos are in the report. THis is good to use in an airfield recon mission

 

It wokrs only for blue side yet... but now you have two options to "reveal" pictures, ground units and Static objects. It does not get FARPS i dont know why.... probably they arent in the Static Object table. So, it is easy, just put any Static Object with FARP name (such as FARP Depot or something)

 

I had to modify I modified the mist.getUnitLOS() to make the function getObjectLOS() which is basically the same, but I had to adpat to work with static objects. I you need you can use is.

 

And now, you have to land before get the report!!!!!

 

The unitset2 must be only Static Objects.

 

function getObjectLOS(unitset1, altoffset1, unitset2, altoffset2, radius)

 

It still keeps all old features.

 

Remember it works with mist.

 

Enjoy it!!!

Screen_160912_122230.thumb.jpg.1314c5f0de73e3ddd0e33ec913f55ec5.jpg

planerecon1.lua


Edited by ESAc_matador
Link to comment
Share on other sites

  • 1 month later...

Yes! Its done! I have been out for work.

 

I ll put it soon.

 

It works like this.

 

If the Gazelle has an enemy group, when you call an order (via F10) in front of you (no more than 5 degrees), the target is loaded in the radio Menu with the position Lat Long. Then you call an air strike, the IA will attack. You only need to name your unit in Mission editor and put a IA CAS fligth. Up to 4 flights. Its really funny for recon missions, I havent tested multycreww but that should be awesome.

 

The LatLong is good in case there are two groups, so you know who is who.

 

I am also wotking in new commands for C4SIR script. Which is the origin of everything. You will be able to mark each enemy group with smoke, or illum them (like mortars, i simulate 60mm so short range). you can specify which unit to lase at night too, or receive the position, and call CAS with infantry detection not yours.

 

The point is, always a friendly unit needs to be in range to detect and in LOS.


Edited by ESAc_matador
Link to comment
Share on other sites

  • Recently Browsing   0 members

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