Jump to content

how to bus data to/from Export.lua and java app?


Recommended Posts

Hi,

 

I am skilled in Java and am currently learning LUA so that i can make a mod fro DCS world and FC3.

 

However I have a problem in getting the data exported from DCS World FC3 in the Export.lua file to be imported to my Java app and vice verse.

 

DCS calls the function LuaExportAfterNextFrame every time the simulation frame finishes. So you need to code here your actions to get frame simulations results. For example:

 

local t = LoGetModelTime()

local name = LoGetPilotName()

local altBar = LoGetAltitudeAboveSeaLevel()

local altRad = LoGetAltitudeAboveGroundLevel()

local pitch, bank, yaw = LoGetADIPitchBankYaw()

Then you can send data to your file:

 

io.write(string.format("t = %.2f, name = %s, altBar = %.2f, altRad = %.2f, pitch = %.2f, bank = %.2f, yaw = %.2f\n", t, name, altBar, altRad, pitch, bank, yaw))

or to your receiving network program:

 

socket.try(c:send(string.format("t = %.2f, name = %s, altBar = %.2f, alrRad = %.2f, pitch = %.2f, bank = %.2f, yaw = %.2f\n", t, name, altRad, altBar, pitch, bank, yaw)))

 

I guess as i have no networking experience, I have a few question:

  1. Should the sim data being set to the Java app be from server if in multiplayer, or just the client PC the Java app is on? I'm thinking the later...
  2. should i transmit data from DCS to the java app by a buffer type io.write or use a port between the two programs? here i think an io.write file will keep network trafic down but don't know aobut maintaining a ever increasing data file and the current line within such. advice?
  3. can you give me a breife pesudo algorithym of how it should be structured?

Link to comment
Share on other sites

Hi,

 

I created a small Python-based software to exchange data between DCS and my Arduino. You have to setup a local udp network. I guess JAVA API does provide a simple solution to listen to a specific network socket. in the .lua file you have to specify the upd connection information(host, port).

 

Bye,

F4l0

Link to comment
Share on other sites

  • Recently Browsing   0 members

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