-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove forward, fix taxi, increase auto intake power (#4)
remove forward, fix taxi, increase auto intake power
- Loading branch information
Showing
14 changed files
with
223 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
#include "commands/AutoDriveForward.h" | ||
|
||
#include <frc/controller/PIDController.h> | ||
|
||
#include "Robot.h" | ||
|
||
AutoDriveForward::AutoDriveForward( | ||
Drivetrain& drivetrain): | ||
m_drivetrain(&drivetrain) { | ||
|
||
SetName("MoveBack"); | ||
AddRequirements({m_drivetrain}); | ||
} | ||
|
||
// Called just before this Command runs the first time | ||
void AutoDriveForward::Initialize() { | ||
duration_counter = 0; | ||
// Get everything in a safe starting state. | ||
m_drivetrain->Drive(0, 0); | ||
} | ||
|
||
// Called repeatedly when this Command is scheduled to run | ||
void AutoDriveForward::Execute() { | ||
if (duration_counter < duration){ | ||
m_drivetrain->Drive(-0.5, 0.5); | ||
duration_counter++; | ||
} | ||
} | ||
|
||
// Make this return true when this Command no longer needs to run execute() | ||
bool AutoDriveForward::IsFinished() { | ||
return (duration_counter >= duration); | ||
} | ||
|
||
// Called once after isFinished returns true | ||
void AutoDriveForward::End(bool) { | ||
m_drivetrain->Drive(0, 0); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
#include "commands/AutoIntakeOut.h" | ||
|
||
#include <frc/controller/PIDController.h> | ||
|
||
#include "Robot.h" | ||
|
||
AutoIntakeOut::AutoIntakeOut( | ||
Intake& intake): | ||
m_intake(&intake) { | ||
|
||
SetName("MoveBack"); | ||
AddRequirements({m_intake}); | ||
} | ||
|
||
// Called just before this Command runs the first time | ||
void AutoIntakeOut::Initialize() { | ||
duration_counter = 0; | ||
// Get everything in a safe starting state. | ||
m_intake->Stop(); | ||
} | ||
|
||
// Called repeatedly when this Command is scheduled to run | ||
void AutoIntakeOut::Execute() { | ||
if (duration_counter < duration){ | ||
m_intake->Rotate(1); | ||
duration_counter++; | ||
} | ||
} | ||
|
||
// Make this return true when this Command no longer needs to run execute() | ||
bool AutoIntakeOut::IsFinished() { | ||
return (duration_counter >= duration);; | ||
} | ||
|
||
// Called once after isFinished returns true | ||
void AutoIntakeOut::End(bool) { | ||
m_intake->Stop(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "commands/IntakeYeet.h" | ||
|
||
#include "Robot.h" | ||
#include "RobotContainer.h" | ||
|
||
IntakeYeet::IntakeYeet(Intake& intake) : m_intake(&intake){ | ||
SetName("IntakeYeet"); | ||
AddRequirements({m_intake}); | ||
} | ||
|
||
void IntakeYeet::Initialize(){ | ||
m_intake->Stop(); | ||
} | ||
|
||
void IntakeYeet::Execute() { | ||
m_intake->Rotate(speed); | ||
} | ||
|
||
void IntakeYeet::End(bool){ | ||
m_intake->Stop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include <frc2/command/CommandBase.h> | ||
#include <frc2/command/CommandHelper.h> | ||
|
||
#include "subsystems/Drivetrain.h" | ||
|
||
/** | ||
* Drive the given distance straight (negative values go backwards). | ||
* Uses a local PID controller to run a simple PID loop that is only | ||
* enabled while this command is running. The input is the averaged | ||
* values of the left and right encoders. | ||
*/ | ||
class AutoDriveTaxi: public frc2::CommandHelper<frc2::CommandBase, AutoDriveTaxi> { | ||
|
||
public: | ||
|
||
AutoDriveTaxi(Drivetrain& drivetrain); | ||
void Initialize() override; | ||
void Execute() override; | ||
bool IsFinished() override; | ||
void End(bool interrupted) override; | ||
|
||
private: | ||
|
||
Drivetrain* m_drivetrain; | ||
int duration = 150; | ||
int duration_counter; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
#pragma once | ||
|
||
#include <frc2/command/CommandBase.h> | ||
#include <frc2/command/CommandHelper.h> | ||
|
||
#include "subsystems/Intake.h" | ||
|
||
/** | ||
* Drive the given distance straight (negative values go backwards). | ||
* Uses a local PID controller to run a simple PID loop that is only | ||
* enabled while this command is running. The input is the averaged | ||
* values of the left and right encoders. | ||
*/ | ||
class AutoIntakeOut: public frc2::CommandHelper<frc2::CommandBase, AutoIntakeOut> { | ||
|
||
public: | ||
|
||
AutoIntakeOut(Intake& intake); | ||
void Initialize() override; | ||
void Execute() override; | ||
bool IsFinished() override; | ||
void End(bool interrupted) override; | ||
|
||
private: | ||
|
||
Intake* m_intake; | ||
int duration = 25; | ||
int duration_counter; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include <frc2/command/CommandBase.h> | ||
#include <frc2/command/CommandHelper.h> | ||
|
||
#include "subsystems/Intake.h" | ||
|
||
class IntakeYeet : public frc2::CommandHelper<frc2::CommandBase, IntakeYeet> { | ||
public: | ||
explicit IntakeYeet(Intake& intake); | ||
void Initialize() override; | ||
void Execute() override; | ||
void End(bool interrupted) override; | ||
|
||
private: | ||
Intake* m_intake; | ||
double speed = 1; | ||
}; |