Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Robot2019/src/main/java/frc/robot/RobotMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ private static UsbCamera configureCamera(int port) {
*
* @param ec The error code to check
*/
private static void catchError(ErrorCode ec) {
if (ec != ErrorCode.OK)
System.out
.println("Error configuring in RobotMap.java at line: " + new Throwable().getStackTrace()[1].getLineNumber());
public static void catchError(ErrorCode ec) {
if(ec != ErrorCode.OK) {
System.out.println("Error configuring in RobotMap.java at line: " + new Throwable().getStackTrace()[1].getLineNumber());
System.out.println(ec.toString());
}
}
}
11 changes: 3 additions & 8 deletions Robot2019/src/main/java/frc/robot/subsystems/Drivetrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import frc.robot.RobotMap;

public class Drivetrain extends Subsystem {
public enum Side {
Expand Down Expand Up @@ -150,16 +151,10 @@ public double getMaxVoltage() {

public void setVoltageCompensation(double volts) {
ErrorCode ecVoltSat = leftMaster.configVoltageCompSaturation(volts, 10);

if (!ecVoltSat.equals(ErrorCode.OK)) {
throw new RuntimeException("Voltage Saturation Configuration could not be set");
}
RobotMap.catchError(ecVoltSat);

ecVoltSat = rightMaster.configVoltageCompSaturation(volts, 10);

if (!ecVoltSat.equals(ErrorCode.OK)) {
throw new RuntimeException("Voltage Saturation Configuration could not be set");
}
RobotMap.catchError(ecVoltSat);

leftMaster.enableVoltageCompensation(true);
rightMaster.enableVoltageCompensation(true);
Expand Down