GithubHelp home page GithubHelp logo

2024's People

Contributors

spakshots avatar zibeyy avatar

Stargazers

 avatar

Watchers

Adrian Campos avatar  avatar  avatar Trevor Peitzman avatar

Forkers

zibeyy

2024's Issues

Swerve Drive Issues and Solutions Page

For easiest troubleshooting, use the following lines to smart dashboard:

SmartDashboard.putNumber("Robot Heading", getHeading());
SmartDashboard.putString("Robot Location", getPose().getTranslation().toString());
SmartDashboard.putString("Swerve[" + cancoder.getDeviceID() + "] state", state.toString());
SmartDashboard.putNumber("Swerve[" + cancoder.getDeviceID() + "] abs enc", getAbsoluteEncoderRad());
SmartDashboard.putString("swerve inputs", String.format("xSpeed: %.2f\tySpeed: %.2f\tturningSpeed: %.2f", xSpeed, ySpeed, turningSpeed));
SmartDashboard.putString("Front Left State", frontLeft.getState().toString());
SmartDashboard.putString("Front Right State", frontRight.getState().toString());
SmartDashboard.putString("Back Left State", backLeft.getState().toString());
SmartDashboard.putString("Back Right State", backRight.getState().toString());

Problems + Solutions:

  1. When driving command activated from controller, wheels spin chaotically with no pattern
  • Check (Class Constants)
    public static final double kDriveMotorGearRatio = 1 / 6.75; and
    public static final double TurningMotorGearRatio = 1.0 / (150 / 7);
    ensure proper gear ratio of drive and turn
  • Check (Class SwerveModule)
    angleRotations = Math.IEEEremainder(angleRotations, 1);
    ensure a redundant unit to unit calculation
  1. Wheels turning without chaos, but not facing the right direction

    A. If all driving is reversed, (forward = backward | left = right)

    • Check (Phoenix X OR Constants)
      Proper inversion of CANcoders. Make sure that x and y in SmartDashboard are giving positive outputs when moving forward

    B. If Wheels are in "X" formation

    • Check (Class Constants)
      new Translation2d(kWheelBase / 2, kTrackWidth / 2), // front left
      new Translation2d(kWheelBase / 2, -kTrackWidth / 2), // front right
      new Translation2d(-kWheelBase / 2, kTrackWidth / 2), // back left
      new Translation2d(-kWheelBase / 2, -kTrackWidth / 2)); // back right
      ensure correct positive and negative values relative to wheel position on robot

    C. If Wheels will face correct direction when aligned in same direction (before robot booting) but will not work if wheels are turned to all different directions (before robot booting)

    • Check (Class SwerveModule)
      driveEncoder.setPosition(0);
      turnEncoder.setPosition(getAbsoluteEncoderRad());
      ensure turning encoder is set by radians from absolute encoder
  2. Wheels seem to be turning and overcorrecting themselves (too jerky turns)

  • Check (Class Constants)
    public static final double kPTurning = 0.4;
    ensure that "P" value is properly tuned, "I" and "D" are irrelevant
  1. Bot can drive straight, but cannot maintain straight path while rotating
  • Check (Class SwerveSubsystem)
    return Math.IEEEremainder(-gyro.getAngle(), 360);
    ensure that gyro is either positive or negative depending on roborio orientation on robot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.