-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Modified Limelight code to use a new function. - Implemented automatic climbing code into the Climb command. -- What happened to the commits before champs, like AZNorth and Ventura? __The world may never know.__
- Loading branch information
Showing
18 changed files
with
532 additions
and
171 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,76 @@ | ||
package frc.auto.commands; | ||
|
||
import java.util.HashMap; | ||
|
||
import com.ctre.phoenix.motorcontrol.ControlMode; | ||
|
||
import edu.wpi.first.networktables.NetworkTable; | ||
import edu.wpi.first.networktables.NetworkTableInstance; | ||
import frc.auto.commands.utils.Command; | ||
import frc.auto.commands.utils.ICommand; | ||
import frc.robot.RobotMap; | ||
|
||
/** | ||
* Drives the left and right motors a specified distance for a specified time. | ||
*/ | ||
@Command(name = "Climb") | ||
public class Climb extends ICommand { | ||
NetworkTable nt; // Used for debugging by printing messages. | ||
boolean isFront; // Switch for whether the front elevator is active. | ||
|
||
/** | ||
* Empty constructor for use in serialization. Do not add anything to this! | ||
* ... Do not call past midnight. | ||
*/ | ||
public Climb(HashMap<String, Double> map) { | ||
super(map); | ||
} | ||
|
||
/** | ||
* Creates a new instance of Climb with the following parameters. | ||
* When run() is called, the robot will wobble itself onto the habitat. | ||
* Once the duration has exceeded the runtime, the command will return. | ||
* @param angleSetpoint Target angle for climbing. | ||
* @param tiltThreshold Toggle climbing direction when the error exceeds the threshold. | ||
* @param duration Duration to climb for before timing out. Not yet implemented. | ||
*/ | ||
public Climb(double angleSetpoint, double tiltThreshold, double duration) { | ||
super(); | ||
this.parameters.put("angleSetpoint", angleSetpoint); | ||
this.parameters.put("tiltThreshold", tiltThreshold); | ||
this.parameters.put("duration", duration); | ||
|
||
nt = NetworkTableInstance.getDefault().getTable("datapublisher"); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public void run() { | ||
RobotMap.logger.printStatus("Attempting to climb. Wish me luck!"); | ||
|
||
double error = this.parameters.get("angleSetpoint") - RobotMap.pigeon.getPitch(); | ||
nt.getEntry("Climb Error").setNumber(error); | ||
|
||
if(isFront == true && error >= this.parameters.get("tiltThreshold")) { | ||
isFront = !isFront; | ||
RobotMap.logger.printDebug("Set direction on the climber to FALSE."); | ||
} | ||
else if(error < this.parameters.get("tiltThreshold")) { | ||
isFront = !isFront; | ||
RobotMap.logger.printDebug("Set direction on the climber to TRUE."); | ||
} | ||
|
||
if(isFront == true) { | ||
RobotMap.climber.disableArm(); | ||
RobotMap.elevator.setInnerSpeed(-0.85); | ||
} | ||
else { | ||
RobotMap.climber.enableArm(); | ||
RobotMap.elevator.setInnerSpeed(0); | ||
} | ||
|
||
RobotMap.climber.climbRollers.set(ControlMode.PercentOutput, 0.75); | ||
} | ||
} |
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
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
Oops, something went wrong.