Compare commits
No commits in common. "908aca7bd141625991f0a92c82ca4d3f7bbc0202" and "c38c3d12134322e9406ed767d81cc29091758817" have entirely different histories.
908aca7bd1
...
c38c3d1213
@ -8,46 +8,26 @@ import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
|||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
import edu.wpi.first.wpilibj2.command.Command;
|
||||||
import edu.wpi.first.wpilibj2.command.Commands;
|
import edu.wpi.first.wpilibj2.command.Commands;
|
||||||
import edu.wpi.first.wpilibj2.command.button.CommandPS5Controller;
|
|
||||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||||
import frc.robot.constants.ArmConstants;
|
import frc.robot.constants.ArmConstants;
|
||||||
import frc.robot.constants.IOConstants;
|
import frc.robot.constants.IOConstants;
|
||||||
import frc.robot.subsystems.Arm;
|
import frc.robot.subsystems.Arm;
|
||||||
import frc.robot.subsystems.DriveTrain;
|
|
||||||
import frc.robot.subsystems.Grabber;
|
|
||||||
|
|
||||||
public class RobotContainer {
|
public class RobotContainer {
|
||||||
CommandPS5Controller driver;
|
CommandXboxController driver;
|
||||||
|
|
||||||
Arm arm;
|
Arm arm;
|
||||||
|
|
||||||
DriveTrain driveTrain;
|
|
||||||
Grabber grabber;
|
|
||||||
|
|
||||||
public RobotContainer() {
|
public RobotContainer() {
|
||||||
arm = new Arm();
|
arm = new Arm();
|
||||||
driveTrain = new DriveTrain();
|
driver = new CommandXboxController(IOConstants.kDriverID0);
|
||||||
grabber = new Grabber();
|
|
||||||
driver = new CommandPS5Controller(IOConstants.kDriverID0);
|
|
||||||
configureBindings();
|
configureBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureBindings() {
|
private void configureBindings() {
|
||||||
driveTrain.setDefaultCommand(
|
|
||||||
driveTrain.driveArcade(
|
|
||||||
driver::getLeftY,
|
|
||||||
driver::getLeftX
|
|
||||||
)
|
|
||||||
);
|
|
||||||
grabber.setDefaultCommand(grabber.stop());
|
|
||||||
driver.R1().whileTrue(grabber.runGrabberMotor(1));
|
|
||||||
driver.L1().whileTrue(grabber.runGrabberMotor(-1));
|
|
||||||
arm.setDefaultCommand(arm.stop());
|
|
||||||
driver.povUp().whileTrue(arm.runArmMotor(1));
|
|
||||||
driver.povDown().whileTrue(arm.runArmMotor(-1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command getAutonomousCommand() {
|
public Command getAutonomousCommand() {
|
||||||
return Commands.print("No autonomous command configured");
|
return Commands.print("No autonomous command configured");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
package frc.robot.constants;
|
|
||||||
|
|
||||||
public class GrabberConstants {
|
|
||||||
public static final int kGrabberLtMotorID6 = 6;
|
|
||||||
public static final int kGrabberRtMotorID7 = 7;
|
|
||||||
}
|
|
@ -18,8 +18,4 @@ public class Arm extends SubsystemBase {
|
|||||||
motor.set(speed);
|
motor.set(speed);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public Command stop() {
|
|
||||||
return run(() -> motor.set(0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,15 @@ public class DriveTrain extends SubsystemBase {
|
|||||||
}
|
}
|
||||||
public Command driveArcade(DoubleSupplier xSpeed, DoubleSupplier zRotation) {
|
public Command driveArcade(DoubleSupplier xSpeed, DoubleSupplier zRotation) {
|
||||||
return run(() -> {
|
return run(() -> {
|
||||||
|
//makes car like steering possible
|
||||||
drive.arcadeDrive(xSpeed.getAsDouble(), zRotation.getAsDouble());
|
drive.arcadeDrive(xSpeed.getAsDouble(), zRotation.getAsDouble());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Command driveTank(DoubleSupplier leftSpeed, DoubleSupplier rightSpeed) {
|
||||||
|
return run(() -> {
|
||||||
|
//makes tank steering possible
|
||||||
|
drive.tankDrive(leftSpeed.getAsDouble(), rightSpeed.getAsDouble());
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
package frc.robot.subsystems;
|
|
||||||
|
|
||||||
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
|
||||||
|
|
||||||
import edu.wpi.first.wpilibj2.command.Command;
|
|
||||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
|
||||||
import frc.robot.constants.ArmConstants;
|
|
||||||
import frc.robot.constants.DriveTrainConstants;
|
|
||||||
import frc.robot.constants.GrabberConstants;
|
|
||||||
|
|
||||||
public class Grabber extends SubsystemBase {
|
|
||||||
private WPI_TalonSRX motorRight;
|
|
||||||
private WPI_TalonSRX motorLeft;
|
|
||||||
|
|
||||||
|
|
||||||
public Grabber() {
|
|
||||||
motorRight = new WPI_TalonSRX(GrabberConstants.kGrabberRtMotorID7);
|
|
||||||
motorLeft = new WPI_TalonSRX(GrabberConstants.kGrabberLtMotorID6);
|
|
||||||
|
|
||||||
motorLeft.follow(motorRight);
|
|
||||||
}
|
|
||||||
public Command runGrabberMotor(double speed) {
|
|
||||||
return run(() -> {
|
|
||||||
motorRight.set(speed);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
public Command stop() {
|
|
||||||
return run(() -> motorRight.set(0));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user