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

Tutorial How to write an Axis Assignments (Math) Plugin for SimTools 2.0 - API documentation

Discussion in 'Tutorials and Tips by the Developer' started by yobuddy, Mar 9, 2016.

  1. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,903Coins
    Ratings:
    +5,027 / 16 / -0
    There is no filtering in the example, things start to get a bit messier when you start adding all of that stuff too.
    I needed a place to help get people started, I didn't want to loose them out of the gate.
    take care,
    yobuddy
  2. SeatTime

    SeatTime Well-Known Member

    Joined:
    Dec 27, 2013
    Messages:
    2,574
    Occupation:
    Retired
    Location:
    Brisbane Australia
    Balance:
    28,370Coins
    Ratings:
    +2,844 / 38 / -0
    My Motion Simulator:
    AC motor, Motion platform
    Understand - I don't use allot of filtering nowadays anyway. There is already plenty of scope there to meet my needs.
  3. Z FOX

    Z FOX New Member

    Joined:
    May 8, 2018
    Messages:
    6
    Location:
    USA
    Balance:
    157Coins
    Ratings:
    +2 / 0 / -0
    My Motion Simulator:
    2DOF, Arduino
    @yobuddy Thanks for posting this! This looks great.

    I created my plugin and the PluginValidator says it's a valid plugin. Now do I send those files created from the build into zipped folder before dropping into the "SimTools PluginUpdator"? It won't let me drop there so maybe it's the wrong spot?

    I'll keep looking around.
  4. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,903Coins
    Ratings:
    +5,027 / 16 / -0
    You can drop it in the SimTools PluginUpdater either zipped, or just as it is. (as a .dll file)
    I just testing it and it seems to work.
    Once installed it will be a axis type option for the axis assignments.

    I would check that the naming convention is correct if your having problems buddy.
    take care,
    yobuddy
    • Informative Informative x 1
  5. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    472
    Balance:
    2,826Coins
    Ratings:
    +176 / 1 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    Im trying to figure out how i can stop my Gseat sway to do anything below 0 without using clipping and this seems like the most likely place to go for setting up an axis control for + and one for - Would that work at all or do i just limit it so its not allowed below 0 somewhere?

    Another thing. I see you keep referring to the example plugin for better understanding but there's nothing actually in the files other than

    Code:
        '///////////////////////////////////////////////////////////////////////////////
        '///                     Edit these 5 Subroutines Below                      ///
        '///////////////////////////////////////////////////////////////////////////////
        'Used by GameEngine when the plugin gets loaded.
        Public Sub StartUp()
            'When the Plugin gets Loaded
        End Sub
        'Used by GameEngine when the plugin gets un-loaded.
        Public Sub ShutDown() Implements IPlugin_AxisAssignments.ShutDown
            'When the Plugin gets Un-Loaded
            Output_Calculations_Running = False
        End Sub
        ''Used by GameEngine when a Game Starts
        Public Sub GameStart()
            'Game Started, Start your engine here.
            StartupSelected()
        End Sub
        'Used by GameEngine when the Game Stops
        Public Sub GameStop()
            'Game Ended, Stop your engine here.
            Output_Calculations_Running = False
        End Sub
        'Reset any need vars here - gets called after 'GameStop()'
        Private Sub ResetValues()
            'Reset anything else needed here.
        End Sub
    
  6. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,903Coins
    Ratings:
    +5,027 / 16 / -0
    @Trigen
    There is allot more that that in the example plugin buddy.
    Check out the "PLACE EXTRA NEEDED CODE/FUNCTIONS HERE " section of the plugin.
    There is a GUI there also.

    the easiest way would be to edit the Min/Max for the game you are playing.
    Let's say you talking about Surge, if you don't want the Gseat to do anything with negative surge, set Surges min value to 0 and it will turned off in that direction.

    Take care man!
    yobuddy
  7. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    472
    Balance:
    2,826Coins
    Ratings:
    +176 / 1 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    Thanks! Been a bit tired today so i completely missed those expand boxes

    Fantastic! Just what i need!
  8. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,903Coins
    Ratings:
    +5,027 / 16 / -0
    @Trigen,
    Make sure you are running v2.4 buddy.
    Take care,
    Dustin
  9. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    472
    Balance:
    2,826Coins
    Ratings:
    +176 / 1 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    Ive been playing with the api for a bit and i cant for the life of me get this to work.

    I want to have a button that makes the flap react to either negative or positive numbers but not pass 0. Ive confirmed the button works with "Axis1_Value1_Out = Axis1_Value1_Out * -1" and that my if statement works but if i put the if statement into the checkbox True/False nothing happens. How would i write this. Guessing there's a clever way

    Dont forget im an idiot :p examples are great!

    I suppose everything is hard when you dont have a clue but i solved it like this (not working quite right yet) . Perhaps it can be optimized?

    Code:
    If ._Axis1_roll_flip = False And Axis1_Value1_Out < 0 Then
                                Axis1_Value1_Out = Axis1_Value1_Out * 0
                            End If
                            If ._Axis1_roll_flip = True And Axis1_Value1_Out > 0 Then
                                Axis1_Value1_Out = Axis1_Value1_Out * 0
                            End If
     
    
    Last edited: Aug 31, 2019
  10. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    472
    Balance:
    2,826Coins
    Ratings:
    +176 / 1 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    I have one more question

    In the example plugin you get 3 dofs where you can select the force you want. I see its a string and you have cases with the name. Im wondering how i can just write this in my code without using any selection boxes. Ill add a on off checkbox for combined forces later but i suppose knowing one will let me know the other.

    I tried
    Code:
    _AxisAssignments._Axis1DOF1 = "heave" 
    and i looked at startup but i dont understand how it knows how many dofs to start. Is it just to add another Or FORCE then

    Where do i write it
    How do i set the % ill be using a box for that.

    I will have to turn these on too

    Pointers would be great!
    Last edited: Aug 31, 2019
  11. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,903Coins
    Ratings:
    +5,027 / 16 / -0
    I'll post the gseat plugin code when we get it done buddy.
    Then you can look over it and see how we did it!
    Take care,
    yobuddy
    • Useful Useful x 1
  12. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    472
    Balance:
    2,826Coins
    Ratings:
    +176 / 1 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    Cheers! It will be well worth the wait
  13. T R Para

    T R Para i make stuff up

    Joined:
    Oct 18, 2018
    Messages:
    385
    Occupation:
    Retired
    Location:
    Cincinnati, Oh
    Balance:
    2,436Coins
    Ratings:
    +357 / 2 / -0
    My Motion Simulator:
    AC motor, 6DOF
    I do not really know where to post this so I dropped it here.
    Working on a new project to output the game engine to a servo driver board.
    The board wants to see an input like this #1P1550T100
    Where #1 is the servo used P1500 is the pulse width of the servo (servo neutral) and T1000 is the servo speed.
    It also requires a carriage return and line feed .
    I tried sending this out #1P1<Axis1a>T100<13><10>
    Thanks for your time..

    Attached Files:

    • Useful Useful x 1
    Last edited: Jan 28, 2020
  14. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,903Coins
    Ratings:
    +5,027 / 16 / -0
    What were the results, not working?
    Did you try it in binary?
    Chat soon,
    yobuddy
  15. T R Para

    T R Para i make stuff up

    Joined:
    Oct 18, 2018
    Messages:
    385
    Occupation:
    Retired
    Location:
    Cincinnati, Oh
    Balance:
    2,436Coins
    Ratings:
    +357 / 2 / -0
    My Motion Simulator:
    AC motor, 6DOF
    Ok good news. Its working fine. Problem was syntax ..
    I have hooked up 6 servos so far and they all play according to the axis assignments.
    Binary did not work. Decimal is good.
    You may have noticed that the output range is set to 10 bits.
    This was a trial and error hack to try and get the 3 least significant digits close to neutral and then add a 1 in front of it.
    I added the P1 so it would output 1520ms at center of the slider else it would of outputted a dec(520).


    As you know the standard servo range is 900ms min 1500ms center neutral and 2000ms max.
    When the game engine output gets to a certain lower value it drops the most significant digit . Instead of 099 it outputs a 99. The P1<Axis1a> now outputs a 199 or 199ms...
    Where if game engine outputs a 100 the P1<Axis1a> outputs a 1000 or 1000ms.
    The servo does not like a 190ms PWM. lol
    I just had to set an axis limiting below 90% ..


    So my output string looks like this for 6 servos.
    #1P1<Axis1a>#2P1<Axis2a>#3P1<Axis3a>#4P1<Axis4a>#5P1<Axis5a>#6P1<Axis6a>T10<13><10>

    Where #1 is the servo number. P1<Axis "axis number"> Assigned axis And T10 sets the servo speed.....
    the <13><10> sends a carriage return /line feed...


    The start and stop strings reset the servos to center position.
    The #1G<13><10> is programmed into the driver board to set all servos to neutral at once .

    The driver board can be programmed for many sequences but it has no other smarts.

    The cool part is no need for the Arduino in between :o:

    Link to the servo driver board.

    amazon.com/gp/product/B01794FLXU

    Attached Files:

    • Winner Winner x 1
    • Useful Useful x 1
    Last edited: Jan 29, 2020
  16. Marc Fdx

    Marc Fdx New Member

    Joined:
    Feb 3, 2021
    Messages:
    13
    Balance:
    38Coins
    Ratings:
    +27 / 0 / -0
    My Motion Simulator:
    3DOF
    I wish to write some special routines for the Yaw axis like converting Heading data to Rotation Speed data (allowing a better handling than anti-rollover when you have a limited yaw travel) as well as the opposite (for 360° rotation). For now I have included these routines in an interface plugin and it works. But this is no good practice because selecting a special yaw mode depends on the game used, so the interface is not the right place to implement this.

    Any chance to obtain the source code including the "Generic 2D Standard" mode instead of the "Generic 2D Basic" mode in the zip available in this thread? The Standard mode features very useful functions like washout, smoothing etc, and it would be nonsense (and very time-consuming) to write code that already exists.
    • Like Like x 1
  17. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,133
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    47,903Coins
    Ratings:
    +5,027 / 16 / -0
  18. Ayad

    Ayad Dr.

    Joined:
    Apr 11, 2022
    Messages:
    21
    Occupation:
    surgeon
    Location:
    Iraq
    Balance:
    - 357Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    hi,.and ohhhhhh my GOD ,
    am not software expert but ,am standing and scratching my head many times ,I dont know what and where to start ,but but but ,do I need to do this with every plugin for new game ,i try dirt rally 2 ,and froza 5,and need for speed ,all plugin not working other than the LFS come with simtool ,looking for axis writing and this thread show up which was so difficult to me ,is the reason no plugin worked with me for all except the LFS with simtool because I dont do this ,and I just drag and drop the zip file for plugin after download ,what to do please is this nesessory to work or not ,,,,,?????
  19. noorbeast

    noorbeast VR Tassie Devil Staff Member Moderator Race Director

    Joined:
    Jul 13, 2014
    Messages:
    20,460
    Occupation:
    Innovative tech specialist for NGOs
    Location:
    St Helens, Tasmania, Australia
    Balance:
    144,596Coins
    Ratings:
    +10,741 / 52 / -2
    My Motion Simulator:
    3DOF, DC motor, JRK
    No this is not necessary to install plugins, just drag the plugin zip onto the Plugin Updater.

    What is necessary to use any plugin other than LFS, is a licensed and registered version of SimTools, which you can buy or if you meet all of the eligibility criteria can apply for a free DIY license: https://www.xsimulator.net/community/faq/request-a-free-diy-simtools-2-0-license.263/
    • Like Like x 1
  20. Ayad

    Ayad Dr.

    Joined:
    Apr 11, 2022
    Messages:
    21
    Occupation:
    surgeon
    Location:
    Iraq
    Balance:
    - 357Coins
    Ratings:
    +1 / 0 / -0
    My Motion Simulator:
    2DOF, 3DOF, DC motor, Arduino
    thanks nvery much , y6es I have liscense and bought 2 years package ,and I do download and drag it to the updater of simmtool ,but no out put on my motion simulator only the LFS the free one it work the other plugin which I made race and finish it for dirt rally and need for speed no motion in my rig ,and even with LFS it move some time vigrous ,is it differrent plughin if I place motors in front or above shoulder rear placement of motors ,and I read the manual many times and solve alot of my issue but dont know what is the vertual axis and how I use it other than connect and turn off ,and the axis asignment just use the one I doawnload from x simulator which are the GT force ,the x motion ,simtool gt,the 301 force ....and I use one of those perseit for any game randomly ,????