-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConstants.java
More file actions
122 lines (95 loc) · 5.05 KB
/
Constants.java
File metadata and controls
122 lines (95 loc) · 5.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.robot;
import com.revrobotics.CANSparkMax.IdleMode;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.I2C.Port;
import edu.wpi.first.wpilibj2.command.button.Button;
import edu.wpi.first.wpilibj2.command.button.JoystickButton;
import frc.robot.core751.subsystems.DifferentialDriveTrain;
import frc.robot.core751.subsystems.DifferentialDriveTrain.driveMotor;
import frc.robot.core751.wrappers.OverrideableJoystick;
/**
* 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 enum Controller { // Button mappings for the XBOX One controller
A(1), B(2), X(3), Y(4), LB(5), RB(6), LT(2), // Must use .getRawAxis()
RT(3), // Must use .getRaxAxis()
BACK(7), START(8), LEFT_AXIS_PRESS(9), // X-Axis: -1.000 to 1.000 (stick.GetX())
// Y-Axis: -1.000 to 1.000 (stick.GetY())
RIGHT_AXIS_PRESS(10);
private int buttonNum;
private Controller(int value) {
this.buttonNum = value;
}
public int getButtonMapping() {
return this.buttonNum;
}
}
public static OverrideableJoystick driverStick = new OverrideableJoystick(Constants.driveStickPort);
/*================================/
/===========Drive Train===========/
/================================*/
public static int leftDrivetrainIDs[] = new int[] { 1, 2, 3 };
public static int rightDrivetrainIDs[] = new int[] { 4, 5, 6 };
public static DifferentialDriveTrain.SmartControllerProfile driveMotorProfile= new DifferentialDriveTrain.SmartControllerProfile(IdleMode.kCoast, 0.25, 35);
public static DifferentialDriveTrain.driveMotor driveTrainMotorType = driveMotor.kSparkMaxBrushless;
public static boolean driveInvertLeft = true;
public static boolean driveInvertRight = false;
public static double simpleDriveAutonLengthSeconds = 1.75;
public static double simpleBallAutonLengthSeconds = 5;
public static double maxSparkDeccelPeriod = 1;//0.5;
public static double sparkDeccelThreshold = 0.5;
public static int sparkDeccelSteps = 14;//7;
public static double minPauseDeaccelThreshold = 0.5;
public static int driveStickPort = 0;
public static Button driveSwitchDirectionButton = new JoystickButton(driverStick, Controller.START.buttonNum);
/*================================/
/===========Ball==================/
/================================*/
public static int ballIntakeMotorID = 7;
public static int ballPolycordMotorID = 8;
public static int ballOutakeMotorID = 9;
public static double polycordGracePeriod = 0; // in seconds
public static int ballLBumper = Controller.LB.buttonNum;
public static int ballRBumper = Controller.RB.buttonNum;
public static int ballOutButton = Controller.A.buttonNum;
public static int ballReverseOutButton = Controller.BACK.buttonNum;
/*================================/
/===========Panel=================/
/================================*/
public static int panelRotateID = 10;
public static int panelSpinID = 11;
public static int panelBottomLimitPort = 0;
public static int panelTopLimitPort = 1;
public static Port leftColorsensorPort = Port.kOnboard;
public static Port rightColorsensorPort = Port.kMXP;
public static float proximityThreshhold = 200;
public static int leftTrigger = 2;
public static int rightTrigger = 3;
public static Button panelToggleButton = new JoystickButton(driverStick, Controller.Y.buttonNum);
// Robot-specific PIDTrajectory constants
public static double trackWidthMeters = 0.0762; // horizontal distance between the wheels
// (2019 robot = 0.0762 meters (3 inches))
public static double maxPIDTrajectoryDriveVolts;
public static double maxPIDTrajectoryDriveAcceleration; // m/sec^2
public static double ksVolts;
public static double kvVoltSecondsPerMeter;
public static double kaVoltSecondsSquaredPerMeter;
public static double kPDriveVel;
// Universal PIDTrajectory constants
public static double ramseteB = 2;
public static double ramseteZeta = 0.7;
}