Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVR #32

Merged
merged 38 commits into from
Apr 11, 2022
Merged

SVR #32

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9d0ba93
`GRTShuffleboardLayout`, `.list()`, positions in code
ky28059 Mar 29, 2022
fa5b47e
Position and size methods for shuffleboard layout
ky28059 Mar 29, 2022
4bc05fd
Internals debugging and networktables
ky28059 Mar 30, 2022
ff0ca1a
Move `.addEntry()` to list-like `.at()` position syntax
ky28059 Mar 30, 2022
e329d83
Auton chooser, split up localize coordinate method
ky28059 Mar 30, 2022
8794024
2 ball auto + more debug networktables
ky28059 Mar 30, 2022
d9d2fba
Run intake in `DeployIntakeCommand`, `PlebAutonSequence` restructuring
ky28059 Mar 30, 2022
5a01184
Put hood and flywheel refs on shuffleboard, reset offsets on vision data
ky28059 Mar 30, 2022
e9aef3a
internals and turret tweaks
e3l Mar 30, 2022
6108af2
Separate driver and auto intake override, partially revert PlebAutonS…
ky28059 Mar 31, 2022
46639fc
Merge branch 'shuffleboard-abstraction' of https://github.com/grt192/…
ky28059 Mar 31, 2022
0a7c144
Jetson data pairing
ky28059 Mar 31, 2022
1c7d9a7
Shoot 2 balls at once, rtheta feedforward, turntable tolerance fix
ky28059 Apr 1, 2022
4f383e3
tweaked and tested shooter interpolation table
e3l Apr 1, 2022
0bba935
Two ball fixes
e3l Apr 1, 2022
58db64d
Only shoot two balls without delay when they are the same color
ky28059 Apr 1, 2022
d94c188
`.widget()`, better internals shuffleboard updating
ky28059 Apr 1, 2022
e3023e4
Intake shuffleboard organization
ky28059 Apr 4, 2022
207fa74
Climb shuffleboard organization
ky28059 Apr 4, 2022
827e399
Intake top limit switch + reset abstraction
e3l Apr 4, 2022
2c64a8c
Preliminary intake deploy tuning
ky28059 Apr 4, 2022
e53ea54
Intake tuning, shuffleboard manual zero
ky28059 Apr 6, 2022
76f28f3
Turret `setValue()` organization
ky28059 Apr 6, 2022
39fa9b6
Don't force if the turret is retracted
ky28059 Apr 6, 2022
ea72ccc
Limit current caps to add to below sustainable current
ky28059 Feb 18, 2022
51920ec
Move `getTotalCurrentDrawn()` to the `GRTSubsystem` level
ky28059 Feb 25, 2022
b92e187
Preemptively avoid `NaN` errors
ky28059 Feb 26, 2022
0b6ab85
Uncomment jetson
ky28059 Apr 6, 2022
95ed330
Shuffleboard limits and draws
ky28059 Apr 6, 2022
2a21a89
Drive controller trigger freezing
ky28059 Apr 7, 2022
15464f2
Turn off flywheel while driver is supplying power to DT
ky28059 Apr 7, 2022
f0efd60
Changed left bumper to hold (rather than toggle), disable brownout fo…
e3l Apr 7, 2022
77201e7
Driver override internals, intake power restraining, theta offset res…
e3l Apr 7, 2022
c415b9e
increased back intake power
e3l Apr 8, 2022
5e5920a
SVR Practice round tweaks, includes: internals force also forces flyw…
e3l Apr 9, 2022
05bc9c4
last intake code burnt out a motor so i'm a lil scared, here's some s…
e3l Apr 9, 2022
43cbe63
SVR Quals Day 1: climb limits, internals force forces flywheel then i…
e3l Apr 10, 2022
52d3899
auto force shot using internals forcing
e3l Apr 11, 2022
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
6 changes: 4 additions & 2 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public static final class InternalConstants {
public static final class IntakeConstants {
public static final int intakePort = 12;
public static final int deploymentPort = 11;
public static final int limitSwitchPort = 3;

public static final int tLimitSwitchPort = 3;
public static final int bLimitSwitchPort = 2;
}

public static final class ClimbConstants {
Expand All @@ -73,7 +75,7 @@ public static final class JetsonConstants {
public static final int turretCameraPort = 1181;
public static final int intakeCameraPort = 1182;
public static final int jetsonPort = 5800;
public static final String jetsonIP = "10.1.92.94";
public static final String jetsonIP = "10.1.92.12";
}

public static final class ShuffleboardConstants {
Expand Down
18 changes: 12 additions & 6 deletions src/main/java/frc/robot/GRTSubsystem.java
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
package frc.robot;

import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.brownout.PowerController;

/**
* A convenience class wrapping SubsystemBase for brownout and other shared subsystem logic.
*/
public abstract class GRTSubsystem extends SubsystemBase {
protected final double minCurrent;
private final int[] motorPorts;

/**
* Creates a GRTSubsystem from the given minimum current.
* Creates a GRTSubsystem from the given minimum current and motor ports to be checked for subsystem current draw.
* @param minCurrent The minimum current.
*/
public GRTSubsystem(double minCurrent) {
public GRTSubsystem(double minCurrent, int... motorPorts) {
this.minCurrent = minCurrent;
this.motorPorts = motorPorts;
}

/**
* Gets the subsystem's minimum current.
* @return The minimum current.
*/
public double getMinCurrent() {
public final double getMinCurrent() {
return minCurrent;
}

/**
* Gets the total current being drawn by the subsystem. Implementers should use `PowerController.getCurrentDrawnFromPDH`
* with all the subsystem's motor controller ports.
* Gets the total current being drawn by the subsystem by summing the current drawn by the supplied motor controller
* ports on the PDH.
* @param powerController The PowerController instance, for calling `getCurrentDrawnFromPDH`.
* @return The total current being drawn by the subsystem.
*/
abstract public double getTotalCurrentDrawn();
public final double getTotalCurrentDrawn(PowerController powerController) {
return powerController.getCurrentDrawnFromPDH(motorPorts);
}

/**
* Sets the subsystem's current limit. Implementers should split the subsystem's limit between their motor controllers and
Expand Down
18 changes: 7 additions & 11 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package frc.robot;

import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.wpilibj.PowerDistribution;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
import edu.wpi.first.wpilibj2.command.Command;
Expand All @@ -23,10 +22,8 @@
* project.
*/
public class Robot extends TimedRobot {
private Command autonomousCommand;

private RobotContainer robotContainer;
private PowerDistribution powerDistribution;
private Command autonomousCommand;

/**
* This function is run when the robot is first started up and should be used for any
Expand All @@ -37,7 +34,6 @@ public void robotInit() {
// Instantiate our RobotContainer. This will perform all our button bindings, and put our
// autonomous chooser on the dashboard.
robotContainer = new RobotContainer();
powerDistribution = new PowerDistribution();

// Start camera server automatic capture and disable livewindow telemetry
CameraServer.startAutomaticCapture();
Expand All @@ -60,14 +56,14 @@ public void robotPeriodic() {
CommandScheduler.getInstance().run();

// Calculate current limits for subsystems
//robotContainer.getPowerController().calculateLimits();
// robotContainer.getPowerController().calculateLimits();
}

/** This function is called once each time the robot enters Disabled mode. */
@Override
public void disabledInit() {
// Turn off the ring light when the robot disables
powerDistribution.setSwitchableChannel(false);
robotContainer.getPowerDistribution().setSwitchableChannel(false);
}

@Override
Expand All @@ -81,7 +77,7 @@ public void autonomousInit() {
if (autonomousCommand != null) autonomousCommand.schedule();

// Turn on the ring light
powerDistribution.setSwitchableChannel(true);
robotContainer.getPowerDistribution().setSwitchableChannel(true);
}

/** This function is called periodically during autonomous. */
Expand All @@ -97,7 +93,7 @@ public void teleopInit() {
if (autonomousCommand != null) autonomousCommand.cancel();

// Turn on the ring light
powerDistribution.setSwitchableChannel(true);
robotContainer.getPowerDistribution().setSwitchableChannel(true);
}

/** This function is called periodically during operator control. */
Expand All @@ -114,7 +110,7 @@ public void testInit() {
CommandScheduler.getInstance().cancelAll();

// Turn on the ring light
powerDistribution.setSwitchableChannel(true);
robotContainer.getPowerDistribution().setSwitchableChannel(true);

// Run DT turning left and right alternating
tankSubsystem.setCarDrivePowers(0, 1); // Rotate DT right
Expand All @@ -126,7 +122,7 @@ public void testInit() {
// Sweep intake from -1 to 1 power
intakeSubsystem.setDriverOverride(true);
for (double pow = -1; pow <= 1; pow += 0.1) {
intakeSubsystem.setIntakePower(pow);
intakeSubsystem.setDriverPower(pow);
Timer.delay(0.1);
}
intakeSubsystem.setDriverOverride(false);
Expand Down
Loading