1. 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!
  2. 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
  3. 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 Simtools Output only Sometimes Registering and Not Outputting to Arduino

Discussion in 'SimTools DIY Version' started by Rohit Jayaram, Mar 1, 2019.

  1. Rohit Jayaram

    Rohit Jayaram New Member

    Joined:
    Feb 15, 2019
    Messages:
    6
    Balance:
    128Coins
    Ratings:
    +1 / 0 / -0
    Hi,
    Recently I have been trying to be able to connect Unity through Simtools to move a servo on an Arduino. I am trying to make this work with the Quplay plugin and Unity project found here: https://github.com/ddkclaudio/QuplaySimTools
    After testing it seems that no matter what random values I send to the Arduino it will not move the servo. I have verified that the servo works in Simtools using the DOF testing in GameEngine. Additionally, I have verified using the tuning center that Simtools is only registering recieved packets on some occasions. I am not sure why this is occuring but it seems to be random when the packets go through. Even when the values are being registered the servo does not move. Any assistance would be fantastic I am not sure how to go about fixing this issue. My Simtools is running the correct plugin and is registered btw.

    Thanks
  2. Ads Master

    Ads Master

    Balance:
    Coins
    Ratings:
    +0 / 0 / -0
  3. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    15,341
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    112,811Coins
    Ratings:
    +9,085 / 46 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    Have you tried temporarily disabling the firewall, as it sounds like something is interfering with data communication.
  4. Rohit Jayaram

    Rohit Jayaram New Member

    Joined:
    Feb 15, 2019
    Messages:
    6
    Balance:
    128Coins
    Ratings:
    +1 / 0 / -0
    I will have to try that but it is still odd that the servo will not move even if packets are registered. Any thoughts?
  5. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    15,341
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    112,811Coins
    Ratings:
    +9,085 / 46 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    More information would be helpful, like pictures of all of your settings, in particular your Interface Settings.
  6. Rohit Jayaram

    Rohit Jayaram New Member

    Joined:
    Feb 15, 2019
    Messages:
    6
    Balance:
    128Coins
    Ratings:
    +1 / 0 / -0
    Thanks for the help, here are the settings I am using. I changed the COM port of the arduino to 5 in my device manager to try and troubleshoot. These settings seem to make the servo move in output testing so I am not sure if their is a problem here.
    Capture.PNG axis_assign.PNG game_manager.PNG
  7. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,774
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,360Coins
    Ratings:
    +3,879 / 10 / -0
    My guess is your not sending the same info the SimTools plugin is expecting?
    Is the plugin expecting more info than roll maybe?
    Take care,
    yobuddy
  8. Rohit Jayaram

    Rohit Jayaram New Member

    Joined:
    Feb 15, 2019
    Messages:
    6
    Balance:
    128Coins
    Ratings:
    +1 / 0 / -0
    I did not change anything with the QuPlay plugin and checking the code it seems that I am sending the right format here:
    Code:
    string info = String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", simtools.Roll, simtools.Pitch, simtools.Yaw, simtools.Heave, simtools.Sway, simtools.Surge, simtools.Extra1, simtools.Extra2, simtools.Extra3);
                byte[] data = Encoding.Default.GetBytes(info);
                client.Send(data, data.Length, remoteEndPoint);
    and recieving and decoding it using this:
    Code:
    Public Sub Process_PacketRecieved(Text As String) Implements IPlugin_Game.Process_PacketRecieved
            Dim telemetry As String() = Text.Split(New Char() {","c})
    
            Roll_Output = CDbl(Val(telemetry(0)))
            Pitch_Output = CDbl(Val(telemetry(1)))
            Yaw_Output = CDbl(Val(telemetry(2)))
            Heave_Output = CDbl(Val(telemetry(3)))
            Sway_Output = CDbl(Val(telemetry(4)))
            Surge_Output = CDbl(Val(telemetry(5)))
            Extra1_Output = CDbl(Val(telemetry(6)))
            Extra2_Output = CDbl(Val(telemetry(7)))
            Extra3_Output = CDbl(Val(telemetry(8)))
        End Sub
    Also simtools is registering the values on some attempts. I verified this using the Tuning Center. I am sending random values from -180 to 180 here:
    Code:
    void Update()
        {
            QuPlaySimtools.QuSimtools_SendTelemetry(Random.RandomRange(-180, 180), Random.RandomRange(-180, 180), Random.RandomRange(-180, 180), Random.RandomRange(-180, 180), Random.RandomRange(-180, 180), Random.RandomRange(-180, 180), Random.RandomRange(-180, 180), Random.RandomRange(-180, 180), Random.RandomRange(-180, 180));
        }
    I tried with only outputting every second as well. It did not change anything.
  9. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,774
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,360Coins
    Ratings:
    +3,879 / 10 / -0
    My guess is the SimTools plugin is not getting a complete string sometimes?
    Maybe for a test add a couple more outputs (that won't get used).
    string info = String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}", simtools.Roll, simtools.Pitch, simtools.Yaw, simtools.Heave, simtools.Sway, simtools.Surge, simtools.Extra1, simtools.Extra2, simtools.Extra3),1,1;

    If it works i would add something like this "S~,{0},{1},{2},{3},{4},{5},{6},{7},{8},~E"
    Then in the plugin you can check that a S~ and a ~E exists and that there is only I instance of each before the string is split.
    Maybe something like this:
    https://www.xsimulator.net/communit...etry-output-into-a-game-simple-example.11080/
    Take care,
    yobuddy
    • Informative Informative x 1
  10. Rohit Jayaram

    Rohit Jayaram New Member

    Joined:
    Feb 15, 2019
    Messages:
    6
    Balance:
    128Coins
    Ratings:
    +1 / 0 / -0
    Thanks, this was a very useful addition. I finally figured out that the problem was that I was not sending high enough values between about ~ -32400 to 32400 to get the servo to spin. One other problem I am still encountering is that Simtools is not recieving input if I slow down the packet rate to not constant. Not a big deal but figuring this out would make my code more lightweight network wise.
    • Like Like x 1
  11. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,774
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,360Coins
    Ratings:
    +3,879 / 10 / -0
    Below ~150ms and SimTools my think your game is not running.
    How slow are you trying to go?
  12. Rohit Jayaram

    Rohit Jayaram New Member

    Joined:
    Feb 15, 2019
    Messages:
    6
    Balance:
    128Coins
    Ratings:
    +1 / 0 / -0
    I was trying to go to half seconds or more between packets. It seems pointless to send a packet when no data is changed. I did not know about the 150ms. If that's the lowest it can go its not too bad but still a little redundant.
  13. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,774
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,360Coins
    Ratings:
    +3,879 / 10 / -0
    SimTools will manage all this, so all you need to do is just create a steady stream of data flowing from your game and your golden.
    Take care,
    yobuddy
    • Informative Informative x 1
    Last edited: Mar 4, 2019
  14. Pitchoun511

    Pitchoun511 Member Gold Contributor

    Joined:
    Aug 29, 2017
    Messages:
    35
    Location:
    Perpignan
    Balance:
    346Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    3DOF
    Hi,
    I have the same problem, but even when changing the values from 180 to 32400, my simulator does not move.

    I try to disable my firewall, I try to slow down the frames, but nothing works for me.
  15. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,774
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,360Coins
    Ratings:
    +3,879 / 10 / -0
    You don't really need to make the output this big or anything.
    Really what you should do is once the plugin is installed and patched, is to run the game an capture good Min/Max settings for the game.
    Then make sure you have Axis Assignments assigned for the new game plugin and give it a whirl.
    Let me know how it goes,
    yobuddy
  16. Pitchoun511

    Pitchoun511 Member Gold Contributor

    Joined:
    Aug 29, 2017
    Messages:
    35
    Location:
    Perpignan
    Balance:
    346Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    3DOF
    Thx for your answer yobuddy,
    my project sends a random value between -180 and 180 on eatch axes, so the max and min values are 180 and -180. but I didn't run the game capture to set game engine. I will try this week.

    My problem is that I don't know if my plugin works, and I don't know how to debug it.
  17. yobuddy

    yobuddy Well-Known Member Staff Member Moderator SimAxe Beta Tester SimTools Developer Gold Contributor

    Joined:
    Feb 9, 2007
    Messages:
    3,774
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,360Coins
    Ratings:
    +3,879 / 10 / -0
    Once you have a Min/Max file for the game saved in game engine's Tuning Center, Then run the game in a window and click the "Output Testing" button and goto the virtual axis page and click "Turn On".
    You should see some movement in the green section?
  18. Pitchoun511

    Pitchoun511 Member Gold Contributor

    Joined:
    Aug 29, 2017
    Messages:
    35
    Location:
    Perpignan
    Balance:
    346Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    3DOF
    thx, I will try.
  19. Pitchoun511

    Pitchoun511 Member Gold Contributor

    Joined:
    Aug 29, 2017
    Messages:
    35
    Location:
    Perpignan
    Balance:
    346Coins
    Ratings:
    +6 / 0 / -0
    My Motion Simulator:
    3DOF
    @yobuddy I Love you!!!
    Every thing works fine since the begining... I just forgot to capture the max and min values... I did it for the 2 or 3 games I play since 2 years, and I totaly forgot to do it for this application...

    All works fine now!! You're wonderfull! the xsimulator's community is wonderfull! I'm so happy!

    Thank you so mutch!!!!!
    • Like Like x 1
    • Winner Winner x 1
    • Useful Useful x 1