1. Do not share user accounts! Any account that is shared by another person will be blocked and closed. This means: we will close not only the account that is shared, but also the main account of the user who uses another person's account. We have the ability to detect account sharing, so please do not try to cheat the system. This action will take place on 04/18/2023. Read all forum rules.
    Dismiss Notice
  2. For downloading SimTools plugins you need a Download Package. Get it with virtual coins that you receive for forum activity or Buy Download Package - We have a zero Spam tolerance so read our forum rules first.

    Buy Now a Download Plan!
  3. Do not try to cheat our system and do not post an unnecessary amount of useless posts only to earn credits here. We have a zero spam tolerance policy and this will cause a ban of your user account. Otherwise we wish you a pleasant stay here! Read the forum rules
  4. We have a few rules which you need to read and accept before posting anything here! Following these rules will keep the forum clean and your stay pleasant. Do not follow these rules can lead to permanent exclusion from this website: Read the forum rules.
    Are you a company? Read our company rules

Question VTOL VR Plugin Modification and Debugging

Discussion in 'SimTools Plugins' started by Map63Vette, Mar 23, 2023.

  1. Map63Vette

    Map63Vette Active Member

    Joined:
    May 19, 2016
    Messages:
    160
    Occupation:
    Mechanical Engineer
    Location:
    Lawrence, KS
    Balance:
    619Coins
    Ratings:
    +49 / 0 / -0
    I recently have gotten back into VR and have been playing around with some games I downloaded a long time ago but never really played. One of them is VTOL VR, which has turned out to be a pretty fun flight/combat sim my computer can handle running. Way back when I first found the game, I also found someone had created a telemetry mod and a SimTools plugin for it. However, as things stand today, it's not a plug and play installation. The game mod no longer appears to output UDP info for whatever reason. The plugin was also not straightforward as it was in raw Visual Basic source format, so it couldn't be downloaded and installed directly to SimTools. I finally managed to build and install the plugin as I had since installed Visual Studio for another project and recognized that was what I needed to build the plugin. However, that still leaves me with the problem of getting data from the game.

    I found a different telemetry mod built for a FlyPT mover that does appear to actively stream the data out and I have managed to capture that data using the UDP Streaming tool I found on these forums. What I'm now having trouble with is adapting the plugin to use the new data format of the different telemetry mod. Long story short, the original telemetry mod built to go with the plugin was very simple and output a single string with colon delimited values. It was very straightforward to parse and extract the data. The new plugin is significantly more detailed and outputs variable names with their values and line returns. I made a simple VB application to test my parsing code and thought I had it working. I copied the output from the UDP streaming file into my app and it was splitting it up into a string for each value like I was expecting, but when testing the plugin I'm still getting no input to SimTools. Is there any kind of debugging tool that can test plugins? I'm not super familiar with .dll files and am not sure how to debug them. It builds fine, but that doesn't mean it's actually doing anything. Can a dll write to a file? If so I might be able to have it record the variable values it thinks it's receiving so I can better understand if anything is getting through at all, but otherwise I'm not sure how to debug things aside from constant guessing and checking.
  2. Map63Vette

    Map63Vette Active Member

    Joined:
    May 19, 2016
    Messages:
    160
    Occupation:
    Mechanical Engineer
    Location:
    Lawrence, KS
    Balance:
    619Coins
    Ratings:
    +49 / 0 / -0
    For the more visual among us, here is an example entry from the output of the Python UDP stream:

    location=Unknown
    vehicle=FA-26B(Clone)
    ax=0
    ay=-0.009918809
    az=0.0006866455
    yaw=336.3638
    pitch=8.352894
    roll=-0.01978234
    airspeed=111.0175
    drag=0
    onground=False
    gear=Retracted
    rpm=0.359973
    flaps=0
    ejection=False
    airbrake=0
    stall=False

    And here is the block of my code that parses this packet and attempts to separate it into the associated variables:

    Dim spearator As String() = {"="}
    Dim count As Int32 = 9
    Dim strlist As String() = received_data.Split(spearator, count, StringSplitOptions.RemoveEmptyEntries)

    Yaw_Output = CDbl(Regex.Replace(strlist(6), "[a-z]", "")) 'Yaw
    Pitch_Output = CDbl(Regex.Replace(strlist(7), "[a-z]", "")) 'Pitch
    Roll_Output = CDbl(Regex.Replace(strlist(8), "[a-z]", "")) 'Roll
    Surge_Output = CDbl(Regex.Replace(strlist(3), "[a-z]", "")) 'X
    Sway_Output = CDbl(Regex.Replace(strlist(4), "[a-z]", "")) 'Y
    Heave_Output = CDbl(Regex.Replace(strlist(5), "[a-z]", "")) 'Z

    The short version of what this is doing is using the "=" character to split the data from one long string into an array of strings, where each entry in the array corresponds to a single variable. It's a bit wonky in the way it actually separates things, so that is what the Regex.Replace function is doing later. When testing this exact code on an independent Visual Basic program where I have a text box I copy the packet into and then a corresponding text box for each variable, I get values such as:

    -0.009918809az

    It has split the text at the "=" after ay and included all the text it reads until it sees the next "=". The Regex.Replace function replaces any character of a-z with nothing, so as to keep the negative sign and decimal point, which is then converted to a double and saved as the appropriate output. This seems to work just fine on my Visual Basic test app, but when building this code and installing the plugin I'm getting no data coming into the input section of the tuning center in SimTools. However, I can't really tell if SimTools just isn't seeing the port or if it's not parsing the data correctly. The game manager acknowledges the game has launched and turns from gree to blue, but that's about it. Not really sure how to debug from here.
  3. Map63Vette

    Map63Vette Active Member

    Joined:
    May 19, 2016
    Messages:
    160
    Occupation:
    Mechanical Engineer
    Location:
    Lawrence, KS
    Balance:
    619Coins
    Ratings:
    +49 / 0 / -0
    Well, ended up just taking the plunge and adapting the v2 VTOL VR plugin I had to v3 so I could play with the UDP tester. Managed to finally get it working and then backported the code to my v2 VTOL VR plugin and now have values showing up in tuning center. For what it's worth, apparently my string parser that was trying to pull out values was not parsing the same between my test application and the plugin, despite being identical code. It was throwing an exception and bypassing the part where it actually extracts anything, so once I figured that out I got it working. Now off to create and tune a profile!
    • Winner Winner x 1
    Last edited by a moderator: Mar 25, 2023