Jump to content

NWS system connection to steering authority (avLuadevice)


Aeroshell

Recommended Posts

Hello,

 

I created a custom NWS system with low and high modes. Everything works, and the animation works in both modes and outputs to my hud correctly. No problem there.

 

However I am confused on how I am supposed to connect this logic to the actual nose wheel steering authority? I am using rudder position sensor data to define the movement of the steering system.

 

For instance, if air brakes are coded, the simulation knows what is happening from the call of the animation, but what about the nose wheel steering system since it works without calling the animation?

Link to comment
Share on other sites

Assuming you're using SFM, what you can do is this:

change your joystick.lua:

 

{combos = defaultDeviceAssignmentFor("rudder"),  action = iCommandPlaneRudder	   , name = _('Rudder')}

 

and keyboard.lua:

    {combos = {{key = 'Z'}}, down = iCommandPlaneLeftRudderStart, up = iCommandPlaneLeftRudderStop, name = _('Aircraft Rudder Left'), category = _('Flight Control')},
   {combos = {{key = 'X'}}, down = iCommandPlaneRightRudderStart, up = iCommandPlaneRightRudderStop, name = _('Aircraft Rudder Right'), category = _('Flight Control')},

to use other custom command values for the up,down,action values ... then in your code, catch those custom command values (with listen_command and the SetCommand callback), and pass them onto DCS SFM as desired (scaled or whatever) using dispatch_action, e.g.

 

 

            dispatch_action(nil, iCommandPlaneRudder, yourvalue)

You may have to define iCommandPlaneRudder as a local variable with the correct value,e.g.

local iCommandPlaneRudder = 2003

(see https://forums.eagle.ru/attachment.php?attachmentid=106386&d=1414456928 )

 

For the Z X keys, you'll have to (probably) have your custom down/up commands increment/decrement a value internally to your code on a timer, representing rudder position, then you can control the deflection per second or whatever, and also just pass that to DCS with iCommandPlaneRudder, instead of passing along iCommandPlaneLeftRudderStart/iCommandPlaneRightRudderStop etc.

 

Hope you understand what I'm saying. Basically, change the input commands so that they don't affect SFM automatically, then feed the SFM the commands it needs (filtered/scaled/changed as desired) to move the rudder. You _might_ need to also then animate the rudder anim arg yourself, I'm not sure... but I think doing the dispatch will get the SFM to animate it for you, unless you're using a non-standard anim arg for the rudder (in which case you'd need to animate it yourself anyway with set_aircraft_draw_argument_value). If you plan on implementing any kind of electrical and hydraulic systems, you'll want to eventually "disconnect" the DCS inputs from the SFM anyway, so that you can insert your electrical/hydraulic/damage logic inbetween.

 

For your specific case, it sounds like you'll want to scale the rudder input value based on your NWS setting when you have weight on wheels (e.g. get_base_data().getWOW_NoseLandingGear() ), and when you have no weight on wheels you want to pass along an unchanged rudder input value.

____________

Heatblur Simulations

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

I was under the impression dispatch action was disabled...

I've read that too, but it works fine for me. In fact, if it were to get disabled, it would give me a lot of problems, I used it in many places for this kind of thing.

 

One question though, why do you have to define the command locally? Im assuming to dispatch the action you have to?

I think those iCommandFoo things are only defined in the keyb/joystick files, those constants don't seem to exist within avLuaDevice context, so you need to re-define them.

 

Thanks a lot though, I have been wondering about this for a while.

 

Do you have more info on creating electrical systems and detaching the inputs? I was looking to start creating mine soon, but wasnt sure how it works. Actually, I was just planning on putting everything in a giant if block (if dc/ac == 1, do all my FCS stuff) but I know thats not the accepted way :helpsmilie:

 

Well, you can use and extend the avSimpleElectricSystem device, but it doesn't really give you much, beyond simulating two generators (which are on if the engine RPM is above about 40%) and two batteries, and I think one DC (which is just on if the AC is on). All we really did is simulate the 8 electrical busses the A-4E has (some AC, some DC, no batteries), and tie the logic of the relevant systems relying on those power busses to them, so that the relevant systems are disabled when their power goes of, and implemented RAT (ram air turbine) which powers some (but not all) of those busses when deployed etc. The params (see get_param_handle) are useful for sharing info between Lua (and C++) device code, and you can then implement an API on top of them.

____________

Heatblur Simulations

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 10 months later...

Hello everyone,

@gyrovague I would need some help.

I'm trying to implement an electrical system with avSimpleElectricSystem, but I can not change the bus status.

I tried with several commands but I have no Device response.

If I start with a powered engine mission I have a value of 28 on the two DC_Bus and 0 on the two AC_Bus and I can not change the state and even pushing the motor I have the same values.

 

my test code

 

in device_init.lua

creators[devices.TEST_DEVICES] = {"avSimpleElectricSystem", LockOn_Options.script_path.."Test_Devices.lua"}

 

in Test_Devices.lua

local electric_system = GetSelf()

local update_time_ms = 1.0/20.0

 

make_default_activity(update_time_ms)

 

local sensor_data = get_base_data()

 

local Generator_2 = 10317

 

electric_system:listen_command(Generator_2)

 

function SetCommand(command,value)

 

if command == Generator_2 then

 

electric_system: AC_Generator_1_on(true)

electric_system: AC_Generator_2_on(true)

electric_system: DC_Battery_on(true)

 

end

 

print_message_to_user("AC 1 "..electric_system:get_AC_Bus_1_voltage())

print_message_to_user("AC 2 "..electric_system:get_AC_Bus_2_voltage())

print_message_to_user("DC 1 "..electric_system:get_DC_Bus_1_voltage())

print_message_to_user("DC 2 "..electric_system:get_DC_Bus_1_voltage())

 

end

 

 

 

I tried these commands

electric_system: DC_Battery_on(1)

electric_system: DC_Battery_on(true)

electric_system: DC_Battery_on(value > 0)

electric_system: DC_Battery_on()

 

I think you expect a int but I've also tried these

electric_system: DC_Battery_on("1")

electric_system: DC_Battery_on("on")

 

with different types of variable but without result.

You might have what type of command I need to send, what do you expect the function as a parameter?

Thanks a lot for the help. See you soon

Link to comment
Share on other sites

hi, I read a response that is now deleted, saying that I have to set the bus voltage.

I tried but I can not get it running.

I can read some value but I can not change anything.

 

In F16Demo mod I found this:

electric_system: AC_Generator_1_on (value> 0)

electric_system: AC_Generator_2_on (value> 0)

electric_system: DC_Battery_on (value> 0)

 

but with that command I always get the same values and do not modify anything even by trying other values.

 

I would like to implement a bit of things, such as Radio or ADI and ILS, and I think that they must be powered.

 

Is anybody so polite to give me a clue how to try?

Thank you very much.

See you soon

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I did a lot of tests and in the end I found commands to turn on and off the electric BUS.

simply:

Test: AC_Generator_1_on (true)

Test: AC_Generator_2_on (true)

Test: DC_Battery_on (true)

 

There are 28 volts when the battery is switched on in the DC BUS.

 

When the generators are switched on and the engine RPMs exceed 40% in the AC BUS, there are 115 volts.

 

I failed to change this values.

 

I hoped that having powered the BUS the avionics systems worked, I did tests on the radio system and the ADI but I can not make them work.

 

Does anyone have any ideas?

Thanks, see you soon

Link to comment
Share on other sites

  • Recently Browsing   0 members

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