Announcement

Collapse
No announcement yet.

Button to throttle moters in tank mode

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Button to throttle moters in tank mode

    I'm trying to program a button on the joystick to drop the trottle on the drive moters. Is this something that can be done?

  • #2
    Re: Button to throttle moters in tank mode

    Hi, welcome to the FIRST Forums!

    What you are asking can absolutely be done. The first step is to fully define exactly what your inputs are and what you want the output behavior to be. Examples:

    Inputs: Joystick Y-Axis and 1 button
    Desired Behavior: When the button is not pressed the Y-Axis should directly map to robot throttle (forward speed). While the button is held the Joystick Y-Axis should be mapped to 1/2 Robot speed (Speed = Y-axis * 1/2)

    Inputs: Joystick Y-Axis and X-Axis, 1 Button
    Desired Behavior: When the button is not pressed, the Y-Axis maps to throttle and the X-axis maps to turning (Arcade drive). While the button is held the Joystick Y-Axis maps to 1/2 robot throttle (throttle = Y-axis * 1/2) and the X-axis maps to 1/4 robot turning (Turning = X-Axis * 1/4)

    Once you have described your desired operation in pseudo-code you should be ready to implement it in your robot code. Attached is a VI snippet that shows one way to implement the first example from above. The Select node from the Comparison palette is used to choose between sending the un-modified joystick value if the button is not currently pressed and sending the value *.5 if the button is currently pressed.
    Attached Files
    FIRST®
    FRC Robotics Engineer

    Comment

    Working...
    X