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
11 changes: 4 additions & 7 deletions src/main/java/org/team199/robot2022/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

package org.team199.robot2022;

import edu.wpi.first.wpilibj.DataLogManager;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import frc.robot.lib.MotorErrors;
import frc.robot.lib.logging.Log;

/**
* The VM is configured to automatically run this class, and to call the functions corresponding to
Expand All @@ -25,10 +26,11 @@ public class Robot extends TimedRobot {
*/
@Override
public void robotInit() {
DataLogManager.start();
DriverStation.startDataLog(DataLogManager.getLog());
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
// autonomous chooser on the dashboard.
robotContainer = new RobotContainer(this);
Log.init();
}

/**
Expand All @@ -49,7 +51,6 @@ public void robotPeriodic() {
double totalAmps = robotContainer.pdp.getTotalCurrent();
SmartDashboard.putNumber("PDP Voltage", batteryVolts);
SmartDashboard.putNumber("PDP Current", totalAmps);
Log.logData();
MotorErrors.printSparkMaxErrorMessages();
}

Expand All @@ -62,8 +63,6 @@ public void disabledInit() {
robotContainer.dt.coast();
} catch(InterruptedException e) {}
}).start();
Log.flush();
Log.setDataLoggingDisabled(true);
}

@Override
Expand All @@ -75,7 +74,6 @@ public void autonomousInit() {
robotContainer.dt.brake();
robotContainer.dt.resetOdometry();
robotContainer.getAutonomousCommand().schedule();
Log.setDataLoggingDisabled(false);
robotContainer.initShooterConfig();
}

Expand All @@ -91,7 +89,6 @@ public void teleopInit() {
// this line or comment it out.
CommandScheduler.getInstance().cancelAll();
robotContainer.dt.brake();
Log.setDataLoggingDisabled(false);
robotContainer.initShooterConfig();
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/team199/robot2022/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public RobotContainer(Robot robot) {
autoSelector.addOption(Integer.toString(i), autoPaths[i]);
}

SmartDashboard.putData(shooter);

SmartDashboard.putData("Auto Selector", autoSelector);

SmartDashboard.putNumber("Field Offset from North (degrees)", getAutoPath() == null ? 180 : getAutoPath().path.get(0).getRotation2d(0).getDegrees() + 180);
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/org/team199/robot2022/subsystems/Shooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@

import org.team199.robot2022.Constants;

import edu.wpi.first.util.sendable.SendableBuilder;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
//import edu.wpi.first.wpilibj.SpeedController;
//import java.lang.AutoCloseable;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.lib.MotorControllerFactory;
import frc.robot.lib.SparkVelocityPIDController;
import frc.robot.lib.MotorErrors.TemperatureLimit;
import frc.robot.lib.LinearActuator;
import frc.robot.lib.LinearInterpolation;
import frc.robot.lib.logging.Log;

public class Shooter extends SubsystemBase {
private static double kV = 0.129 / 60;
Expand Down Expand Up @@ -64,10 +62,6 @@ public Shooter() {
slave.setIdleMode(IdleMode.kCoast);

SmartDashboard.putNumber("Ball PSI", ballPSI);

Log.registerDoubleVar("Shooter RPM", () -> pidController.getEncoder().getVelocity());
Log.registerDoubleVar("Shooter Current Master", () -> master.getOutputCurrent());
Log.registerDoubleVar("Shooter Current Slave", () -> slave.getOutputCurrent());
Comment thread
CoolSpy3 marked this conversation as resolved.
}

public void updateFromPSI() {
Expand Down Expand Up @@ -180,6 +174,13 @@ public <T> T chooseFromPosition(T fender, T awayFender, T tarmac) {
}
}

@Override
public void initSendable(SendableBuilder builder) {
super.initSendable(builder);
builder.addDoubleProperty("Shooter Master Current", master::getOutputCurrent, null);
builder.addDoubleProperty("Shooter Slave Current", slave::getOutputCurrent, null);
}

public static enum ShotPosition {
FENDER, AWAY_FROM_FENDER, TARMAC;
}
Expand Down