-
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.
- Loading branch information
1 parent
56f6aec
commit 27dc7b3
Showing
39 changed files
with
274 additions
and
411 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
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 |
---|---|---|
@@ -1,23 +1,25 @@ | ||
#include "commands/ArmDrive.h" | ||
|
||
#include <utility> | ||
|
||
#include "Robot.h" | ||
|
||
|
||
ArmDrive::ArmDrive( | ||
std::function<double()> speed, | ||
Arm& arm): | ||
m_speed(std::move(speed)), | ||
m_arm(&arm){ | ||
Arm& arm, | ||
std::function<double()> speed): | ||
m_arm(&arm), | ||
m_speed(std::move(speed)){ | ||
|
||
SetName("ArmDrive"); | ||
AddRequirements({m_arm}); | ||
|
||
} | ||
|
||
|
||
void ArmDrive::Execute() { | ||
m_arm->Rotate(m_speed()); | ||
} | ||
|
||
|
||
void ArmDrive::End(bool) { | ||
m_arm->Rotate(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
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 |
---|---|---|
@@ -1,38 +1,32 @@ | ||
// 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/TankDrive.h" | ||
|
||
#include <utility> | ||
|
||
#include "Robot.h" | ||
|
||
// Initialises the command with its name and requirements | ||
|
||
TankDrive::TankDrive( | ||
Drivetrain& drivetrain, | ||
std::function<double()> left, | ||
std::function<double()> right, | ||
Drivetrain& drivetrain): | ||
std::function<double()> right): | ||
m_drivetrain(&drivetrain), | ||
m_left(std::move(left)), | ||
m_right(std::move(right)), | ||
m_drivetrain(&drivetrain){ | ||
m_right(std::move(right)){ | ||
|
||
SetName("TankDrive"); | ||
AddRequirements({m_drivetrain}); | ||
|
||
} | ||
|
||
// Called repeatedly when this Command is scheduled to run | ||
|
||
void TankDrive::Execute() { | ||
m_drivetrain->Drive(m_left(), m_right()); | ||
} | ||
|
||
// Make this return true when this Command no longer needs to run execute() | ||
|
||
bool TankDrive::IsFinished() { | ||
return false; | ||
} | ||
|
||
// Called once after isFinished returns true | ||
|
||
void TankDrive::End(bool) { | ||
m_drivetrain->Drive(0, 0); | ||
} |
Oops, something went wrong.