Skip to content

Commit 6071f97

Browse files
Merge branch 'calibrate-auto'
Approved by Justin C
2 parents 23c08d4 + b6357be commit 6071f97

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

src/main/cpp/Robot.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,23 @@ void Robot::RobotInit()
105105
);
106106

107107
m_chooser.SetDefaultOption(kAutoNameDefault, kAutoNameDefault);
108-
m_chooser.AddOption(kAutoShootAndDrive, kAutoShootAndDrive);
108+
m_chooser.AddOption(kAutoDriveAndShoot, kAutoDriveAndShoot);
109109
frc::SmartDashboard::PutData("Auto Modes", &m_chooser);
110110

111-
mShootAndDrive = new frc2::SequentialCommandGroup {
112-
ShootCommand {mShooter}.WithTimeout(1_s),
113-
frc2::FunctionalCommand { // drive backwards
114-
[](){},
115-
[&](){
116-
mSwerveDrive->setMotion(0, -0.5, 0);
117-
},
118-
[&](bool _interrupted){
119-
mSwerveDrive->setMotion(0, 0, 0); //stop swerve
120-
},
121-
[](){ return false; },
122-
{mSwerveDrive}
123-
}.WithTimeout(2_s)
111+
mDriveAndShoot = new frc2::SequentialCommandGroup {
112+
frc2::FunctionalCommand { // drive backwards
113+
[](){},
114+
[&](){
115+
// Turn slightly right to compensate for drift/drag.
116+
mSwerveDrive->setMotion(0, -0.5, -0.03);
117+
},
118+
[&](bool _interrupted){
119+
mSwerveDrive->setMotion(0, 0, 0); //stop swerve
120+
},
121+
[](){ return false; },
122+
{mSwerveDrive}
123+
}.WithTimeout(1.2_s),
124+
frc2::StartEndCommand(*mShootNear).WithTimeout(3_s)
124125
};
125126
}
126127

@@ -154,8 +155,8 @@ void Robot::AutonomousInit()
154155
// kAutoNameDefault);
155156
std::cout << "Auto selected: " << m_autoSelected << std::endl;
156157

157-
if (m_autoSelected == kAutoShootAndDrive) {
158-
mShootAndDrive->Schedule();
158+
if (m_autoSelected == kAutoDriveAndShoot) {
159+
mDriveAndShoot->Schedule();
159160
} else {
160161
// Default Auto goes here
161162
}

src/main/include/Robot.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Robot : public frc::TimedRobot
5050
frc::SendableChooser<std::string> m_chooser;
5151
const std::string kAutoNameDefault = "Default";
5252
const std::string kAutoNameCustom = "My Auto";
53-
const std::string kAutoShootAndDrive = "Shoot and Drive";
53+
const std::string kAutoDriveAndShoot = "Drive and Shoot";
5454
std::string m_autoSelected;
5555

5656
frc::XboxController * driverController = nullptr;
@@ -72,5 +72,5 @@ class Robot : public frc::TimedRobot
7272
frc2::StartEndCommand *mShootNear = nullptr;
7373
frc2::StartEndCommand *mShootFar = nullptr;
7474

75-
frc2::SequentialCommandGroup * mShootAndDrive = nullptr;
75+
frc2::SequentialCommandGroup * mDriveAndShoot = nullptr;
7676
};

0 commit comments

Comments
 (0)