Skip to content

Commit

Permalink
Added full babys
Browse files Browse the repository at this point in the history
  • Loading branch information
taiywhy committed Apr 12, 2024
1 parent 1434d5c commit f5914f4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/cpp/RobotContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@ RobotContainer::RobotContainer() {
}

void RobotContainer::ConfigureBindings() {
testController.RightBumper().WhileTrue(BabySpinUpShooter());
testController.RightBumper().OnFalse(NotUsingShooter());

driveSub.SetDefaultCommand(driveSub.BabyDriveFactory(
DeadbandAndSquare([this] { return -testController.GetLeftY(); }),
DeadbandAndSquare([this] { return -testController.GetLeftX(); }),
DeadbandAndSquare([this] { return -testController.GetRightX(); }),
[] { return true; }));

operatorController.X().WhileTrue(shooterSub.GoToSpeedCmd([this] {
return frc::ApplyDeadband<double>(operatorController.GetLeftY(), 0.1);
}));

operatorController.RightBumper().WhileTrue(BabySpinUpShooter());

operatorController.RightTrigger().WhileTrue(intakeSub.SuckInNotes());
operatorController.LeftTrigger().WhileTrue(IntakeNote());

Expand Down
17 changes: 17 additions & 0 deletions src/main/cpp/subsystems/DrivebaseSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,23 @@ frc2::CommandPtr DrivebaseSubsystem::ResetPosition(
});
}

frc2::CommandPtr DrivebaseSubsystem::BabyDriveFactory(
std::function<double()> fow, std::function<double()> side,
std::function<double()> rot, std::function<bool()> fieldOriented) {
return frc2::RunCommand(
[this, fow, side, rot, fieldOriented]() {
swerveDrive.Drive(
fow() * constants::swerve::physical::MAX_LINEAR_SPEED * .10,
side() * constants::swerve::physical::MAX_LINEAR_SPEED * .10,
rot() * constants::swerve::physical::MAX_ROTATION_SPEED *
.10,
true, fieldOriented());
},
{this})
.ToPtr()
.WithName("Baby Drive Factory");
}

frc2::CommandPtr DrivebaseSubsystem::DriveFactory(
std::function<double()> fow, std::function<double()> side,
std::function<double()> rot, std::function<bool()> fieldOriented) {
Expand Down
1 change: 1 addition & 0 deletions src/main/include/RobotContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class RobotContainer {
void ConfigureBindings();
frc2::CommandXboxController driverController{0};
frc2::CommandXboxController operatorController{1};
frc2::CommandXboxController testController{2};

DrivebaseSubsystem driveSub;
ShooterSubsystem shooterSub;
Expand Down
5 changes: 5 additions & 0 deletions src/main/include/subsystems/DrivebaseSubsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class DrivebaseSubsystem : public frc2::SubsystemBase {
void UpdateOdometry();
frc2::CommandPtr ResetPosition(std::function<frc::Pose2d()> newPosition);

frc2::CommandPtr BabyDriveFactory(std::function<double()> fow,
std::function<double()> side,
std::function<double()> rot,
std::function<bool()> fieldOriented);

frc2::CommandPtr DriveFactory(std::function<double()> fow,
std::function<double()> side,
std::function<double()> rot,
Expand Down

0 comments on commit f5914f4

Please sign in to comment.