Skip to content

Commit b742e73

Browse files
authored
Create motors and IDs for the subsystems🦟™️ (#1)
* added IDs for all motors and pivots * added all motors and IDs for them
1 parent 40258b9 commit b742e73

File tree

4 files changed

+144
-28
lines changed

4 files changed

+144
-28
lines changed

src/main/java/frc/robot/RobotMap.java

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,55 @@
33
// Contains all ports on our robot
44

55
public class RobotMap {
6-
public static class mapControllers {
7-
public static final int DRIVER_USB = 0;
8-
}
9-
10-
public static class mapDrivetrain {
11-
public static final String CAN_BUS_NAME = "Swerve";
12-
public static final int PIGEON_CAN = 0;
13-
14-
// Module 0
15-
public static final int FRONT_LEFT_DRIVE_CAN = 0;
16-
public static final int FRONT_LEFT_STEER_CAN = 1;
17-
public static final int FRONT_LEFT_ABSOLUTE_ENCODER_CAN = 0;
18-
19-
// Module 1
20-
public static final int FRONT_RIGHT_DRIVE_CAN = 2;
21-
public static final int FRONT_RIGHT_STEER_CAN = 3;
22-
public static final int FRONT_RIGHT_ABSOLUTE_ENCODER_CAN = 1;
23-
24-
// Module 2
25-
public static final int BACK_LEFT_DRIVE_CAN = 4;
26-
public static final int BACK_LEFT_STEER_CAN = 5;
27-
public static final int BACK_LEFT_ABSOLUTE_ENCODER_CAN = 2;
28-
29-
// Module 3
30-
public static final int BACK_RIGHT_DRIVE_CAN = 6;
31-
public static final int BACK_RIGHT_STEER_CAN = 7;
32-
public static final int BACK_RIGHT_ABSOLUTE_ENCODER_CAN = 3;
33-
}
6+
public static class mapControllers {
7+
public static final int DRIVER_USB = 0;
8+
}
9+
10+
public static class mapDrivetrain {
11+
public static final String CAN_BUS_NAME = "Swerve";
12+
public static final int PIGEON_CAN = 0;
13+
14+
// Module 0
15+
public static final int FRONT_LEFT_DRIVE_CAN = 0;
16+
public static final int FRONT_LEFT_STEER_CAN = 1;
17+
public static final int FRONT_LEFT_ABSOLUTE_ENCODER_CAN = 0;
18+
19+
// Module 1
20+
public static final int FRONT_RIGHT_DRIVE_CAN = 2;
21+
public static final int FRONT_RIGHT_STEER_CAN = 3;
22+
public static final int FRONT_RIGHT_ABSOLUTE_ENCODER_CAN = 1;
23+
24+
// Module 2
25+
public static final int BACK_LEFT_DRIVE_CAN = 4;
26+
public static final int BACK_LEFT_STEER_CAN = 5;
27+
public static final int BACK_LEFT_ABSOLUTE_ENCODER_CAN = 2;
28+
29+
// Module 3
30+
public static final int BACK_RIGHT_DRIVE_CAN = 6;
31+
public static final int BACK_RIGHT_STEER_CAN = 7;
32+
public static final int BACK_RIGHT_ABSOLUTE_ENCODER_CAN = 3;
33+
}
34+
35+
// Intake ID 11-20
36+
public static class mapIntake {
37+
// coral intake motors and pivot
38+
public static final int INTAKE_PIVOT_CAN = 11;
39+
public static final int CORAL_LEFT_CAN = 12;
40+
public static final int CORAL_RIGHT_CAN = 13;
41+
// Algae intake motor
42+
public static final int INTAKE_ALGAE_CAN = 14;
43+
}
44+
45+
// Elevator ID 21-30
46+
public static class mapElevator {
47+
public static final int ELEVATOR_LEFT_CAN = 21;
48+
public static final int ELEVATOR_RIGHT_CAN = 22;
49+
public static final int ELEVATOR_RIGHT_PIVOT_CAN = 23;
50+
public static final int ELEVATOR_LEFT_PIVOT_CAN = 24;
51+
}
52+
53+
// Climber ID 31-40
54+
public static class mapClimber {
55+
public static final int CLIMBER_LEFT_CAN = 31;
56+
}
3457
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.subsystems;
6+
7+
import com.ctre.phoenix6.hardware.TalonFX;
8+
9+
import edu.wpi.first.wpilibj2.command.SubsystemBase;
10+
import frc.robot.RobotMap.mapClimber;
11+
12+
public class Climber extends SubsystemBase {
13+
TalonFX climberLeftMotor;
14+
15+
/** Creates a new Climber. */
16+
public Climber() {
17+
climberLeftMotor = new TalonFX(mapClimber.CLIMBER_LEFT_CAN); // Climber left motor, using CAN ID 31 as per RobotMap
18+
// Set default motor configurations if needed
19+
// e.g., climberLeftMotor.configFactoryDefault();
20+
}
21+
22+
@Override
23+
public void periodic() {
24+
// This method will be called once per scheduler run
25+
}
26+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.subsystems;
6+
7+
import com.ctre.phoenix6.hardware.TalonFX;
8+
9+
import edu.wpi.first.wpilibj2.command.SubsystemBase;
10+
import frc.robot.RobotMap.mapElevator;
11+
12+
public class Elevator extends SubsystemBase {
13+
TalonFX elevatorLeftMotor;
14+
TalonFX elevatorRightMotor;
15+
TalonFX elevatorLeftPivotMotor;
16+
TalonFX elevatorRightPivotMotor;
17+
18+
/** Creates a new Elevator. */
19+
public Elevator() {
20+
21+
elevatorLeftMotor = new TalonFX(mapElevator.ELEVATOR_LEFT_CAN); // Elevator left motor
22+
elevatorRightMotor = new TalonFX(mapElevator.ELEVATOR_RIGHT_CAN); // Elevator right motor
23+
elevatorLeftPivotMotor = new TalonFX(mapElevator.ELEVATOR_LEFT_PIVOT_CAN); // Elevator left pivot motor
24+
elevatorRightPivotMotor = new TalonFX(mapElevator.ELEVATOR_RIGHT_PIVOT_CAN); // Elevator right pivot motor
25+
26+
// Set default motor configurations if needed
27+
// e.g., elevatorLeftMotor.configFactoryDefault();
28+
}
29+
30+
@Override
31+
public void periodic() {
32+
// This method will be called once per scheduler run
33+
}
34+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.subsystems;
6+
7+
import com.ctre.phoenix6.hardware.TalonFX;
8+
9+
import edu.wpi.first.wpilibj2.command.SubsystemBase;
10+
import frc.robot.RobotMap.mapIntake;
11+
12+
public class Intake extends SubsystemBase {
13+
TalonFX intakePivotMotor;
14+
TalonFX coralLeftMotor;
15+
TalonFX coralRightMotor;
16+
TalonFX algaeIntakeMotor;
17+
18+
/** Creates a new Intake. */
19+
public Intake() {
20+
intakePivotMotor = new TalonFX(mapIntake.INTAKE_PIVOT_CAN); // Intake pivot motor
21+
coralLeftMotor = new TalonFX(mapIntake.CORAL_LEFT_CAN); // Coral left intake motor
22+
coralRightMotor = new TalonFX(mapIntake.CORAL_RIGHT_CAN); // Coral right intake motor
23+
algaeIntakeMotor = new TalonFX(mapIntake.INTAKE_ALGAE_CAN); // Algae intake motor
24+
25+
// Set default motor configurations if needed
26+
// e.g., intakePivotMotor.configFactoryDefault();
27+
}
28+
29+
@Override
30+
public void periodic() {
31+
// This method will be called once per scheduler run
32+
}
33+
}

0 commit comments

Comments
 (0)