Jump to content

Recommended Posts

Posted

a question? That file structure has aplicable for a helo / vehicle / ship? or need expecific files for that?

For Work/Gaming: 28" Philips 246E Monitor - Ryzen 7 1800X - 32 GB DDR4 - nVidia RTX1080 - SSD 860 EVO 1 TB / 860 QVO 1 TB / 860 QVO 2 TB - Win10 Pro - TM HOTAS Warthog / TPR / MDF

Posted (edited)

Great posts!!

 

But do you know how I can get the MiG-29A cockpit model from FC2?

 

Where is it in my FC2 folder?

 

Thanks!

 

EDIT: I am using DCS: World.

Edited by Sceptre

RTX 2070 8GB | 32GB DDR4 2666 RAM | AMD Ryzen 5 3600 4.2Ghz | Asrock X570 | CH Fighterstick/Pro Throttle | TM MFDs | TrackIR 5

Posted

Okay thanks I found the 2 files but how do I implement this as my default cockpit for the MiG-29A?

 

This is how my mods\aircrafts\MiG-29A folder is structured and my entry.lua:

 

mymigmod.png

 

 

I basically structured it the same way as the Su-25T folder in DCS world.

 

But how do I get this MiG-29A to use its own cockpit and radar etc from Flaming Cliffs 2?

 

 

 

Thanks in advance.

RTX 2070 8GB | 32GB DDR4 2666 RAM | AMD Ryzen 5 3600 4.2Ghz | Asrock X570 | CH Fighterstick/Pro Throttle | TM MFDs | TrackIR 5

Posted (edited)

I have three needles on the altimeter (10000 ft, 1000 ft, and 100 ft). I am trying to use the gauge: base_gauge_BarometricAltitude, but it appears that it only sends one number, the full altitude value (Ex: 11532 m), so I can only define the 10000 ft needle correctly. By extension, two needles will work below 10000ft and all three needles will work below 1000 ft.

 

How can I use this base gauge to define all three needles? I notice the other DCS aircraft all pull from the *_common.dll files for their altimeter gauges through FM_PROXY. My code is below. If you could please advise on how I can use this gauge or how I can take it's value and perform a math modification on it to get the value I need to send to each gauge. Thanks!

 

-- Altimeter
--10000 ft needle
base_gauge_BarometricAltitude				= CreateGauge()
base_gauge_BarometricAltitude.arg_number	= 52
base_gauge_BarometricAltitude.input			= {0.0, 30480.0}
base_gauge_BarometricAltitude.output		= {0.0, 1.0}
base_gauge_BarometricAltitude.controller	= controllers.base_gauge_BarometricAltitude

--1000 ft needle
base_gauge_BarometricAltitude				= CreateGauge()
base_gauge_BarometricAltitude.arg_number	= 53
base_gauge_BarometricAltitude.input			= {0.0, 3048.0}
base_gauge_BarometricAltitude.output		= {0.0, 1.0}
base_gauge_BarometricAltitude.controller	= controllers.base_gauge_BarometricAltitude

--100 ft needle
base_gauge_BarometricAltitude				= CreateGauge()
base_gauge_BarometricAltitude.arg_number	= 51
base_gauge_BarometricAltitude.input			= {0.0, 304.8}
base_gauge_BarometricAltitude.output		= {0.0, 1.0}
base_gauge_BarometricAltitude.controller	= controllers.base_gauge_BarometricAltitude

Edited by SilentEagle
Posted (edited)

Okay, we've made some progress! Followed your guide, Alex, and wrote this Altimeter.lua to do what I said I needed in the last post:

 

local Altimeter = GetSelf()

local update_rate = 0.1 -- 1/10 sec, or 10 times per second
make_default_activity(update_rate)

local sensor_data = get_base_data()

local baro_alt10000 = get_param_handle("baro_alt10000")
local baro_alt1000 = get_param_handle("baro_alt1000")
local baro_alt100 = get_param_handle("baro_alt100")

baro_alt100:set(0)
baro_alt1000:set(0)
baro_alt10000:set(0)

function update()
	
baro_alt100:set(sensor_data.getBarometricAltitude() % 1000)	-- 12345 % 1000 = 345
baro_alt1000:set(sensor_data.getBarometricAltitude() % 10000) -- 12345 % 10000 = 2345
baro_alt10000:set(sensor_data.getBarometricAltitude())
end

 

However, my 1000 ft needle still doesn't work above 10000 ft and my 100ft needle has a mind of its own and only moves in certain altitude ranges.

 

Here is my addition to devices.lua:

 

devices["ALTIMETER"]     = counter()--6

 

Here is my addition to device_init.lua:

 

creators[devices.ALTIMETER]			 = {"avLuaDevice"	,LockOn_Options.script_path.."Altimeter.lua"}

 

And finally, here is my addition to mainpanel_init.lua:

 

-- Altimeter
--10000 ft needle
Altimeter_10000m_Gauge				= CreateGauge("parameter")
Altimeter_10000m_Gauge.parameter_name   	= "baro_alt10000"
Altimeter_10000m_Gauge.arg_number    		= 52
Altimeter_10000m_Gauge.input    		= {0.0, 30480.0}
Altimeter_10000m_Gauge.output    		= {0.0, 1.0}

--1000 ft needle
Altimeter_1000m_Gauge				= CreateGauge("parameter")
Altimeter_1000m_Gauge.parameter_name   	        = "baro_alt1000"
Altimeter_1000m_Gauge.arg_number    		= 53
Altimeter_1000m_Gauge.input    			= {0.0, 3048.0}
Altimeter_1000m_Gauge.output    		= {0.0, 1.0}

--100 ft needle
Altimeter_100m_Gauge				= CreateGauge("parameter")
Altimeter_100m_Gauge.parameter_name   		= "baro_alt100"
Altimeter_100m_Gauge.arg_number    		= 51
Altimeter_100m_Gauge.input    			= {0.0, 304.8}
Altimeter_100m_Gauge.output    			= {0.0, 1.0}

Edited by SilentEagle
Posted (edited)

Try to use "cycled" parameter for your 1000 and 100m needle. Like this:

 

--1000 ft needle
Altimeter_1000m_Gauge                = CreateGauge("cycled")
Altimeter_1000m_Gauge.cycle_value         = 1000
Altimeter_1000m_Gauge.arg_number            = 53
Altimeter_1000m_Gauge.input                = {0.0, 1000}
Altimeter_1000m_Gauge.output            = {0.0, 1.0}
Altimeter_1000m_Gauge.controller  = controllers.base_gauge_BarometricAltitude

--100 ft needle
Altimeter_100m_Gauge                = CreateGauge("cycled")
Altimeter_100m_Gauge.cycle_value         = 100
Altimeter_100m_Gauge.arg_number            = 51
Altimeter_100m_Gauge.input                = {0.0, 100}
Altimeter_100m_Gauge.output                = {0.0, 1.0}
Altimeter_100m_Gauge.controller  = controllers.base_gauge_BarometricAltitude

 

And no alt100 and 1000 variable need to Altimeter.lua

Edited by beczl
  • Like 1
Posted
OK... how did you know to use "cycled"? Where can we get a list of these things?

 

Best regards,

Tango.

 

He probably has the russian docs ;)

Posted

So I'm assuming we'd use this "cycled" param for similar gauges like the HSI, ADF and compasses?

i7 7700K | 32GB RAM | GTX 1080Ti | Rift CV1 | TM Warthog | Win 10

 

"There will always be people with a false sense of entitlement.

You can want it, you can ask for it, but you don't automatically deserve it. "

Posted

I'm trying to write a controller for the airbrakes to auto-extend past Mach 0.78 and retract below 0.78, but I cannot figure out how to send a command to the game. I have tried LoSetCommand(147) from the Export.lua and I have also tried SetCommand(147). What is the command to do this? Here is my code:

 

local dev = GetSelf()

local update_rate = 0.2 -- 1/5 sec, or 5 times per second
make_default_activity(update_rate)

local sensor_data = get_base_data()

local m_max = get_param_handle("Max_Mach")
local auto_ext = get_param_handle("AutoExtended")

function post_initialize()
auto_ext:set(0)
m_max:set(0)
print("post_initialize called in BrakeController.lua")
end

function update()

local spdbrkpos = sensor_data.getSpeedBrakePos()
local mach = sensor_data.getMachNumber()

if mach>0.78 then
	m_max:set(1)
else
	m_max:set(0)
end

if mach>0.78 and spdbrkpos==0 then
	--BRAKES OUT
	LoSetCommand(147) -- Air brake on 
	auto_ext:set(1)
elseif mach<0.75 and spdbrkpos==1 and auto_ext==1 then
	--BRAKES IN
	LoSetCommand(148) -- Air brake off
	auto_ext:set(0)
end

end

Posted

Should need to be insert the following before function update due the sensor_data declaration is required..

 

local sensor_data = get_base_data()

make_default_activity(0.05) --20 time per second

So the code looks like this:

 

local sensor_data = get_base_data()
make_default_activity(0.05) --20 time per second

local m_max = get_param_handle("Max_Mach")
local auto_ext = get_param_handle("AutoExtended")

function post_initialize()
   auto_ext:set(0)
   m_max:set(0)
   print("post_initialize called in BrakeController.lua")
end

function update()

   local spdbrkpos = sensor_data.getSpeedBrakePos()
   local mach = sensor_data.getMachNumber()
   
   if mach>0.78 then
       m_max:set(1)
   else
       m_max:set(0)
   end
   
   if mach>0.78 and spdbrkpos==0 then
       --BRAKES OUT
       LoSetCommand(147) -- Air brake on 
       auto_ext:set(1)
   elseif mach<0.75 and spdbrkpos==1 and auto_ext==1 then
       --BRAKES IN
       LoSetCommand(148) -- Air brake off
       auto_ext:set(0)
   end
   
end

need_to_be_closed = true -- close lua state after initialization 

Posted
LoSetCommand(147) -- Air brake on

 

Hi guys, what if, like on A10C, i need to set Air brake not FULL but just, let's suppose, to 40% ?

It's possible or we need to wait for the AFM ?

Posted
Hi guys, what if, like on A10C, i need to set Air brake not FULL but just, let's suppose, to 40% ?

It's possible or we need to wait for the AFM ?

 

I'm guessing that speedbrakes, being a flight model system, are tied to the SFM.

 

Should need to be insert the following before function update due the sensor_data declaration is required..

 

If you look at the top of my example, I actually have those lines. Your example only re-ordered those lines. The command still does not work, but I know the logic is fine, because I have tested it. I am just wondering if LoSetCommand is the right command I should be using, or if that only works in export.lua I have tried your code as well and same result.

Posted

Any update?

Keep getting

attempt to call global 'LoSetCommand' (a nil value)

in my test device.

 

As SiletnEagle wrote, probably LoSetCommand isn't the right command.

  • Recently Browsing   0 members

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