File tree 5 files changed +16
-0
lines changed
5 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,13 @@ void Robot::RobotInit()
105
105
{ mShooter }
106
106
);
107
107
108
+
109
+ mShootAuto = new frc2::StartEndCommand (
110
+ [&]() { mShooter ->shootAuto (); },
111
+ [&]() { mShooter ->stopShooter (); },
112
+ { mShooter }
113
+ );
114
+
108
115
m_chooser.SetDefaultOption (kAutoNameDefault , kAutoNameDefault );
109
116
m_chooser.AddOption (kAutoDriveAndShoot , kAutoDriveAndShoot );
110
117
frc::SmartDashboard::PutData (" Auto Modes" , &m_chooser);
Original file line number Diff line number Diff line change 5
5
Shooter::Shooter (std::shared_ptr<cpptoml::table> toml) {
6
6
config.speed .near = toml->get_qualified_as <double >(" speed.near" ).value_or (2700 );
7
7
config.speed .far = toml->get_qualified_as <double >(" speed.far" ).value_or (3200 );
8
+ config.speed .auton = toml->get_qualified_as <double >(" speed.auto" ).value_or (2500 );
8
9
config.motor .p = toml->get_qualified_as <double >(" motor.p" ).value_or (0.01 );
9
10
config.motor .i = toml->get_qualified_as <double >(" motor.i" ).value_or (0.0 );
10
11
config.motor .d = toml->get_qualified_as <double >(" motor.d" ).value_or (0.0 );
@@ -41,6 +42,10 @@ void Shooter::shootNear() {
41
42
runShooter (config.speed .near );
42
43
}
43
44
45
+ void Shooter::shootAuto () {
46
+ runShooter (config.speed .auton );
47
+ }
48
+
44
49
void Shooter::stopShooter () {
45
50
mShooterMotor .StopMotor ();
46
51
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ intakeExtendedPosition = 1.0
6
6
7
7
[shooter ]
8
8
speed.near = 2400 # RPM
9
+ speed.auto = 2200 # RPM
9
10
speed.far = 2750
10
11
motor.p = 0.0005
11
12
motor.i = 0.0
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ class Robot : public frc::TimedRobot
71
71
72
72
frc2::StartEndCommand *mShootNear = nullptr ;
73
73
frc2::StartEndCommand *mShootFar = nullptr ;
74
+ frc2::StartEndCommand *mShootAuto = nullptr ;
74
75
75
76
frc2::SequentialCommandGroup * mDriveAndShoot = nullptr ;
76
77
};
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ class Shooter : public frc2::SubsystemBase {
17
17
void runShooter (double speed);
18
18
void shootFar ();
19
19
void shootNear ();
20
+ void shootAuto ();
20
21
void stopShooter ();
21
22
22
23
private:
@@ -44,6 +45,7 @@ class Shooter : public frc2::SubsystemBase {
44
45
struct {
45
46
double near;
46
47
double far;
48
+ double auton;
47
49
} speed;
48
50
49
51
struct {
You can’t perform that action at this time.
0 commit comments