Page 1 of 1

Realize automatic tracking ?

Posted: Thu Apr 21, 2022 1:59 pm
by hanzawa1991
How to realize automatic tracking after uav discovering a ship by LUA

Re: Realize automatic tracking ?

Posted: Fri Apr 22, 2022 4:22 am
by KnightHawk75
I don't understand the question, can you be much more specific.

Re: Realize automatic tracking ?

Posted: Sat Apr 23, 2022 4:17 am
by hanzawa1991
KnightHawk75 wrote: Fri Apr 22, 2022 4:22 am I don't understand the question, can you be much more specific.
For example, after the enemy destroyer is spotted by the MQ-8 drone, the destroyer moves away , the MQ-8 automatically hovers over it and track it. How to achieve this effect by Lua?

Re: Realize automatic tracking ?

Posted: Sat Apr 23, 2022 6:13 am
by KnightHawk75
So some things that will come in play and I .
I might in the general sense if Blue is destroyer side and Red is Drone side..

Use the detection trigger event (Blue detects Red Drone, or Blue detects Red Drone in area around Blue destroyer), to kick off the LUA for the reaction of the destroyer unit, moving 'away' via course,speed and throttle assignments or reassigning to a mission with different location that causes reaction desired. On the drone side I would use a similar detection event (Red detects Blue specific destroyer) to kick off it's reaction and course, be that waypoints or the creation of an ever updating patrol zone rp's around/behind/whatever the destroyer, and assignment of the drone to that mission.

Re: Realize automatic tracking ?

Posted: Sat Apr 23, 2022 7:16 am
by hanzawa1991
KnightHawk75 wrote: Sat Apr 23, 2022 6:13 am So some things that will come in play and I .
I might in the general sense if Blue is destroyer side and Red is Drone side..

Use the detection trigger event (Blue detects Red Drone, or Blue detects Red Drone in area around Blue destroyer), to kick off the LUA for the reaction of the destroyer unit, moving 'away' via course,speed and throttle assignments or reassigning to a mission with different location that causes reaction desired. On the drone side I would use a similar detection event (Red detects Blue specific destroyer) to kick off it's reaction and course, be that waypoints or the creation of an ever updating patrol zone rp's around/behind/whatever the destroyer, and assignment of the drone to that mission.
thanks a lot,but how to create an ever updating patrol zone ? use 'ScenEdit_SetMission'?,but how to confirm the waypoint?

Re: Realize automatic tracking ?

Posted: Sat Apr 23, 2022 8:17 am
by KnightHawk75
You can write some code to update the locations of the RP that are being used to define the area to new locations at the interval of your choosing. Another way when it applies/works for the specific case, is to just use 'relative' settings on the RP's.

Not sure what you mean by confirm, do you mean how to set/change a units waypoint(s). You do that modifying the Unit's course property, by feeding it a new table of waypoints of your own making in terms of location.

Re: Realize automatic tracking ?

Posted: Sun Apr 24, 2022 2:24 pm
by hanzawa1991
KnightHawk75 wrote: Sat Apr 23, 2022 8:17 am You can write some code to update the locations of the RP that are being used to define the area to new locations at the interval of your choosing. Another way when it applies/works for the specific case, is to just use 'relative' settings on the RP's.

Not sure what you mean by confirm, do you mean how to set/change a units waypoint(s). You do that modifying the Unit's course property, by feeding it a new table of waypoints of your own making in terms of location.
Why is the location shown wrong?
Image
this is my code:

Code: Select all

local con = ScenEdit_GetContacts('R')
local guid1=con[1].guid
local name1=con[1].name
local Lat1=con[1].Latitude
local Lon1=con[1].Longitude
--ScenEdit_MsgBox(guid1, 1)
--ScenEdit_AddReferencePoint( {side='R', RelativeTo=name1, bearing=45 ,distance=20, clear=true })
--ScenEdit_SetReferencePoint({side='R', name="Downed Pilot", RelativeTo=name1, bearing=5 ,distance=10, highlighted =true})
ScenEdit_AddReferencePoint({side="R", name="Downed Pilot", lat=Lat1, lon=Lon1, highlighted=true})

Re: Realize automatic tracking ?

Posted: Mon Apr 25, 2022 1:31 pm
by hanzawa1991
hanzawa1991 wrote: Sun Apr 24, 2022 2:24 pm
KnightHawk75 wrote: Sat Apr 23, 2022 8:17 am You can write some code to update the locations of the RP that are being used to define the area to new locations at the interval of your choosing. Another way when it applies/works for the specific case, is to just use 'relative' settings on the RP's.

Not sure what you mean by confirm, do you mean how to set/change a units waypoint(s). You do that modifying the Unit's course property, by feeding it a new table of waypoints of your own making in terms of location.
Why is the location shown wrong?
Image
this is my code:

Code: Select all

local con = ScenEdit_GetContacts('R')
local guid1=con[1].guid
local name1=con[1].name
local Lat1=con[1].Latitude
local Lon1=con[1].Longitude
--ScenEdit_MsgBox(guid1, 1)
--ScenEdit_AddReferencePoint( {side='R', RelativeTo=name1, bearing=45 ,distance=20, clear=true })
--ScenEdit_SetReferencePoint({side='R', name="Downed Pilot", RelativeTo=name1, bearing=5 ,distance=10, highlighted =true})
ScenEdit_AddReferencePoint({side="R", name="Downed Pilot", lat=Lat1, lon=Lon1, highlighted=true})

I know the answer. There's no latitude or longitude in con[1] :(

Re: Realize automatic tracking ?

Posted: Mon Apr 25, 2022 1:51 pm
by hanzawa1991
I have tried many functions,like "ScenEdit_GetContact()/ScenEdit_GetContacts()/VP_GetContact()/VP_GetSide()/VP_GetSides()/
VP_GetUnit()" but there is no way to get the longitude and latitude of the ship found by "R" side, what should I do? :(

Re: Realize automatic tracking ?

Posted: Tue Apr 26, 2022 1:31 pm
by TitaniumTrout
Lua is case sensitive.

local Lat1=con[1].Latitude will not work, but local Lat1=con[1].latitude will.

Code: Select all

local con = ScenEdit_GetContacts('R')
print("GetContacts latitude is " .. con[1].latitude)
local Lat1=con[1].latitude
print(Lat1)
GetContacts latitude is 36.99019808043
36.9901980804296
I made a scenario with a single MPA Aircraft and a DDG on the opposite side. Once the DDG was detected I ran the above script in the Lua Console.

Re: Realize automatic tracking ?

Posted: Tue Apr 26, 2022 2:41 pm
by KnightHawk75
hanzawa1991 wrote: Mon Apr 25, 2022 1:51 pm I have tried many functions,like "ScenEdit_GetContact()/ScenEdit_GetContacts()/VP_GetContact()/VP_GetSide()/VP_GetSides()/
VP_GetUnit()" but there is no way to get the longitude and latitude of the ship found by "R" side, what should I do? :(
hanzawa1991 did TitaniumTrout's reply help you clear up the issue you were having?

Re: Realize automatic tracking ?

Posted: Thu Apr 28, 2022 1:05 pm
by hanzawa1991
KnightHawk75 wrote: Tue Apr 26, 2022 2:41 pm
hanzawa1991 wrote: Mon Apr 25, 2022 1:51 pm I have tried many functions,like "ScenEdit_GetContact()/ScenEdit_GetContacts()/VP_GetContact()/VP_GetSide()/VP_GetSides()/
VP_GetUnit()" but there is no way to get the longitude and latitude of the ship found by "R" side, what should I do? :(
hanzawa1991 did TitaniumTrout's reply help you clear up the issue you were having?
Thank you very much. It's done

Re: Realize automatic tracking ?

Posted: Thu Apr 28, 2022 1:06 pm
by hanzawa1991
TitaniumTrout wrote: Tue Apr 26, 2022 1:31 pm Lua is case sensitive.

local Lat1=con[1].Latitude will not work, but local Lat1=con[1].latitude will.

Code: Select all

local con = ScenEdit_GetContacts('R')
print("GetContacts latitude is " .. con[1].latitude)
local Lat1=con[1].latitude
print(Lat1)
GetContacts latitude is 36.99019808043
36.9901980804296
I made a scenario with a single MPA Aircraft and a DDG on the opposite side. Once the DDG was detected I ran the above script in the Lua Console.
You're absolutely right. That's the problem, thanks a lot!!