Skip to content

Commit

Permalink
Added X mode with whiletrue and changed climber bind to driver left b…
Browse files Browse the repository at this point in the history
…umper
  • Loading branch information
taiywhy committed May 24, 2024
1 parent d38cf50 commit 4ae2695
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/main/cpp/RobotContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,22 @@ void RobotContainer::ConfigureBindings() {
[this] { return driveSub.CalcDistanceFromSpeaker(); }));
operatorController.B().OnFalse(NotUsingShooter());

driverController.Back().WhileTrue(
driverController.LeftBumper().WhileTrue(
climbSub.ManualControl([] { return 1; }, [] { return -1; }));

driverController.LeftBumper().WhileTrue(driveSub.DriveFactory(
DeadbandAndSquare([this] {
return ShouldFlipControlsForDriver(-driverController.GetLeftY());
}),
[this] { return -rotSpeed; }, DeadbandAndSquare([this] {
return ShouldFlipControlsForDriver(-driverController.GetRightX());
}),
[] { return false; }));
/*
driverController.LeftBumper().WhileTrue(driveSub.DriveFactory(
DeadbandAndSquare([this] {
return ShouldFlipControlsForDriver(-driverController.GetLeftY());
}),
[this] { return -rotSpeed; }, DeadbandAndSquare([this] {
return ShouldFlipControlsForDriver(-driverController.GetRightX());
}),
[] { return false; }));
*/

driverController.RightStick().OnTrue(driveSub.XCommand());

driverController.RightTrigger().WhileTrue(
driveSub
Expand Down
16 changes: 16 additions & 0 deletions src/main/cpp/subsystems/DrivebaseSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,22 @@ frc2::CommandPtr DrivebaseSubsystem::TurnToAngleFactory(
.WithName("Turn To Angle Factory");
}

frc2::CommandPtr DrivebaseSubsystem::XCommand() {
return frc2::cmd::Run(
[this] {
std::array<frc::SwerveModuleState, 4> states;

states[0].angle = 45_deg;
states[1].angle = -45_deg;
states[2].angle = -45_deg;
states[3].angle = 45_deg;

swerveDrive.SetModuleStates(states, true);
},
{this})
.WithName("X Pattern");
}

frc2::CommandPtr DrivebaseSubsystem::SelfTest() {
return swerveDrive.SelfTest({this});
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/include/subsystems/DrivebaseSubsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class DrivebaseSubsystem : public frc2::SubsystemBase {
frc2::CommandPtr SysIdQuasistaticDrive(frc2::sysid::Direction direction);
frc2::CommandPtr SysIdDynamicDrive(frc2::sysid::Direction direction);

frc2::CommandPtr XCommand();

frc2::CommandPtr WheelRadFwd();
frc2::CommandPtr WheelRadRev();

Expand Down

0 comments on commit 4ae2695

Please sign in to comment.