From 92262914d9ddebc9d6f97608c77c26480cedf42d Mon Sep 17 00:00:00 2001 From: BrodyKarr <145169276+BrodyKarr@users.noreply.github.com> Date: Sun, 20 Jul 2025 12:33:13 -0700 Subject: [PATCH 1/2] added IDs for all motors and pivots --- src/main/java/frc/robot/RobotMap.java | 79 ++++++++++++------- .../java/frc/robot/subsystems/Intake.java | 33 ++++++++ 2 files changed, 84 insertions(+), 28 deletions(-) create mode 100644 src/main/java/frc/robot/subsystems/Intake.java diff --git a/src/main/java/frc/robot/RobotMap.java b/src/main/java/frc/robot/RobotMap.java index 9056a8f9..c48caa72 100644 --- a/src/main/java/frc/robot/RobotMap.java +++ b/src/main/java/frc/robot/RobotMap.java @@ -3,32 +3,55 @@ // Contains all ports on our robot public class RobotMap { - public static class mapControllers { - public static final int DRIVER_USB = 0; - } - - public static class mapDrivetrain { - public static final String CAN_BUS_NAME = "Swerve"; - public static final int PIGEON_CAN = 0; - - // Module 0 - public static final int FRONT_LEFT_DRIVE_CAN = 0; - public static final int FRONT_LEFT_STEER_CAN = 1; - public static final int FRONT_LEFT_ABSOLUTE_ENCODER_CAN = 0; - - // Module 1 - public static final int FRONT_RIGHT_DRIVE_CAN = 2; - public static final int FRONT_RIGHT_STEER_CAN = 3; - public static final int FRONT_RIGHT_ABSOLUTE_ENCODER_CAN = 1; - - // Module 2 - public static final int BACK_LEFT_DRIVE_CAN = 4; - public static final int BACK_LEFT_STEER_CAN = 5; - public static final int BACK_LEFT_ABSOLUTE_ENCODER_CAN = 2; - - // Module 3 - public static final int BACK_RIGHT_DRIVE_CAN = 6; - public static final int BACK_RIGHT_STEER_CAN = 7; - public static final int BACK_RIGHT_ABSOLUTE_ENCODER_CAN = 3; - } + public static class mapControllers { + public static final int DRIVER_USB = 0; + } + + public static class mapDrivetrain { + public static final String CAN_BUS_NAME = "Swerve"; + public static final int PIGEON_CAN = 0; + + // Module 0 + public static final int FRONT_LEFT_DRIVE_CAN = 0; + public static final int FRONT_LEFT_STEER_CAN = 1; + public static final int FRONT_LEFT_ABSOLUTE_ENCODER_CAN = 0; + + // Module 1 + public static final int FRONT_RIGHT_DRIVE_CAN = 2; + public static final int FRONT_RIGHT_STEER_CAN = 3; + public static final int FRONT_RIGHT_ABSOLUTE_ENCODER_CAN = 1; + + // Module 2 + public static final int BACK_LEFT_DRIVE_CAN = 4; + public static final int BACK_LEFT_STEER_CAN = 5; + public static final int BACK_LEFT_ABSOLUTE_ENCODER_CAN = 2; + + // Module 3 + public static final int BACK_RIGHT_DRIVE_CAN = 6; + public static final int BACK_RIGHT_STEER_CAN = 7; + public static final int BACK_RIGHT_ABSOLUTE_ENCODER_CAN = 3; + } + + // Intake ID 11-20 + public static class mapIntake { + // coral intake motors and pivot + public static final int INTAKE_PIVOT_CAN = 11; + public static final int CORAL_LEFT_CAN = 12; + public static final int CORAL_RIGHT_CAN = 13; + // Algae intake motor + public static final int INTAKE_ALGAE_CAN = 14; + } + + // Elevator ID 21-30 + public static class mapElevator { + public static final int ELEVATOR_LEFT_CAN = 21; + public static final int ELEVATOR_RIGHT_CAN = 22; + public static final int ELEVATOR_RIGHT_PIVOT_CAN = 23; + public static final int ELEVATOR_LEFT_PIVOT_CAN = 24; + } + + // Climber ID 31-40 + public static class mapClimber { + public static final int CLIMBER_LEFT_CAN = 31; + } } diff --git a/src/main/java/frc/robot/subsystems/Intake.java b/src/main/java/frc/robot/subsystems/Intake.java new file mode 100644 index 00000000..e58e222d --- /dev/null +++ b/src/main/java/frc/robot/subsystems/Intake.java @@ -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. + +package frc.robot.subsystems; + +import com.ctre.phoenix6.hardware.TalonFX; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.RobotMap.mapIntake; + +public class Intake extends SubsystemBase { + TalonFX intakePivotMotor; + TalonFX coralLeftMotor; + TalonFX coralRightMotor; + TalonFX algaeIntakeMotor; + + /** Creates a new Intake. */ + public Intake() { + intakePivotMotor = new TalonFX(mapIntake.INTAKE_PIVOT_CAN); // Intake pivot motor + coralLeftMotor = new TalonFX(mapIntake.CORAL_LEFT_CAN); // Coral left intake motor + coralRightMotor = new TalonFX(mapIntake.CORAL_RIGHT_CAN); // Coral right intake motor + algaeIntakeMotor = new TalonFX(mapIntake.INTAKE_ALGAE_CAN); // Algae intake motor + + // Set default motor configurations if needed + // e.g., intakePivotMotor.configFactoryDefault(); + } + + @Override + public void periodic() { + // This method will be called once per scheduler run + } +} From d6de1ea2260ad428ede09f020e00371760244aa8 Mon Sep 17 00:00:00 2001 From: BrodyKarr <145169276+BrodyKarr@users.noreply.github.com> Date: Sun, 20 Jul 2025 12:39:58 -0700 Subject: [PATCH 2/2] added all motors and IDs for them --- .../java/frc/robot/subsystems/Climber.java | 26 ++++++++++++++ .../java/frc/robot/subsystems/Elevator.java | 34 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/main/java/frc/robot/subsystems/Climber.java create mode 100644 src/main/java/frc/robot/subsystems/Elevator.java diff --git a/src/main/java/frc/robot/subsystems/Climber.java b/src/main/java/frc/robot/subsystems/Climber.java new file mode 100644 index 00000000..cde004ad --- /dev/null +++ b/src/main/java/frc/robot/subsystems/Climber.java @@ -0,0 +1,26 @@ +// 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. + +package frc.robot.subsystems; + +import com.ctre.phoenix6.hardware.TalonFX; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.RobotMap.mapClimber; + +public class Climber extends SubsystemBase { + TalonFX climberLeftMotor; + + /** Creates a new Climber. */ + public Climber() { + climberLeftMotor = new TalonFX(mapClimber.CLIMBER_LEFT_CAN); // Climber left motor, using CAN ID 31 as per RobotMap + // Set default motor configurations if needed + // e.g., climberLeftMotor.configFactoryDefault(); + } + + @Override + public void periodic() { + // This method will be called once per scheduler run + } +} diff --git a/src/main/java/frc/robot/subsystems/Elevator.java b/src/main/java/frc/robot/subsystems/Elevator.java new file mode 100644 index 00000000..20e6ef18 --- /dev/null +++ b/src/main/java/frc/robot/subsystems/Elevator.java @@ -0,0 +1,34 @@ +// 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. + +package frc.robot.subsystems; + +import com.ctre.phoenix6.hardware.TalonFX; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import frc.robot.RobotMap.mapElevator; + +public class Elevator extends SubsystemBase { + TalonFX elevatorLeftMotor; + TalonFX elevatorRightMotor; + TalonFX elevatorLeftPivotMotor; + TalonFX elevatorRightPivotMotor; + + /** Creates a new Elevator. */ + public Elevator() { + + elevatorLeftMotor = new TalonFX(mapElevator.ELEVATOR_LEFT_CAN); // Elevator left motor + elevatorRightMotor = new TalonFX(mapElevator.ELEVATOR_RIGHT_CAN); // Elevator right motor + elevatorLeftPivotMotor = new TalonFX(mapElevator.ELEVATOR_LEFT_PIVOT_CAN); // Elevator left pivot motor + elevatorRightPivotMotor = new TalonFX(mapElevator.ELEVATOR_RIGHT_PIVOT_CAN); // Elevator right pivot motor + + // Set default motor configurations if needed + // e.g., elevatorLeftMotor.configFactoryDefault(); + } + + @Override + public void periodic() { + // This method will be called once per scheduler run + } +}