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

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:
    3,788
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,945Coins
    Ratings:
    +3,938 / 10 / -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,579
    Location:
    Newcastle Australia
    Balance:
    27,703Coins
    Ratings:
    +2,839 / 37 / -0
    My Motion Simulator:
    DC motor, AC motor, Arduino, Motion platform, 6DOF
    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:
    117Coins
    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:
    3,788
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,945Coins
    Ratings:
    +3,938 / 10 / -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:
    408
    Balance:
    2,690Coins
    Ratings:
    +132 / 0 / -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:
    3,788
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,945Coins
    Ratings:
    +3,938 / 10 / -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:
    408
    Balance:
    2,690Coins
    Ratings:
    +132 / 0 / -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:
    3,788
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,945Coins
    Ratings:
    +3,938 / 10 / -0
    @Trigen,
    Make sure you are running v2.4 buddy.
    Take care,
    Dustin
  9. Trigen

    Trigen Active Member

    Joined:
    Nov 25, 2018
    Messages:
    408
    Balance:
    2,690Coins
    Ratings:
    +132 / 0 / -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:
    408
    Balance:
    2,690Coins
    Ratings:
    +132 / 0 / -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:
    3,788
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,945Coins
    Ratings:
    +3,938 / 10 / -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:
    408
    Balance:
    2,690Coins
    Ratings:
    +132 / 0 / -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 Gold Contributor

    Joined:
    Oct 18, 2018
    Messages:
    306
    Occupation:
    Retired
    Location:
    Cincinnati, Oh
    Balance:
    2,035Coins
    Ratings:
    +286 / 2 / -0
    My Motion Simulator:
    3DOF, AC motor
    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:
    3,788
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    33,945Coins
    Ratings:
    +3,938 / 10 / -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 Gold Contributor

    Joined:
    Oct 18, 2018
    Messages:
    306
    Occupation:
    Retired
    Location:
    Cincinnati, Oh
    Balance:
    2,035Coins
    Ratings:
    +286 / 2 / -0
    My Motion Simulator:
    3DOF, AC motor
    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