Jump to content

Recommended Posts

Posted

When I execute this line in LuaExportActivityNextEvent(t), it works repeatedly:

 

socket.try(c:send(string.format("102,%s\n100,%.2f\n", LoGetPilotName(),LoGetModelTime())))

 

I've got my cycle time set to one second, so I see a packet every second.

 

However, if I add another line:

 

socket.try(c:send(string.format("201,%.2f\n", LoGetIndicatedAirSpeed())))

 

The Lua code executes only a single time, and the "201" packet is never sent.

 

I can only assume that the interpreter doesn't like the second send for some reason. However, NO "error.log" file is being created. I've searched the entire drive that I've got A-10C installed on as well as all the directories under my user account (Windows 7).

 

Any suggestions?

 

tnx.

Proud owner of 80-0007.

http://www.f15sim.com - The only one of her kind.

Posted

Try to execute the lines in a standalone lua script. Of course you will have to substitute the LoGet*-functions for some hardcoded values. When you have more control of the execution it will be easier to locate the error :)

Digital-to-Synchro converter for interfacing real aircraft instruments - Thread

 

Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13

 

www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen.

Posted

Works for me in the lua interpreter with hardcoded values. Have you used LoGetIndicatedAirSpeed() before and are sure that it works?

Digital-to-Synchro converter for interfacing real aircraft instruments - Thread

 

Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13

 

www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen.

Posted

Honestly, the last time I used LoGetIndicatedAirSpeed() was 2003 and LockOn v1.

 

I'd already tried the code in SciTE to make sure I wasn't doing something obviously stupid. This leaves the non-obviously stupid. :)

 

tnx.

 

g.

Proud owner of 80-0007.

http://www.f15sim.com - The only one of her kind.

Posted

Are you sure that you have the local tNext=t, tNext=tNext+1.0 and return tNext?

Digital-to-Synchro converter for interfacing real aircraft instruments - Thread

 

Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13

 

www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen.

Posted

I do. I stopped using the LoGetIndicatedAirspeed() and it works fine now.

 

The issue I have now is where do I find the equivalent call to use with the get_argument_value() calls. What I've found (for example, IAS), isn't giving me sensible values.

The example I'm trying is:

 

local MainPanel = GetDevice(0)

local ias = MainPanel:get_argument_value(61)

socket.try(c:send(string.format("201,%.2f\n", ias)))

 

Is there any single place where these interfaces are documented? It appears to be scattered all over the place, willy nilly.

 

It's especially frustrating that the given function calls in Export.lua don't work.

 

tnx.

 

g.

Proud owner of 80-0007.

http://www.f15sim.com - The only one of her kind.

Posted

Yeah, unfortunately all this is extremely badly documented. I don't have the answer to your question, but I am sure someone does.

Digital-to-Synchro converter for interfacing real aircraft instruments - Thread

 

Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13

 

www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen.

Posted

This is what I've got in my example:

function LuaExportActivityNextEvent(t)
   local tNext = t

   local MainPanel = GetDevice(0)
   local hsi_heading = MainPanel:get_argument_value(34)
   local airspeed = LoGetIndicatedAirSpeed()

   socket.try(c:send(string.format("102,%s\n100,%.2f\n", LoGetPilotName(),LoGetModelTime())))
   --socket.try(c:send(string.format("201,%.2f\n", 251.0)))
   socket.try(c:send(string.format("201,%.2f\n", airspeed)))
   
   tNext = tNext + 1.0
   return tNext
end

 

As it sits now, it goes through a single iteration and the uncommented send is never executed. If I change it so it sends out the literal value instead of the variable version, it works without issue.

 

No error.log is produced, ever.

 

Other people are doing this all the time, so I know that there's got to be something specific to what I'm doing that's making this not work, I just don't know what because I'm not getting any feedback from the runtime system.

 

Is there an issue with the 1.1.1.1 version I'm using? Is there a way to get DCS World to recognize I've already purchased A-10C so I can use it from there (with the potential of a fixed bug or two?)

 

Help!

 

g.

Proud owner of 80-0007.

http://www.f15sim.com - The only one of her kind.

Posted (edited)

Maybe airspeed is an integer and you get an error because you are trying to print it as a float? I don't know Lua very well.

 

Edit: Just tested with my lua interpreter and that shouldn't be a problem.

 

When the code looks exactly as it does in your latest post, do you get the first send to work?

Edited by brydling

Digital-to-Synchro converter for interfacing real aircraft instruments - Thread

 

Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13

 

www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen.

Posted (edited)

I played around a little. One way of obtaining IAS in knots is this:

 

local MainPanel = GetDevice(0)
local airspeed_normalized = MainPanel:get_argument_value(48)
local airspeed = 23334.24762*math.pow(airspeed_normalized,7) - 86517.40721*math.pow(airspeed_normalized,6) + 127203.45*math.pow(airspeed_normalized,5) - 94049.54588*math.pow(airspeed_normalized,4) + 36673.49185*math.pow(airspeed_normalized,3) - 7313.376274*math.pow(airspeed_normalized,2) + 1218.908732*airspeed_normalized + 2.953079734e-1
socket.try(c:send(string.format("201,%.2f\n", airspeed)))

 

I don't know how the math.pow-function in Lua is implemented, but there is a risk that this code is pretty CPU-hungry. I tried executing it every frame and didn't notice any FPS-drops.

Edited by brydling

Digital-to-Synchro converter for interfacing real aircraft instruments - Thread

 

Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13

 

www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen.

Posted

The problem is that the Lo* functions appear to work - at least they don't "crash" the script.

 

The %.2f mask is what I used in LOMAC v1, using the same function call....

 

g.

Proud owner of 80-0007.

http://www.f15sim.com - The only one of her kind.

Posted

Maybe LoGetIndicatedAirSpeed returns nil for A-10C, and when that is passed to string.format the script stops. Test local airspeed = nil and see if it produces the same result.

 

It may be wasted time however, the function does not seem to work for A-10C and I don't think there is anything we can do about it. The code that I posted works :)

Digital-to-Synchro converter for interfacing real aircraft instruments - Thread

 

Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13

 

www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen.

Posted

Where did you find the equation that allowed you to derive the airspeed based on the position of the airspeed needle?

 

If calculations are required, I can handle those on the computer running the hardware interface.

 

Thanks!

 

g.

Proud owner of 80-0007.

http://www.f15sim.com - The only one of her kind.

Posted

I calculated it from a table that I found in one of the lua-files.

Digital-to-Synchro converter for interfacing real aircraft instruments - Thread

 

Check out my High Input Count Joystick Controller for cockpit builders, with support for 248 switches, 2 POV hats and 13 analog axes. Over 60 units sold. - B256A13

 

www.novelair.com - The world's most realistic flight simulators of the J35J Draken and the AJS37 Viggen.

  • Recently Browsing   0 members

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