Skip to content

Instantly share code, notes, and snippets.

@22raor
Created February 3, 2022 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 22raor/18fb811b8ca03f8963bfdcc3bb26a08a to your computer and use it in GitHub Desktop.
Save 22raor/18fb811b8ca03f8963bfdcc3bb26a08a to your computer and use it in GitHub Desktop.
Constants
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot;
import edu.wpi.first.math.kinematics.DifferentialDriveKinematics;
/**
* The Constants class provides a convenient place for teams to hold robot-wide
* numerical or boolean
* constants. This class should not be used for any other purpose. All constants
* should be declared
* globally (i.e. public static). Do not put anything functional in this class.
*
* <p>
* It is advised to statically import this class (or one of its inner classes)
* wherever the
* constants are needed, to reduce verbosity.
*/
public final class Constants {
public static final class DriveConstants {
public static final int kLeftMotor1Port = 4; // 3 CAN ID for practice robot
public static final int kLeftMotor2Port = 5; // 4
public static final int kRightMotor1Port = 1; // 1
public static final int kRightMotor2Port = 2; // 2
public static final boolean kLeftMotorInverted = true;
public static final boolean kRightMotorInverted = false;
public static final double kTrackwidthMeters = 0.559;
public static final DifferentialDriveKinematics kDriveKinematics = new DifferentialDriveKinematics(
kTrackwidthMeters);
public static final double gearingRatio = 1.0 / 10.86; // output shaft rotations / motor rotations
public static final double kWheelDiameterMeters = 0.152;
// The Robot Characterization Toolsuite provides a convenient tool for obtaining
// these
// values for your robot.
public static final double ksVolts = 0.13377; //0.24929; new values //
public static final double kvVoltSecondsPerMeter = 6.5638; //6.3539;
public static final double kaVoltSecondsSquaredPerMeter = 4.156;//0.552; //1.788;
// Example value only - as above, this must be tuned for your drive!
public static final double kPDriveVel = 1.0; // 0.4; //test (1.1879E-05; new) //9.1725E-07
public static final double kIDriveVel = 0.0;
public static final double kDDriveVel = 0.0;
public static final double kPDrivePos = 1;
public static final double kIDrivePos = 0;
public static final double kDDrivePos = 0;
public static double kDriveTolerance = 0.2;
public static double kDriveToleranceMetersPerSec = 0.1;
}
public static final class ControllerID {
}
public static final class AutoConstants {
public static final double kMaxSpeedMetersPerSecond = 1; //1.5
public static final double kMaxAccelerationMetersPerSecondSquared = 0.1; //0.1
// Reasonable baseline values for a RAMSETE follower in units of meters and
// seconds
public static final double kRamseteB = 2;
public static final double kRamseteZeta = 0.7;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment