RoboWars Australia Wiki : PlannersCarMixer

RobowarsWikka1 :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register
If chkMixing Then
    'stickx = steering
    ' y = throttle
    ' work out diflection from centre on steering as a percentage
    ' multiply by throttle
    ' add to correct side
    ' cases 0 steering
    ' left
    ' right
    Dim Throttle As Long
    Dim Steering As Long
    Dim Flip As Boolean
    Dim LastFlipState As Boolean
   
    'false = up true = down

    'buffer vars
    Throttle = StickX
    Steering = StickY
   
    'corrections for wiring in bot/driver stupidity, i mean really which way is the front?
    If chkReverseSteering Then Steering = Steering * -1
    If chkRevThrottle Then Throttle = Throttle * -1
   
    'this makes the steering change direction dependant on throttle IE you can drive an arc by holding right stick and going forwards/backwards rather than an S
    If chkSROT And Throttle < 0 Then Steering = Steering - 1
   
   
    Dim Diflection As Double
    Dim Slowdown As Double
   
    '"Ram Mode" steering cuts the sensitivity of the steering stick, needs tweaking per bot
    If JoystickState.buttons(11) = 128 Then
        Shape1.FillColor = 255
        Steering = Steering / 4
    Else
        Shape1.FillColor = 0
    End If
   
    'work out where the steering stick is then multiply it by the throttle to get the abs value we need to slow the inside motor by
    Diflection = (Throttle / 32767) * 2
    Slowdown = Diflection * Steering
   
    'reverse which motor if we are flipped
    If chkFlip Then
        Steering = Steering * -1
        Throttle = Throttle * -1
    End If
   
    'both = full forward
    'StickX = StickX
    'StickY = StickX
   
    'apply the slowdown depending on which way we are turning
    Select Case Steering
        Case Is < 0 'left
            StickX = Throttle
            StickY = Throttle + Slowdown
           
        Case Is > 0 ' right
            StickY = Throttle
            StickX = Throttle - Slowdown
           
        Case Is = 0 ' straight
            StickX = Throttle
            StickY = Throttle
    End Select
   
End If

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by Wikka Wakka Wiki 1.1.6.1
Page was generated in 0.1969 seconds