This repository has been archived by the owner on Jan 15, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from awtybots/development_features
Reimplemented a variety of improvements from the old development branch
- Loading branch information
Showing
17 changed files
with
218 additions
and
206 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
53 changes: 53 additions & 0 deletions
53
src/main/java/frc/robot/commands/ControlCommands/ClimberCommands.java
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,53 @@ | ||
// Copyright 2021-2024 FRC 6328, FRC 5829 | ||
// http://github.com/Mechanical-Advantage | ||
// | ||
// This program is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU General Public License | ||
// version 3 as published by the Free Software Foundation or | ||
// available in the root directory of this project. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
package frc.robot.commands.ControlCommands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import edu.wpi.first.wpilibj2.command.Commands; | ||
import edu.wpi.first.wpilibj2.command.button.Trigger; | ||
import frc.robot.subsystems.climber.Climber; | ||
|
||
public class ClimberCommands { | ||
|
||
private static final double MAX_MS = 0.01; | ||
|
||
private ClimberCommands() {} | ||
|
||
/** Wrist command using one axis of a joystick (controlling wrist velocity). */ | ||
public static Command buttonDrive(Climber climber, Trigger leftTrigger, Trigger rightTrigger) { | ||
return Commands.run( | ||
() -> { | ||
boolean left = leftTrigger.getAsBoolean(); | ||
boolean right = rightTrigger.getAsBoolean(); | ||
double magnitude = 0; | ||
|
||
if (left && right) { // there's probably a better way of doing this | ||
magnitude = 0; | ||
} else if ((left) && (!right)) { | ||
magnitude = 1; | ||
} else if ((!left) && (right)) { | ||
magnitude = -1; | ||
} else if ((!left) && (!right)) { | ||
magnitude = 0; | ||
} | ||
|
||
// Calcaulate new rotational velocity | ||
double position = magnitude * MAX_MS; | ||
|
||
// Send command to wrist subsystem to run wrist | ||
climber.runTargetPosition(position); | ||
}, | ||
climber); | ||
} | ||
} |
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.