memento10 Posted July 19, 2010 Posted July 19, 2010 (edited) Does anyone know of a way for to get Sioc to send commands not in Clickabledata.lua? For example pulling the trigger to fire the gun is not in clickabledata.lua. I found some code for this in Ka-50\Config\Input\Aircrafts\ka-50\joystick\default.lua: {combos = {{key = 'JOY_BTN1'}}, down = iCommandPlaneFire, up = iCommandPlaneFireOff, name = 'Gun fire', category = 'Ins Cyclic Stick'}, Any ideas if this possible...? I'd rather not use a keyboard emulator for this if it's just a matter of figuring out the code that would work! Edit: I also found these in Ka-50\Scripts\Input\InputEvents: . . . -- joystick keys inputEvents['JOY_BTN1'] = JOYSTICK_BUTTON0 inputEvents['JOY_BTN2'] = JOYSTICK_BUTTON1 inputEvents['JOY_BTN3'] = JOYSTICK_BUTTON2 inputEvents['JOY_BTN4'] = JOYSTICK_BUTTON3 inputEvents['JOY_BTN5'] = JOYSTICK_BUTTON4 inputEvents['JOY_BTN6'] = JOYSTICK_BUTTON5 inputEvents['JOY_BTN7'] = JOYSTICK_BUTTON6 inputEvents['JOY_BTN8'] = JOYSTICK_BUTTON7 inputEvents['JOY_BTN9'] = JOYSTICK_BUTTON8 . . . Could it be as simple as assigning JOY_BTN1 or JOYSTICK_BUTTON0 a certain value in the SiocConfig? Edited July 19, 2010 by memento10
C6_Hellfrog Posted July 19, 2010 Posted July 19, 2010 I don't understand your question ... if you use SIOC : SIOC may emulate some keys via the variable 'key emulator' (the last in the list) so it is simplier to use SIOC and send an emulated keystroke . No ?
memento10 Posted July 20, 2010 Author Posted July 20, 2010 It would be simpler but sioc won't send an emulated keystroke over the network unless you use an actual keyboard emulator. I may have to give in and buy one, currently I'm using all Opencockpit cards. According to them it's not possible to send a keystroke over the network using their mastercard. reference: http://www.lekseecon.nl/howto.html#keygen
m0jo Posted July 20, 2010 Posted July 20, 2010 According to them it's not possible to send a keystroke over the network using their mastercard. That is normal because on the BS computer, only the sim itself is connected to the IOCards server (sioc.exe). The emulated keystroke is only working on the computer where sioc.exe is running because sioc.exe is sending those keystroke directly to the OS. There are 2 solution to this problem, the first one is to program a client to SIOC and this program could read the variable value of SIOC and send the appropriate keystroke to the OS. Another solution is using a program like synergy to relay the keystrokes between the computer running sioc.exe and the computer running the simulator.
memento10 Posted July 20, 2010 Author Posted July 20, 2010 (edited) Thanks Mojo, both options look interesting: 1) How would I go about the programming? Could I just figure out the lua code in the SiocConfig.lua on the BS computer that could send a keystroke? That would probably be the most ideal option although I'm not sure I have the skill to do this. So: - a switch is pressed on the client PC - a variable changes on the client PC - that variable is programmed to a variable in the BS computer's SiocConfig.lua file - lua programming so that when the variable changes, a keystroke is sent to BS Is that correct? 2) Synergy looks like an interesting option, if I can't figure out option 1, then that would be good to try. Edited July 20, 2010 by memento10
m0jo Posted July 20, 2010 Posted July 20, 2010 1) How would I go about the programming? Could I just figure out the lua code in the SiocConfig.lua on the BS computer that could send a keystroke? The first solution is to program a client to SIOC and this do not need any interfacing with BS. This program could be coded in C or any other language as long as it can connect to the server(sioc.exe) and read the variable of SIOC. When a switch is pressed in the physical cockpit, a variable change from 0 to 1 inside sioc.exe and the new client program see this change and send the right keystroke. The solution #2 can work directly out of the box but is not as clean as the first one
C6_Hellfrog Posted July 21, 2010 Posted July 21, 2010 hey, have a look at this thread http://forums.eagle.ru/showthread.php?t=56067 ! posts 8 -10
sweinhart3 Posted July 23, 2010 Posted July 23, 2010 I just purchased several OC cards for both input/output and I am trying to find some current information on how to link SIOC with the export.lua files found in the DCS simulation series. Any help would be appreciated and code examples would be even more appreciate. Intel i7 990X, 6GB DDR3, Nvidia GTX 470 x2 SLI, Win 7 x64 http://picasaweb.google.com/sweinhart
m0jo Posted July 24, 2010 Posted July 24, 2010 (edited) sweinhart3 said: I just purchased several OC cards for both input/output and I am trying to find some current information on how to link SIOC with the export.lua files found in the DCS simulation series. Any help would be appreciated and code examples would be even more appreciate. You can use Oakes script available at google code to interface OC cards with BS : dcsbsexport. Also, some information can be found in Oakes thread. My config files with Oakes export script are available at Edited December 31, 2023 by m0jo
sweinhart3 Posted July 24, 2010 Posted July 24, 2010 (edited) Thanks. Im very unfamiliar with LUA programming and SIOC programming but Ill try to make some sense of it. If I cant figure it out I may have to reprogram the pic code and create my own app. Edited July 24, 2010 by sweinhart3 Intel i7 990X, 6GB DDR3, Nvidia GTX 470 x2 SLI, Win 7 x64 http://picasaweb.google.com/sweinhart
sweinhart3 Posted August 3, 2010 Posted August 3, 2010 I spent most of the day yesterday looking at the coding in the SIOC examples posted earlier. The code seems to call out files that dont exist in the examples such as myIndicators.lua. I havent been able to figure out the SIOC program or what coding is necessary to run it. The program always calls for sioc.ssi even if I try to load some of the other examples. It also seems to try to call config_SIOC.cfg which from what I can tell doesnt contain anything. It gives an error stating it cant find it. So Im wondering exactly what files need to be included to run SIOC.exe which Im assuming is necessary for it all to work. Secondly, while the examples are great, Im using the USB_Outputs card which isnt called out in the coding examples. I am trying to program 1 LED output on this card in this system to nose landing gear with BS just as proof of concept. It seems like Im needing help to do just this one thing. I think if I can get a working example of just this one thing, I can build it up from there. Since Im wanting to progam for DCS-A10C, I really need just a working proof of concept for now with that 1 card. Intel i7 990X, 6GB DDR3, Nvidia GTX 470 x2 SLI, Win 7 x64 http://picasaweb.google.com/sweinhart
sweinhart3 Posted August 4, 2010 Posted August 4, 2010 I think I figured it out. I managed to get nose landing gear up and down indicators output to my board and working in the sim. Next job will be applying a switch to it. Intel i7 990X, 6GB DDR3, Nvidia GTX 470 x2 SLI, Win 7 x64 http://picasaweb.google.com/sweinhart
Oakes Posted August 5, 2010 Posted August 5, 2010 The first solution is to program a client to SIOC and this do not need any interfacing with BS. This program could be coded in C or any other language as long as it can connect to the server(sioc.exe) and read the variable of SIOC. When a switch is pressed in the physical cockpit, a variable change from 0 to 1 inside sioc.exe and the new client program see this change and send the right keystroke. The solution #2 can work directly out of the box but is not as clean as the first one I don't know if this problem was solved or not, but if you still need a SIOC to keyboard client, have a look here: http://forums.eagle.ru/showthread.php?t=37417 /Oakes
sweinhart3 Posted August 8, 2010 Posted August 8, 2010 So I was messing with the sioc programming in prep for A-10 but I went ahead and hooked up a bunch of my outputs and tested with several BS functions. One thing of note, I tied one of my outputs to the Master Caution and noticed that the rate of blinking in th cockpit and LED did not match up. In fact about every 3 or 4 blinks it seemed to skip a blink. Anyone else have this issue or know of the fix? Besides that minor annoyance its working good. If only I had access to the A-10C export files. Intel i7 990X, 6GB DDR3, Nvidia GTX 470 x2 SLI, Win 7 x64 http://picasaweb.google.com/sweinhart
C6_Hellfrog Posted August 8, 2010 Posted August 8, 2010 Hi, many factors inside : desynchronization is usual if you run SIOC and BS on the same rig, and it depends on the CPU load (high level mission...) and CPU frequency (i7, OVC...) and the size of lua subrutines to run, and their place (each frame, each 1/t seconds) and the complexity of SIOC program... if you run very complex cockpit programmation, best is to use another PC for SIOC, if you can... or to upgrade yours (although it is a good specs indeed, but 3.5 GHz only, and not best use of multicores on BS...) and Seven is best than XP for BS...
sweinhart3 Posted August 9, 2010 Posted August 9, 2010 (edited) I was using a test version of SIOC code that did not have much scripting in it. The files are actually pretty small. Output code that controls my LEDs are in the Export-after-every-frame section, so it should be real time output. Is a second computer really necessary for correct timing? Just doesnt seem right given that Im running a decent pc. (Admittedly Im testing this using a laptop with dual core 2.5Ghz, but the sim runs fine on it with good frame rate so I didnt think this should be an issue. Both my pcs use 64bit versions of vista and win7. Is there a way to assign it to a new thread for better processor utilization?) Edited August 9, 2010 by sweinhart3 Intel i7 990X, 6GB DDR3, Nvidia GTX 470 x2 SLI, Win 7 x64 http://picasaweb.google.com/sweinhart
y2kiah Posted August 9, 2010 Posted August 9, 2010 Have you actually checked the output values sent to SIOC server from export.lua, or are you assuming they match the on-screen representation? It sounds like you are describing two problems, a delay and also skipping every 3rd or 4th blink? If the problem is performance then the symptom might be a delay, but that doesn't explain a pattern of skipping. You could test for where the delay is being introduced. Are you setting the tcp_nodelay option on the socket in your script?
sweinhart3 Posted August 9, 2010 Posted August 9, 2010 (edited) Um Im pretty new to programming the export files and dont know a great deal about it. However, what I did was take the files from Oakes web page and simply changed a couple of the output variables to map to say, landing gear and master caution lights instead of the datalink indicators. In other words, right now the only file that has been modified is the siocConfig.lua file. The rest of the files, Export.lua, ExportSupport.lua are untouched. There doesnt appear to be a delay. For instance, the lamps associated with the landing gear work with no perceivable delay between what the sim shows on screen and what happens on my output panel as I cycle between gear up/dwn. Blinking lights are a different story for some reason. My output panel is only blinking at maybe 2/3 the rate of the blinking on screen and then as mentioned before will skip a blink and just generally be completely out of sync with whats on the screen. As far as the tcp_nodedelay option goes, I didnt touch that because i know nothing about what it does or what it should be set too. Edited August 9, 2010 by sweinhart3 Intel i7 990X, 6GB DDR3, Nvidia GTX 470 x2 SLI, Win 7 x64 http://picasaweb.google.com/sweinhart
memento10 Posted August 10, 2010 Author Posted August 10, 2010 My blinking lights also don't match the sim perfectly. I agree with Hellfrogs explanation and I can live with it. There can also be slight delays between flicking a switch and the sim recognizing the change.
sweinhart3 Posted August 10, 2010 Posted August 10, 2010 There should be no good reason for a delay tho, especially on a relatively simple script. If anyone knows the fix pls post. Intel i7 990X, 6GB DDR3, Nvidia GTX 470 x2 SLI, Win 7 x64 http://picasaweb.google.com/sweinhart
Gadroc Posted August 10, 2010 Posted August 10, 2010 Make sure you are interpreting the values correctly. I ran into the same problem with some of my touch screen indicator buttons. It turned out I was not reading all the state values correctly from the LUA export. The thread below lists some common patterns, but some of the indicators are 0.0 and 1.0 or 0.0 - 0.1. Do some experimentation. http://forums.eagle.ru/showthread.php?t=45500 Lastly when exporting the data make sure you trim the value as the binary numbers flutter a little bit (sometimes zero becomes -0.000000000000001). This causes simple comparisons in script to fail (aka variable != 0) when you don't expect them to. I use the following code to sort that out. It's passed in format (most common %.2f) and the value you get out of sim. local value = string.format(format, rawvalue); if string.len(value) > 3 and value == string.sub("-0.00000000",1, string.len(value)) then value = value:sub(2) end
sweinhart3 Posted August 10, 2010 Posted August 10, 2010 (edited) thanks Ill look into it a bit. How are you able to snoop out the values being sent by the sim? Especially in real time? I tried mapping one of the outputs to the low rotor rpm warning as well which doesnt have a switch attached to it and it was doing the same thing. Edited August 10, 2010 by sweinhart3 Intel i7 990X, 6GB DDR3, Nvidia GTX 470 x2 SLI, Win 7 x64 http://picasaweb.google.com/sweinhart
C6_Hellfrog Posted August 10, 2010 Posted August 10, 2010 create a log file in the export.lua write values in it run BS after that read log file
sweinhart3 Posted August 10, 2010 Posted August 10, 2010 I guess the export file was outputting the indicators after next event. I moved to export every frame and its much better. Intel i7 990X, 6GB DDR3, Nvidia GTX 470 x2 SLI, Win 7 x64 http://picasaweb.google.com/sweinhart
Recommended Posts