Skip to content

Commit

Permalink
fixed stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
abbbbbby committed Feb 16, 2018
1 parent abf83ab commit eb99072
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ public void setLeftMotorPower(double power) {
}

public double getLeftCurrent() {
return robot.getPDP().getCurrent(config.leftMotor.getPowerChannel());
return config.leftMotor.getTotalCurrent(robot.getPDP());
}

public double getRightCurrent() {
return robot.getPDP().getCurrent(config.rightMotor.getPowerChannel());
return config.rightMotor.getTotalCurrent(robot.getPDP());
}

public double getLeftRate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ protected boolean step() {
@Override
protected void finish(boolean interrupted) {
super.finish(interrupted);
if ((lowerLimit ? isAtBottomLimit() : isAtTopLimit())) {
if((lowerLimit ? isAtBottomLimit() : isAtTopLimit())) {
sendMessage("Lift has successfully reached limit", AutomatedTestMessage.Level.INFO);
} else {
sendMessage("Lift has failed to reached limit", AutomatedTestMessage.Level.ERROR);
Expand Down
21 changes: 8 additions & 13 deletions rio/src/main/java/org/teamtators/levitator/subsystems/Picker.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.teamtators.levitator.subsystems;

import edu.wpi.first.wpilibj.PowerDistributionPanel;
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.SpeedController;
Expand All @@ -17,7 +17,6 @@
import org.teamtators.common.tester.components.DigitalSensorTest;
import org.teamtators.common.tester.components.SolenoidTest;
import org.teamtators.common.tester.components.SpeedControllerTest;
import org.teamtators.levitator.TatorRobot;

import java.util.Arrays;
import java.util.List;
Expand All @@ -30,20 +29,16 @@ public class Picker extends Subsystem implements Configurable<Picker.Config> {
private DigitalSensor cubeDetectLeftSensor;
private DigitalSensor cubeDetectRightSensor;

private TatorRobot robot;
private Config config;

public Picker(TatorRobot robot) {
public Picker() {
super("Picker");
this.robot = robot;
}

public double getLeftCurrent() {
return robot.getPDP().getCurrent(config.leftMotor.getPowerChannel());
return ((WPI_TalonSRX)leftMotor).getOutputCurrent();
}

public double getRightCurrent() {
return robot.getPDP().getCurrent(config.rightMotor.getPowerChannel());
return ((WPI_TalonSRX)rightMotor).getOutputCurrent();
}

public void setRollerPowers(double left, double right) {
Expand Down Expand Up @@ -116,15 +111,15 @@ public ManualTestGroup createManualTests() {
public List<AutomatedTest> createAutomatedTests() {
return Arrays.asList(
new MotorCurrentTest("PickerLeftMotorCurrentTest", this::setLeftMotorPower, this::getLeftCurrent),
new MotorCurrentTest("PickerRightMotorCurrentTest", this::setRightMotorPower, this::getRightCurrent)
//TODO: Hybrid tests
new MotorCurrentTest("PickerRightMotorCurrentTest", this::setRightMotorPower, this::getRightCurrent),
new org.teamtators.common.tester.automated.DigitalSensorTest("CubeDetectSensorTest", this::isCubeDetected),
new org.teamtators.common.tester.automated.DigitalSensorTest("CubeDetectLeftSensorTest", this::isCubeDetectedLeft),
new org.teamtators.common.tester.automated.DigitalSensorTest("CubeDetectRightSensorTest", this::isCubeDetectedRight)
);
}

@Override
public void configure(Config config) {
this.config = config;

this.leftMotor = config.leftMotor.create();
this.rightMotor = config.rightMotor.create();
this.extensionSolenoid = config.extensionSolenoid.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class Subsystems extends SubsystemsBase {
public Subsystems(TatorRobot robot) {
oi = new OperatorInterface();
drive = new Drive(robot);
picker = new Picker(robot);
picker = new Picker();
lift = new Lift(robot);

//your subsystems here
Expand Down

0 comments on commit eb99072

Please sign in to comment.