Jump to content

New project, Saitek Pro Flight Radio Panel + DCS (C#)


Recommended Posts

I am doing some initial research on how to communicate with DCS over TCP/UDP sockets.

I have found bits and pieces around the forum but nothing comprehensive.

 

The areas then I need documentation for is:

 

  • Opening/closing socket communication with DCS
  • Sending/receiving parameters
  • What parameters are available?

Open & existing code would be really helpful regardless of programming language.

 

If I start this project I will include the radio panel into the existing switch panel software.

 

 

Any help greatly appreciated!

Link to comment
Share on other sites

Excellent, I will have a looksy at that. Looks good. Thanks!

 

You could also check the wiki in my signature.

[sIGPIC][/sIGPIC]

 

Creator of:

 

F-18C VFA-195 "Dambusters" 1998 CAG Livery

https://forums.eagle.ru/showthread.php?t=213788

 

F-18C VFA-195 "Dambusters" July 2001 CAG Livery

https://forums.eagle.ru/showthread.php?t=215950

 

Pilot avatars for DCS Logbook

https://forums.eagle.ru/showthread.php?t=221160

 

How to make a DCS A-10C Panel

http://forums.eagle.ru/showthread.php?t=65998

Link to comment
Share on other sites

Any help greatly appreciated! Day off (sick) and trying to test the Export.lua with simple file exporting.

 

Non steam installation, where is the Export.lua supposed to be and where should Config.lua be?

I just can't get any (test) exports going? I have seen references to both config.lua and Config.lua.

And the comment inside Export.lua : " -- Please, set EnableExportScript = true in the Config/Export/Config.lua file -- to activate this script!"

Now which Config.lua would that be? I do not have any Config/Export dir structure in my installation and the Export.lua is supposed to be copied to the user directory structure for DCS!? So that means what in regards of "Config/Export/Config.lua"?

 

I tried :

C:\Users\<user>\Saved Games\DCS\Scripts\Export.lua

D:\Eagle Dynamics\DCS World\Config\Export\Config.lua (created that dir per info found on forum)

 

DCS 1.2.8

Testing with the UH-1H module

 

Export.lua:

--- DO NOT EDIT.
--- This file is for reference purposes only
--- All user modifications should go to $HOME\Saved Games\DCS\Scripts\Export.lua

-- Data export script for Lock On version 1.2.
-- Copyright (C) 2006, Eagle Dynamics.
-- See http://www.lua.org for Lua script system info 
-- We recommend to use the LuaSocket addon (http://www.tecgraf.puc-rio.br/luasocket) 
-- to use standard network protocols in Lua scripts.
-- LuaSocket 2.0 files (*.dll and *.lua) are supplied in the Scripts/LuaSocket folder
-- and in the installation folder of the Lock On version 1.2. 

-- Please, set EnableExportScript = true in the Config/Export/Config.lua file
-- to activate this script!

-- Expand the functionality of following functions for your external application needs.
-- Look into ./Temp/Error.log for this script errors, please.

-- Uncomment if using Vector class from the Config/Export/Vector.lua file 
--[[    
LUA_PATH = "?;?.lua;./Config/Export/?.lua"
require 'Vector'
-- See the Config/Export/Vector.lua file for Vector class details, please.
--]]

local default_output_file = nil

function LuaExportStart()
-- Works once just before mission start.
-- Make initializations of your files or connections here.
-- For example:
-- 1) File
  default_output_file = io.open("./Temp/Export.log", "w")
-- 2) Socket
--  package.path  = package.path..";.\\LuaSocket\\?.lua"
--  package.cpath = package.cpath..";.\\LuaSocket\\?.dll"
--  socket = require("socket")
--  host = host or "localhost"
--  port = port or 8080
--  c = socket.try(socket.connect(host, port)) -- connect to the listener socket
--  c:setoption("tcp-nodelay",true) -- set immediate transmission mode
-- 
    local version = LoGetVersionInfo() --request current version info (as it showed by Windows Explorer fo DCS.exe properties)
   if version and default_output_file then
        
        default_output_file:write("ProductName: "..version.ProductName..'\n')
        default_output_file:write(string.format("FileVersion: %d.%d.%d.%d\n",
                                                version.FileVersion[1],
                                                version.FileVersion[2],
                                           version.FileVersion[3],
                                                version.FileVersion[4]))
        default_output_file:write(string.format("ProductVersion: %d.%d.%d.%d\n",
                                                version.ProductVersion[1],
                                                version.ProductVersion[2],
                                                version.ProductVersion[3],  -- head  revision (Continuously growth)
                                               version.ProductVersion[4])) -- build number   (Continuously growth)    
   end

end

function LuaExportBeforeNextFrame()
-- Works just before every simulation frame.

-- Call Lo*() functions to set data to Lock On here
-- For example:
--    LoSetCommand(3, 0.25) -- rudder 0.25 right 
--    LoSetCommand(64) -- increase thrust

end

function LuaExportAfterNextFrame()
-- Works just after every simulation frame.

-- Call Lo*() functions to get data from Lock On here.
-- For example:
--    local t = LoGetModelTime()
--    local name = LoGetPilotName()
--    local altBar = LoGetAltitudeAboveSeaLevel()
--    local altRad = LoGetAltitudeAboveGroundLevel()
--    local pitch, bank, yaw = LoGetADIPitchBankYaw()
--    local engine = LoGetEngineInfo()
--    local HSI    = LoGetControlPanel_HSI()
-- Then send data to your file or to your receiving program:
-- 1) File
-- if default_output_file then
--      default_output_file:write(string.format("t = %.2f, name = %s, altBar = %.2f, altRad = %.2f, pitch = %.2f, bank = %.2f, yaw = %.2f\n", t, name, altBar, altRad, 57.3*pitch, 57.3*bank, 57.3*yaw))
--      default_output_file:write(string.format("t = %.2f ,RPM left = %f  fuel_internal = %f \n",t,engine.RPM.left,engine.fuel_internal))
--      default_output_file:write(string.format("ADF = %f  RMI = %f\n ",57.3*HSI.ADF,57.3*HSI.RMI))
--    end
-- 2) Socket
--    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)))

end

function LuaExportStop()
-- Works once just after mission stop.
-- Close files and/or connections here.
-- 1) File
  if default_output_file then
     default_output_file:close()
     default_output_file = nil
  end
-- 2) Socket
--    socket.try(c:send("quit")) -- to close the listener socket
--    c:close()
end

....

Link to comment
Share on other sites

I don't think the enable bit is needed anymore as each aircraft has its own config.lua in your user files.

your path for export is correct.

AMD A8-5600K @ 4GHz, Radeon 7970 6Gig, 16 Gig Ram, Win 10 , 250 gig SSD, 40" Screen + 22 inch below, Track Ir, TMWH, Saitek combat pedals & a loose nut behind the stick :thumbup:

Link to comment
Share on other sites

Got it.

 

"EnableExportScript = true" to the file:

"D:\Eagle Dynamics\DCS World\Mods\aircrafts\Uh-1H\Cockpit\Scripts\config.lua"

 

Export commands in this file:

"C:\Users\<user>\Saved Games\DCS\Scripts\Export.lua"

 

The directory above was named Script instead of Scripts. Silly. :music_whistling:

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

What a pitty. I donated some bucks because I already enjoy the flight panel Interface and would love to use the Saitek Radio Panel to work with DCS. So guys, come on, donate some bucks to get Arthur's DevKit. I appreciate his initiative! Some more guys with some euros could make this project start.

Windows 10, I7 8700k@5,15GHz, 32GB Ram, GTX1080, HOTAS Warthog, Oculus Rift CV1, Obutto R3volution, Buttkicker



[sIGPIC][/sIGPIC] ЯБоГ32_Принз





Link to comment
Share on other sites

  • 4 weeks later...
Donated sum is now 47€. Thanks!

 

Hi Artur,

Merry christmasts!!!

How are donations flowing? You're right about Saitek, more documentation can only benefit them and then us, everyone wins here.

 

I'm planning to buy the Pro flight panel soon because of your kind work, I will donate in euros for sure. BTW, in the meantime, would be cool if you can do something about the landing gear lights in that panel using the export.lua events. Could be possible?

 

Thank you in advance!

Win 8.1, I7 4770K 4.5ghz watercooled, 240gb SSD in Raid 0, 16GB DDR3-2400, EVGA GTX780 watercooled, LG 29EA73-P (2560x1080)

Cobra M5 *modded by BRD*, CH Pro Throttle, Pro Combat Pedals, TrackIR5 Pro + Delanclip, Bose QC 15, TM Cougar MFD's

300/30 mbps

Link to comment
Share on other sites

Hi Artur,

Merry christmasts!!!

How are donations flowing? You're right about Saitek, more documentation can only benefit them and then us, everyone wins here.

 

I'm planning to buy the Pro flight panel soon because of your kind work, I will donate in euros for sure. BTW, in the meantime, would be cool if you can do something about the landing gear lights in that panel using the export.lua events. Could be possible?

 

Thank you in advance!

Thank you, same same. Yes it is possible to have something going there. I will look into it later.

Link to comment
Share on other sites

  • 2 weeks later...

donation sent!

 

Thanks ArturDCS

skunk160 | Win10 PRO 64bit | i7-4770K 3.50 GHz | 32GB DDR3/1866MHz | GIGABYTE GeForce GTX 1080 x2 | Oculus Rift S | Virpil MongoosT-50CM2 | Virpil F-14B grip | Virpil 200m Curved Extension | PointCTRL | Delta Sim TM Slew | Sim Bandit AHCP | MFG Crosswind Pedals | //FOX2 Switch Boxes | RECARO SPG Seat | AuraSound AST-2B-4 Pro Bass Transducer x2

//FOXTWO Multi-Role Combat Pit Build http://forums.eagle.ru/showthread.php?t=134745

Link to comment
Share on other sites

:thumbup: Just added Saitek Pro Flight Radio Panel to my Amazon basket in eager anticipation because of this thread

  • Like 1

skunk160 | Win10 PRO 64bit | i7-4770K 3.50 GHz | 32GB DDR3/1866MHz | GIGABYTE GeForce GTX 1080 x2 | Oculus Rift S | Virpil MongoosT-50CM2 | Virpil F-14B grip | Virpil 200m Curved Extension | PointCTRL | Delta Sim TM Slew | Sim Bandit AHCP | MFG Crosswind Pedals | //FOX2 Switch Boxes | RECARO SPG Seat | AuraSound AST-2B-4 Pro Bass Transducer x2

//FOXTWO Multi-Role Combat Pit Build http://forums.eagle.ru/showthread.php?t=134745

Link to comment
Share on other sites

  • Recently Browsing   0 members

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