Announcement

Collapse
No announcement yet.

For 293: Deadzone for controllers

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

  • For 293: Deadzone for controllers

    Originally posted by Team 293
    ...but our software has been tweaked to reflect the fact that our joysticks’ terms have drifted a bit out of center.
    No joysticks that I know of are actually on center, perfectly. Our code for our robot uses a 5-10 unit dead zone around zero. If you are using RobotC, this code should implement it for you:

    Code:
    int joystick_adj_val = abs(joystick.joy1_y1) < 10 ? 0 : joystick.joy1_y1;
    Or, if you dislike or do not understand question-mark-colon statements:

    Code:
    int joystick_adj_val;
    if (abs(joystick.joy1_y1) < 10){
        joystick_adj_val = 0;
    }else{
        joystick_adj_val = joystick.joy1_y1;
    }
    Max Bareiss

    FTC #248 Fatal Error (2009-2013)
    FRC #3142 Aperture (2009-2012)
    FRC #1302 Team Lionheart (2012-2013)
    ZRHS #89 Team Kühlschrank (2011-2013)
    ZRAC #40 Catcher in the Skye (2012)
    ISR 12: Umptysquatch 6
    Rowan University Baja SAE

    And mentoring for life.
    --
    11 seasons of FIRST in 6 years, as a student. Many more as a mentor.

  • #2
    Our team (Team 199, Overclocked Robotics) likes to use absolute values above 15 to avoid any possible error, and convert the -15 to -128 and 15 to 127 values into 0 to 100 or whatever other range, so that the absolute value of 15 or below is just 0.

    Code:
    joystickValue = min(max(abs(joystickValue) - joystickDeadZone, 0) / 127.0 * maxRangeValue, maxRangeValue) * sgn(joystickValue);
    Something like that.
    Qingyang Chen
    FTC Team 5485 - PRO, Horseheads, NY
    Sponsored by Corning Inc.
    Join our fan page: http://www.facebook.com/ftcpro

    Comment

    Working...
    X