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 Full range trough Axis plugin

Discussion in 'SimTools Pro & Entertainment Version' started by Trigen, Oct 19, 2019.

  1. 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
    Hello

    Im trying to have my hall sensors use full range so i can use it with one magnet. I have it somewhat working but id like someone to look at the code and perhaps say if its the correct way or not.

    Ive put the Sway (for simplicity i should probably put it on another force) so it starts from -1 and adds any value to that. I then multiply that 2 times so it will use the whole range. I still dont quite understand why the axis is flipped when you do Axis1_Value1_Out * -1 but putting 1 instead of -1 works and since this is on sway and one axis needs to go the other way i use -1 and 1. Feel free to give an explanation why it gets flipped

    Doing this on 2 DOF's seems to work for all as its instantly put to -1


    Also what happens if i wish to use -0.8 instead of -1 for full range so i can have some negative heave and or surge?

    Code:
                    Select Case ._Axis1DOF1
                        Case "-"
                            Axis1_Value1_Out = 0
                        Case "Sway"
                            'Get percent used for DOF
                            Axis1_Value1_Out = _Sway_Input * (._Axis1PER1 * 0.02)
                            Axis1_Value1_Out = 1 + Axis1_Value1_Out 
                            'Flip if necessary
                            If ._Axis1DIR1 = True Then
                                Axis1_Value1_Out = Axis1_Value1_Out * -1
                            End If
                            ' If Axis1_Value1_Out < 0 Then
                            'Axis1_Value1_Out = Axis1_Value1_Out * 0
                            ' End If
    
                    End Select
    
    Axis 2
    Code:
                    'DOF1
                    Select Case ._Axis1DOF1
                        Case "-"
                            Axis2_Value1_Out = 0
                        Case "Sway"
                            'Get percent used for DOF
                            Axis2_Value1_Out = _Sway_Input * (._Axis1PER1 * 0.02)
                            Axis2_Value1_Out = -1 + Axis2_Value1_Out 
                            'Flip if necessary
                            If ._Axis1DIR1 = False Then
                                Axis2_Value1_Out = Axis2_Value1_Out * -1
                            End If
                            ' If Axis2_Value1_Out < 0 Then
                            ' Axis2_Value1_Out = Axis2_Value1_Out * 0
                            'End If
                    End Select
    
    Thank you
    Last edited: Oct 19, 2019
  2. yobuddy

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

    Joined:
    Feb 9, 2007
    Messages:
    5,162
    Occupation:
    Computer Technician
    Location:
    Portland, Oregon - USA
    Balance:
    48,171Coins
    Ratings:
    +5,036 / 16 / -0
    Axis1_Value1_Out * -1 just flips the sign of the output value with the little Dir checkbox.
    If value is 5 then its -5.
    If value is -3 then its 3.
    that's all really.

    Take care,
    yobuddy