Skip to content

Commit

Permalink
Merge pull request #136 from frc4911/talonfx-swerve
Browse files Browse the repository at this point in the history
Talonfx swerve
  • Loading branch information
MrBreakNFix authored Mar 13, 2024
2 parents b7f266c + 75b2cc6 commit ec3af85
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public record DriveConstants(
PidValues driveFeedBackValues,
FeedForwardValues driveFeedForwardValues,
int pigeonId,
String canBusId,
ModuleConstants frontLeft,
ModuleConstants frontRight,
ModuleConstants backLeft,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public enum ButtonAction {
StowShooter,
CollectNote,
StowCollector,
FireNote,
FireNoteSpeaker,
StowClimber,
ExtendClimber,
AimSubwoofer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class GyroIOPigeon2 implements GyroIO {
private final StatusSignal<Double> rollVelocity;

public GyroIOPigeon2(DriveConstants constants) {
pigeon = new Pigeon2(constants.pigeonId());
pigeon = new Pigeon2(constants.pigeonId(), constants.canBusId());

yaw = pigeon.getYaw();
yawVelocity = pigeon.getAngularVelocityZWorld();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// license that can be found in the LICENSE file at
// the root directory of this project.

package com.cyberknights4911.wham.drive;
package com.cyberknights4911.drive;

import com.ctre.phoenix6.BaseStatusSignal;
import com.ctre.phoenix6.StatusSignal;
Expand All @@ -18,7 +18,6 @@
import com.ctre.phoenix6.signals.InvertedValue;
import com.ctre.phoenix6.signals.NeutralModeValue;
import com.cyberknights4911.constants.DriveConstants;
import com.cyberknights4911.drive.ModuleIO;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.util.Units;

Expand Down
32 changes: 16 additions & 16 deletions src/main/java/com/cyberknights4911/robot2024/Robot2024.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.cyberknights4911.drive.GyroIOPigeon2;
import com.cyberknights4911.drive.ModuleIO;
import com.cyberknights4911.drive.ModuleIOSim;
import com.cyberknights4911.drive.ModuleIOTalonFX;
import com.cyberknights4911.entrypoint.RobotContainer;
import com.cyberknights4911.robot2024.climb.Climb;
import com.cyberknights4911.robot2024.climb.ClimbIO;
Expand All @@ -25,7 +26,6 @@
import com.cyberknights4911.robot2024.collect.CollectIOReal;
import com.cyberknights4911.robot2024.collect.CollectIOSim;
import com.cyberknights4911.robot2024.control.ControllerBinding;
import com.cyberknights4911.robot2024.drive.ModuleIOSparkFlex;
import com.cyberknights4911.robot2024.indexer.Indexer;
import com.cyberknights4911.robot2024.indexer.IndexerIO;
import com.cyberknights4911.robot2024.indexer.IndexerIOReal;
Expand Down Expand Up @@ -133,7 +133,7 @@ private void configureControls() {

binding.triggersFor(ButtonAction.AimPodium).onTrue(shooter.aimPodium());

binding.triggersFor(ButtonAction.FireNote).onTrue(shooter.fire());
binding.triggersFor(ButtonAction.FireNoteSpeaker).onTrue(shooter.fire());
}

private Command collectNote() {
Expand Down Expand Up @@ -244,22 +244,16 @@ private Drive createDrive() {
constants,
Robot2024Constants.DRIVE_CONSTANTS,
new GyroIOPigeon2(Robot2024Constants.DRIVE_CONSTANTS),
new ModuleIOSparkFlex(
new ModuleIOTalonFX(
Robot2024Constants.DRIVE_CONSTANTS, Robot2024Constants.DRIVE_CONSTANTS.frontLeft()),
new ModuleIOTalonFX(
Robot2024Constants.DRIVE_CONSTANTS,
Robot2024Constants.DRIVE_CONSTANTS.frontLeft(),
burnManager),
new ModuleIOSparkFlex(
Robot2024Constants.DRIVE_CONSTANTS.frontRight()),
new ModuleIOTalonFX(
Robot2024Constants.DRIVE_CONSTANTS, Robot2024Constants.DRIVE_CONSTANTS.backLeft()),
new ModuleIOTalonFX(
Robot2024Constants.DRIVE_CONSTANTS,
Robot2024Constants.DRIVE_CONSTANTS.frontRight(),
burnManager),
new ModuleIOSparkFlex(
Robot2024Constants.DRIVE_CONSTANTS,
Robot2024Constants.DRIVE_CONSTANTS.backLeft(),
burnManager),
new ModuleIOSparkFlex(
Robot2024Constants.DRIVE_CONSTANTS,
Robot2024Constants.DRIVE_CONSTANTS.backRight(),
burnManager));
Robot2024Constants.DRIVE_CONSTANTS.backRight()));
case REPLAY:
default:
return new Drive(
Expand Down Expand Up @@ -305,3 +299,9 @@ private Command rumbleQuickTwice() {

// TODO:
// ehehehehehehehehehhehehehehehehehheehehhehehehehehehehehehehheehhehehehehehehehehehhehehehehehehehehehehehehe
// TODO:
// hows it going?
// TODO:
// pretty good, how about you?
// TODO:
// I am doing alright, bit tired though, can't wait to get vision working
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ private Robot2024Constants() {}
.turnGearRatio(DriveConstants.TURN_GEAR_RATIO)
.driveGearRatio(DriveConstants.L2_GEAR_RATIO)
.pigeonId(0)
.canBusId("rio")
.turnFeedBackValues(new PidValues(7.0, 0.0, 0.0))
.driveFeedBackValues(new PidValues(0.05, 0.0, 0.0))
.driveFeedForwardValues(new FeedForwardValues(0.1, 0.13))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public Triggers triggersFor(ButtonAction action) {
// case ZeroSpeaker:
// return new Triggers(driver.start());
// case AmpLockOn:
// retaurn new Triggers(driver.leftTrigger());
// return new Triggers(driver.leftTrigger());
// case SpeakerLockOn:
// return new Triggers(driver.rightTrigger());
case CollectNote:
Expand All @@ -69,7 +69,7 @@ public Triggers triggersFor(ButtonAction action) {
return new Triggers(operator.povLeft());
case AimSubwoofer:
return new Triggers(operator.povRight());
case FireNote:
case FireNoteSpeaker:
return new Triggers(operator.rightTrigger());
default:
return new Triggers(ALWAYS_FALSE);
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/com/cyberknights4911/wham/Wham.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
import com.cyberknights4911.drive.GyroIOPigeon2;
import com.cyberknights4911.drive.ModuleIO;
import com.cyberknights4911.drive.ModuleIOSim;
import com.cyberknights4911.drive.ModuleIOTalonFX;
import com.cyberknights4911.entrypoint.RobotContainer;
import com.cyberknights4911.robot2024.Robot2024Constants;
import com.cyberknights4911.util.Alliance;
import com.cyberknights4911.util.GameAlerts;
import com.cyberknights4911.vision.simple.VisionSimple;
import com.cyberknights4911.wham.drive.ModuleIOTalonFX;
import com.cyberknights4911.wham.slurpp.Slurpp;
import com.cyberknights4911.wham.slurpp.SlurppIO;
import com.cyberknights4911.wham.slurpp.SlurppIOReal;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/cyberknights4911/wham/WhamConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private WhamConstants() {}
.turnGearRatio(DriveConstants.TURN_GEAR_RATIO)
.driveGearRatio(DriveConstants.L1_GEAR_RATIO)
.pigeonId(0)
.canBusId("rio")
.turnFeedBackValues(new PidValues(7.0, 0.0, 0.0))
.driveFeedBackValues(new PidValues(0.05, 0.0, 0.0))
.driveFeedForwardValues(new FeedForwardValues(0.1, 0.13))
Expand Down

0 comments on commit ec3af85

Please sign in to comment.