-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConstants.java
More file actions
191 lines (155 loc) · 8.38 KB
/
Constants.java
File metadata and controls
191 lines (155 loc) · 8.38 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// 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.geometry.Translation2d;
import edu.wpi.first.math.kinematics.SwerveDriveKinematics;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.XboxController.Button;
/**
* 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 class BlinkinConstants {
public static final int kBlinkinPort = 0;
}
public static final class DriveConstants {
// TODO turn field oriented on or off
public static final boolean kFieldOriented = true;
//Turn theta
public static final double kTurnThetaMaxSpeed = 0.9;
public static final double kTurnThetaShutoffSensitivity = 0.005;
// Distance between centers of right and left wheels on robot
public static final double kTrackWidth = Units.inchesToMeters(24.75);
// Distance between front and back wheels on robot
public static final double kWheelBase = Units.inchesToMeters(24.75);
// Positions of modules relative to the center of mass
public static final SwerveDriveKinematics kDriveKinematics = new SwerveDriveKinematics(
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
);
// TODO Using tall bot?
public static final boolean tallBot = true;
// Short bot offsets
public static final double kFROffset = Math.PI / 2 - 2;
public static final double kBROffset = -Math.PI;
public static final double kBLOffset = -Math.PI / 2;
public static final double kFLOffset = 0;
// Tall bot offsets
public static final double kTallFROffset = -.097 * Math.PI * 2;
public static final double kTallBROffset = .179 * Math.PI * 2;
public static final double kTallBLOffset = .314 * Math.PI * 2 + (Math.PI / 2);
public static final double kTallFLOffset = .106 * Math.PI * 2;
// Angular offsets of the modules relative to the chassis in radians
public static final double kFrontRightChassisAngularOffset = (tallBot ? kTallFROffset : kFROffset);
public static final double kBackRightChassisAngularOffset = (tallBot ? kTallBROffset : kBROffset);
public static final double kBackLeftChassisAngularOffset = (tallBot ? kTallBLOffset : kBLOffset);
public static final double kFrontLeftChassisAngularOffset = (tallBot ? kTallFLOffset : kFLOffset);
// SPARK MAX CAN IDs
public static final int kFrontRightDrivingCanId = 11;
public static final int kRearRightDrivingCanId = 21;
public static final int kRearLeftDrivingCanId = 31;
public static final int kFrontLeftDrivingCanId = 41;
public static final int kFrontRightTurningCanId = 12;
public static final int kRearRightTurningCanId = 22;
public static final int kRearLeftTurningCanId = 32;
public static final int kFrontLeftTurningCanId = 42;
public static final int kFrontRightEncoderCanId = 13;
public static final int kRearRightEncoderCanId = 23;
public static final int kRearLeftEncoderCanId = 33;
public static final int kFrontLeftEncoderCanId = 43;
public static final boolean kGyroReversed = false;
// Reverse encoders if needed; note that this will break everything if you don't
// go through and fix everything afterward
public static final boolean kFrontLeftDriveEncoderReversed = false;
public static final boolean kFrontLeftTurningEncoderReversed = false;
public static final boolean kFrontLeftAbsoluteEncoderReversed = true;
public static final boolean kFrontRightDriveEncoderReversed = false;
public static final boolean kFrontRightTurningEncoderReversed = false;
public static final boolean kFrontRightAbsoluteEncoderReversed = true;
public static final boolean kBackLeftDriveEncoderReversed = false;
public static final boolean kBackLeftTurningEncoderReversed = false;
public static final boolean kBackLeftAbsoluteEncoderReversed = true;
public static final boolean kBackRightDriveEncoderReversed = false;
public static final boolean kBackRightTurningEncoderReversed = false;
public static final boolean kBackRightAbsoluteEncoderReversed = true;
public static final long kBootupDelay = 1000; // milliseconds of delay to allow the navx to start up
public static final double kXSlewRateLimit = 8; // TODO: adjust slew limits
public static final double kYSlewRateLimit = 8;
public static final double kTurnSlewRateLimit = 10;
public static final double kTeleMaxRadiansPerSec = Math.PI / 2; // TODO adjust max teleop speeds
public static final double kFastTeleMaxRadiansPerSec = Math.PI;
public static final double kFasterTeleMaxRadiansPerSec = Math.PI;
public static final double kTeleMaxMetersPerSec = 0.3;
public static final double kFastTeleMaxMetersPerSec = 1.0;
public static final double kFasterTeleMaxMetersPerSec = 1.8;
public static final double kNudgeSpeed = 0.8;
public static final Button kTestMotorButton = Button.kLeftBumper;
}
public static final class ModuleConstants {
public static final double kWheelDiameterMeters = 0.0762;
public static final double kDriveMotorGearRatio = 8.14;
public static final double kTurningMotorGearRatio = 12.8;
public static final double kDriveEncoderRot2Meter = kDriveMotorGearRatio * Math.PI * kWheelDiameterMeters;
public static final double kTurningEncoderRot2Rad = kTurningMotorGearRatio * 2 * Math.PI;
public static final double kDriveEncoderRPM2MeterPerSec = kDriveEncoderRot2Meter / 60;
public static final double kTurningEncoderRPM2RadPerSec = kTurningEncoderRot2Rad / 60;
public static final double kModuleDeadband = 0.005;
public static final double kTurningP = 1;
public static final double kTurningI = 0.0;
public static final double kTurningD = 0.004;
public static final double kTurningPeriod = .005;
}
public static final class OIConstants {
public static final int kDriverControllerPort = 0;
public static final int kSecondControllerPort = 1;
public static final double kDriveDeadband = 0.02;
public static final double kTriggerDeadband = 0.75;
}
public static final class ShooterConstants {
public static final int kBackMotorCanId = 51;
public static final int kFrontMotorCanId = 52;
public static final int kIndexMotorCanId = 53;
public static final int kWinchMotorCanId = 54;
public static final double kShooterMaxSpeed = 1.0;
public static final double kFrontShootPower = 1.0;
public static final double kBackShootPower = -1.0;
public static final double kFrontIntakePower = -0.35;
public static final double kBackIntakePower = 0.35;
}
public static final class WinchySquinchyConstants{
public static final double kWinchUpPower = 0.5;
public static final double kWinchDownPower = -1.0;
public static final double kWinchDeadBand = 0.05;
public static final double kWinchUpPreset = 0;
public static final double kWinchDownPreset = 1.75;//was 1.5
}
public static final class ClimberConstants {
public static final int kLeftClimberCanId = 61;
public static final int kRightClimberCanId = 62;
public static final int kClimberUpPower = -1;
public static final int kClimberDownPower = 1;
public static final int kClimberMaxAmps = 200000;
}
public static final class LimelightConstants {
public static final double kCamHeight = 0; // Height of the limelight from the ground
public static final double kCamAngle = 0; // Pitch angle of direction the limelight is pointed in
}
public static final class IntakeConstants {
public static final int kFlippyCanId = 1;
public static final int kGroundIntakeCanId = 2;
public static final int kIntakeMaxCurrent = 10;
public static final double kFlipperGearRatio = 45;
}
}