Open jhl6 opened 1 week ago
Yes that is possible, you can either read a gauge value or read the Common Telemetry Data from the sim.
You can use the Bort Testing Tool to find values you are looking to read based on the module.
By looking in the under the CommonData
Module in BORT, we can find the IAS_US
which stands for Indicated Airspeed US (knots). You could also look at the airplane module such as FA-18C-hornet
def handle_airspeed_change(value):
print("Airspeed=", value)
bios.on("IAS_US", handle_airspeed_change)
Image of FA-18C-hornet
in bort
Image: Airspeed Indicated Knots CommonData
in bort
Hello PapiPlanes,
Thanks for your info. I'm new to python, but I'm getting there. I have a Question. What I like to do is that I can send the value out over a socket to etherent. Is this possible, and can you put me in the right direction. (maybe with a example)
Is it also possible to use your setup with c#?
With kind regards Jan Hein
1: Sending values over socket? Yes, there are plenty of examples online of creating a socket and sending data on it. Here is a video I found googling. You would just adapt the payload of the udp packet to include DCS related values from this library.
2: Using this in C#? You're best bet is to re-write this library in C#. There are ways to use python libraries, but not easily and it would not be a clean solution.
Hello,
I have your script running, but have some strange behavior. I use the F-16 module in DCS. I'm reading 10 values. That is running OK But a few values are very slow in responding. Example: When I change the frequentie in the UHF module it take sabout 1 - 2 seconds to change the value in your script. When I change the presets in the UHF module it is responding with no delay. Also the values of the CMDS module have the same delay.
My question: Why are some values responding with a delay, and others are not.
I have tested the same values with Bort in DCS-Bios, and they are all responding ok. So there is a difference between responding of the values in Bort and your script. If this can not fixed, I can not use your script.
With kind regards, Jan Hein
Can you attach your code and I will try to reproduce and look into? Thank you
On Fri, Nov 15, 2024 at 12:20 AM jhl6 @.***> wrote:
Hello,
I have your script running, but have some strange behavior. I use the F-16 module in DCS. I'm reading 10 values. That is running OK But a few values are very slow in responding. Example: When I change the frequentie in the UHF module it take sabout 1 - 2 seconds to change the value in your script. When I change the presets in the UHF module it is responding with no delay. Also the values of the CMDS module have the same delay.
My question: Why are some values responding with a delay, and others are not.
I have tested the same values with Bort in DCS-Bios, and they are all responding ok. So there is a difference between responding of the values in Bort and your script. If this can not fixed, I can not use your script.
With kind regards, Jan Hein
— Reply to this email directly, view it on GitHub https://github.com/papiplanes/dcs_bios_connector/issues/1#issuecomment-2478208388, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLKA7MQQIV6BSF7SRM7YKXD2AWVEJAVCNFSM6AAAAABRPPB242VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZYGIYDQMZYHA . You are receiving this because you commented.Message ID: @.***>
from dcs_bios_connector import DcsBiosConnector bios = DcsBiosConnector() bios.connect()
temp = []
temp.append("CMDS_O1_AMOUNT") temp.append("CMDS_O2_AMOUNT") temp.append("CMDS_CH_AMOUNT") temp.append("CMDS_FL_AMOUN") temp.append("UHF_FREQ_DISP") temp.append("UHF_CHAN_DISP")
def DataVar_00(value, controlInformation, dataInformation): print(temp[0] + " = ", value) def DataVar_01(value, controlInformation, dataInformation): print(temp[1] + " = ", value) def DataVar_02(value, controlInformation, dataInformation): print(temp[2] + " = ", value) def DataVar_03(value, controlInformation, dataInformation): print(temp[3] + " = ", value) def DataVar_04(value, controlInformation, dataInformation): print(temp[4] + " = ", value) def DataVar_05(value, controlInformation, dataInformation): print(temp[5] + " = ", value)
while True: bios.on(temp[0], DataVar_00) bios.on(temp[1], DataVar_01) bios.on(temp[2], DataVar_02) bios.on(temp[3], DataVar_03) bios.on(temp[4], DataVar_04) bios.on(temp[5], DataVar_05)
The only one that has no delay is "UHF_CHAN_DISP" (orange) All the yellow have a delay.
[image: image.png]
With kind regards
Jan Hein Liebregts
Op vr 15 nov 2024 om 16:01 schreef papiplanes @.***>:
Can you attach your code and I will try to reproduce and look into? Thank you
On Fri, Nov 15, 2024 at 12:20 AM jhl6 @.***> wrote:
Hello,
I have your script running, but have some strange behavior. I use the F-16 module in DCS. I'm reading 10 values. That is running OK But a few values are very slow in responding. Example: When I change the frequentie in the UHF module it take sabout 1 - 2 seconds to change the value in your script. When I change the presets in the UHF module it is responding with no delay. Also the values of the CMDS module have the same delay.
My question: Why are some values responding with a delay, and others are not.
I have tested the same values with Bort in DCS-Bios, and they are all responding ok. So there is a difference between responding of the values in Bort and your script. If this can not fixed, I can not use your script.
With kind regards, Jan Hein
— Reply to this email directly, view it on GitHub < https://github.com/papiplanes/dcs_bios_connector/issues/1#issuecomment-2478208388>,
or unsubscribe < https://github.com/notifications/unsubscribe-auth/BLKA7MQQIV6BSF7SRM7YKXD2AWVEJAVCNFSM6AAAAABRPPB242VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZYGIYDQMZYHA>
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/papiplanes/dcs_bios_connector/issues/1#issuecomment-2479085090, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARM5EUUXEALWYA7TQ2ZXSVL2AYECPAVCNFSM6AAAAABRPPB242VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZZGA4DKMBZGA . You are receiving this because you authored the thread.Message ID: @.***>
It’s because you nested your event listeners in a while true loop. That code is running thousands of times a second causing your lag. Remove the “while True:”
On Fri, Nov 15, 2024 at 7:31 AM jhl6 @.***> wrote:
This is the code:
from dcs_bios_connector import DcsBiosConnector bios = DcsBiosConnector() bios.connect()
temp = []
temp.append("CMDS_O1_AMOUNT") temp.append("CMDS_O2_AMOUNT") temp.append("CMDS_CH_AMOUNT") temp.append("CMDS_FL_AMOUN") temp.append("UHF_FREQ_DISP") temp.append("UHF_CHAN_DISP")
def DataVar_00(value, controlInformation, dataInformation): print(temp[0] + " = ", value) def DataVar_01(value, controlInformation, dataInformation): print(temp[1] + " = ", value) def DataVar_02(value, controlInformation, dataInformation): print(temp[2] + " = ", value) def DataVar_03(value, controlInformation, dataInformation): print(temp[3] + " = ", value) def DataVar_04(value, controlInformation, dataInformation): print(temp[4] + " = ", value) def DataVar_05(value, controlInformation, dataInformation): print(temp[5] + " = ", value)
while True: bios.on(temp[0], DataVar_00) bios.on(temp[1], DataVar_01) bios.on(temp[2], DataVar_02) bios.on(temp[3], DataVar_03) bios.on(temp[4], DataVar_04) bios.on(temp[5], DataVar_05)
The only one that has no delay is "UHF_CHAN_DISP" (orange) All the yellow have a delay.
[image: image.png]
With kind regards
Jan Hein Liebregts
Op vr 15 nov 2024 om 16:01 schreef papiplanes @.***>:
Can you attach your code and I will try to reproduce and look into? Thank you
On Fri, Nov 15, 2024 at 12:20 AM jhl6 @.***> wrote:
Hello,
I have your script running, but have some strange behavior. I use the F-16 module in DCS. I'm reading 10 values. That is running OK But a few values are very slow in responding. Example: When I change the frequentie in the UHF module it take sabout 1 - 2 seconds to change the value in your script. When I change the presets in the UHF module it is responding with no delay. Also the values of the CMDS module have the same delay.
My question: Why are some values responding with a delay, and others are not.
I have tested the same values with Bort in DCS-Bios, and they are all responding ok. So there is a difference between responding of the values in Bort and your script. If this can not fixed, I can not use your script.
With kind regards, Jan Hein
— Reply to this email directly, view it on GitHub <
https://github.com/papiplanes/dcs_bios_connector/issues/1#issuecomment-2478208388>,
or unsubscribe <
. You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub < https://github.com/papiplanes/dcs_bios_connector/issues/1#issuecomment-2479085090>,
or unsubscribe < https://github.com/notifications/unsubscribe-auth/ARM5EUUXEALWYA7TQ2ZXSVL2AYECPAVCNFSM6AAAAABRPPB242VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZZGA4DKMBZGA>
. You are receiving this because you authored the thread.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/papiplanes/dcs_bios_connector/issues/1#issuecomment-2479175906, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLKA7MQFPVSTWVDWJ4RTVHT2AYHULAVCNFSM6AAAAABRPPB242VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZZGE3TKOJQGY . You are receiving this because you commented.Message ID: @.***>
I have changed it as below. But then the values are not showing. When I put the "While True:" back, it shows the values with the lag.
from dcs_bios_connector import DcsBiosConnector bios = DcsBiosConnector() bios.connect()
temp = []
temp.append("CMDS_O1_AMOUNT") temp.append("CMDS_O2_AMOUNT") temp.append("CMDS_CH_AMOUNT") temp.append("CMDS_FL_AMOUN") temp.append("UHF_FREQ_DISP") temp.append("UHF_CHAN_DISP")
def DataVar_00(value, controlInformation, dataInformation): print(temp[0] + " = ", value) def DataVar_01(value, controlInformation, dataInformation): print(temp[1] + " = ", value) def DataVar_02(value, controlInformation, dataInformation): print(temp[2] + " = ", value) def DataVar_03(value, controlInformation, dataInformation): print(temp[3] + " = ", value) def DataVar_04(value, controlInformation, dataInformation): print(temp[4] + " = ", value) def DataVar_05(value, controlInformation, dataInformation): print(temp[5] + " = ", value)
bios.on(temp[0], DataVar_00) bios.on(temp[1], DataVar_01) bios.on(temp[2], DataVar_02) bios.on(temp[3], DataVar_03) bios.on(temp[4], DataVar_04) bios.on(temp[5], DataVar_05)
When the code has run i get: Press any key to continue . . .
That is because the program is finishing. You need something to stop the program from finishing, such as a "game loop". Here is an example. This code will keep running and listening for DCS Bios events. This should help unblock you. Let me know how it works
import time
from dcs_bios_connector import DcsBiosConnector
bios = DcsBiosConnector()
bios.connect()
def handle_flaps(value, control, data):
print("Flaps: ", value)
bios.on("FLAP_SW", handle_flaps)
# Create a simple loop that runs at 30hz (30 times a second)
# This will keep our CPU usage low as we listen for DCS Bios events
FRAME_RATE = 30
frame_time = 1 / FRAME_RATE
try:
while True:
start_time = time.time()
elapsed_time = time.time() - start_time
time_to_sleep = max(0, frame_time - elapsed_time)
time.sleep(time_to_sleep)
except KeyboardInterrupt:
print("Loop stopped.")
Thanks for your support so far. But I tryed your example, but that did not change the lag. Still there are some with lag, and with no lag.
Below you can see the example. "UHF_FREQ_DISP" has lag "CMDS_FL_AMOUNT" has lag "UHF_CHAN_DISP" has NO lag
I use the F16 module.
import time
from dcs_bios_connector import DcsBiosConnector
bios = DcsBiosConnector()
bios.connect()
def data0(value, control, data):
print("UHF_FREQ_DISP: ", value)
def data1(value, control, data):
print("CMDS_FL_AMOUNT: ", value)
def data2(value, control, data):
print("UHF_CHAN_DISP: ", value)
bios.on("UHF_FREQ_DISP", data0)
bios.on("CMDS_FL_AMOUNT", data1)
bios.on("UHF_CHAN_DISP", data2)
# Create a simple loop that runs at 30hz (30 times a second)
# This will keep our CPU usage low as we listen for DCS Bios events
FRAME_RATE = 30
frame_time = 1 / FRAME_RATE
try:
while True:
start_time = time.time()
elapsed_time = time.time() - start_time
time_to_sleep = max(0, frame_time - elapsed_time)
time.sleep(time_to_sleep)
except KeyboardInterrupt:
print("Loop stopped.")
Here is a video of the lag.
https://drive.google.com/file/d/13WwUjqZ5mqPnFLYCcbRL1md9LXMPlSFy/view?usp=sharing
Oh this is interesting, strings are passed differently in DCS BIOS and and be partially updated in an update Message. I’ll look into this as it is with the library handling the message. This will be fun! I’ll reply when I get a fix merged
On Sat, Nov 16, 2024 at 11:53 PM jhl6 @.***> wrote:
Here is a video of the lag.
https://drive.google.com/file/d/13WwUjqZ5mqPnFLYCcbRL1md9LXMPlSFy/view?usp=sharing
— Reply to this email directly, view it on GitHub https://github.com/papiplanes/dcs_bios_connector/issues/1#issuecomment-2481008066, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLKA7MUETKHDI7QAGDCLZAL2BBDRLAVCNFSM6AAAAABRPPB242VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBRGAYDQMBWGY . You are receiving this because you commented.Message ID: @.***>
Hello,
Is it also possible to read values with the script? Example: Airspeed.
With kind regards, Jan Hein