Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Keobkeig committed Jan 17, 2024
2 parents 5ddb34d + 6ae77a3 commit 0cb359c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 30 deletions.
23 changes: 23 additions & 0 deletions .Glass/glass.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"NetworkTables": {
"transitory": {
"SmartDashboard": {
"Drivetrain": {
"open": true
},
"open": true
}
},
"types": {
"/FMSInfo": "FMSInfo",
"/SmartDashboard/Autonomous": "String Chooser"
}
},
"NetworkTables Info": {
"visible": true
},
"NetworkTables Settings": {
"mode": "Client (NT4)",
"serverTeam": "694"
}
}
27 changes: 7 additions & 20 deletions src/main/java/com/stuypulse/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
package com.stuypulse.robot;

import com.stuypulse.robot.commands.auton.DoNothingAuton;
import com.stuypulse.robot.commands.drivetrain.DriveDrive;
import com.stuypulse.robot.commands.drivetrain.DrivetrainDrive;
import com.stuypulse.robot.commands.drivetrain.DrivetrainDriveForever;
import com.stuypulse.robot.commands.launcher.LaunchNote;
import com.stuypulse.robot.commands.launcher.LaunchPrepare;
import com.stuypulse.robot.commands.launcher.LauncherLaunch;
import com.stuypulse.robot.commands.launcher.LauncherIntakeNote;
import com.stuypulse.robot.commands.launcher.LauncherStop;
import com.stuypulse.robot.commands.odometry.OdometryRealign;
Expand All @@ -35,7 +33,7 @@ public class RobotContainer {

// Subsystem
public final AbstractDrivetrain drivetrain = AbstractDrivetrain.getInstance();
// public final Launcher launcher = Launcher.getInstance();
public final Launcher launcher = Launcher.getInstance();
//public final AbstractOdometry odometry = AbstractOdometry.getInstance();
//public final AbstractVision vision = AbstractVision.getInstance();

Expand Down Expand Up @@ -68,28 +66,17 @@ private void configureButtonBindings() {
}

private void configureDriverBindings() {
operator.getLeftBumper()
.onTrue(new LauncherIntakeNote())
driver.getRightBumper()
.whileTrue(new LauncherIntakeNote())
.onFalse(new LauncherStop());

operator.getRightBumper()
.whileTrue(new WaitCommand(0.5)
.andThen(new LaunchNote()))
driver.getBottomButton()
.onTrue(new LaunchPrepare())
.whileTrue(new WaitCommand(0.5).andThen(new LauncherLaunch()))
.onFalse(new LauncherStop());
}

private Command waitSeconds(double d) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'waitSeconds'");
}

private void configureOperatorBindings() {
// odometry
//driver.getDPadUp().onTrue(new OdometryRealign(Rotation2d.fromDegrees(180)));
//driver.getDPadLeft().onTrue(new OdometryRealign(Rotation2d.fromDegrees(-90)));
//driver.getDPadDown().onTrue(new OdometryRealign(Rotation2d.fromDegrees(0)));
//driver.getDPadRight().onTrue(new OdometryRealign(Rotation2d.fromDegrees(90)));

driver.getLeftButton().onTrue(new DrivetrainDriveForever(2));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,17 @@ public class DrivetrainDrive extends Command {
public DrivetrainDrive(Gamepad driver) {
this.drivetrain = AbstractDrivetrain.getInstance();

this.speed = IStream.create(
() -> driver.getRightY() - driver.getLeftY())
this.speed = IStream.create(() -> driver.getRightTrigger() - driver.getLeftTrigger())
.filtered(
x -> SLMath.deadband(x, 0),
x -> SLMath.spow(x, 2)
);

this.angle = IStream.create(
() -> driver.getRightX() - driver.getLeftX())
this.angle = IStream.create(() -> driver.getLeftX())
.filtered(
x -> SLMath.deadband(x, 0),
x -> SLMath.spow(x, 2)
x -> SLMath.spow(x, 2),
x -> -x
);

addRequirements(drivetrain);
Expand All @@ -39,6 +38,6 @@ public DrivetrainDrive(Gamepad driver) {

@Override
public void execute() {
drivetrain.arcadeDrive(speed.get(), angle.get());
drivetrain.curvatureDrive(speed.get(), angle.get(), true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import edu.wpi.first.wpilibj2.command.InstantCommand;

public class LaunchNote extends InstantCommand {
public class LauncherLaunch extends InstantCommand {
Launcher launcher;

public LaunchNote() {
public LauncherLaunch() {
launcher = Launcher.getInstance();
addRequirements(launcher);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static AbstractDrivetrain getInstance() {

public abstract void stop();

public abstract void periodicChild();
public void periodicChild() {}

@Override
public void periodic() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Angle getAngle() {
//********** Drive Methods **********//
public void tankDriveVolts(double leftVolts, double rightVolts) {
leftFront.setVoltage(leftVolts);
rightFront.setVoltage(-rightVolts);
rightFront.setVoltage(rightVolts);
drivetrain.feed();
}

Expand Down

0 comments on commit 0cb359c

Please sign in to comment.