2022-04-25 16:47:06 -06:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
package frc4388.robot;
|
|
|
|
|
|
2022-04-26 14:55:02 -06:00
|
|
|
import static frc4388.robot.Constants.DriveConstants.*;
|
|
|
|
|
import static frc4388.robot.Constants.HornConstants.*;
|
|
|
|
|
import static frc4388.robot.Constants.ShooterConstants.*;
|
|
|
|
|
|
2022-04-25 16:47:06 -06:00
|
|
|
import com.ctre.phoenix.motorcontrol.NeutralMode;
|
2022-04-26 14:55:02 -06:00
|
|
|
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
2022-04-25 16:47:06 -06:00
|
|
|
|
2022-04-28 01:04:35 -06:00
|
|
|
import edu.wpi.first.util.sendable.SendableRegistry;
|
2022-04-26 14:55:02 -06:00
|
|
|
import edu.wpi.first.wpilibj.PneumaticsModuleType;
|
|
|
|
|
import edu.wpi.first.wpilibj.Solenoid;
|
2022-04-25 16:47:06 -06:00
|
|
|
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
|
|
|
|
|
|
|
|
|
/**
|
2022-04-28 01:04:35 -06:00
|
|
|
* Defines and holds all I/O objects on the roboRIO. This is useful for unit testing and
|
2022-04-26 14:55:02 -06:00
|
|
|
* modularization.
|
2022-04-25 16:47:06 -06:00
|
|
|
*/
|
|
|
|
|
public class RobotMap {
|
|
|
|
|
|
2022-04-26 14:55:02 -06:00
|
|
|
public RobotMap() {
|
|
|
|
|
configureDriveMotorControllers();
|
2022-04-28 01:04:35 -06:00
|
|
|
configureLiveWindow();
|
2022-04-26 14:55:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Drive Subsystem */
|
2022-07-04 22:02:13 -06:00
|
|
|
public final WPI_TalonSRX driveMotorLeftLeader = new WPI_TalonSRX(DRIVE_LEFT_LEADER_ID);
|
|
|
|
|
public final WPI_TalonSRX driveMotorRightLeader = new WPI_TalonSRX(DRIVE_RIGHT_LEADER_ID);
|
|
|
|
|
public final WPI_TalonSRX driveMotorLeftFollower = new WPI_TalonSRX(DRIVE_LEFT_FOLLOWER_ID);
|
|
|
|
|
public final WPI_TalonSRX driveMotorRightFollower = new WPI_TalonSRX(DRIVE_RIGHT_FOLLOWER_ID);
|
2022-04-28 01:04:35 -06:00
|
|
|
|
2022-07-04 22:02:13 -06:00
|
|
|
public final DifferentialDrive driveBase = new DifferentialDrive(driveMotorLeftLeader, driveMotorRightLeader);
|
2022-04-28 01:04:35 -06:00
|
|
|
|
|
|
|
|
private void configureDriveMotorControllers() {
|
2022-07-04 22:02:13 -06:00
|
|
|
driveMotorLeftLeader.configFactoryDefault();
|
|
|
|
|
driveMotorRightLeader.configFactoryDefault();
|
|
|
|
|
driveMotorLeftFollower.configFactoryDefault();
|
|
|
|
|
driveMotorRightFollower.configFactoryDefault();
|
|
|
|
|
|
|
|
|
|
driveMotorLeftLeader.setNeutralMode(NeutralMode.Brake);
|
|
|
|
|
driveMotorRightLeader.setNeutralMode(NeutralMode.Brake);
|
|
|
|
|
driveMotorLeftFollower.setNeutralMode(NeutralMode.Brake);
|
|
|
|
|
driveMotorRightFollower.setNeutralMode(NeutralMode.Brake);
|
|
|
|
|
|
|
|
|
|
driveMotorLeftFollower.follow(driveMotorLeftLeader);
|
|
|
|
|
driveMotorRightFollower.follow(driveMotorRightLeader);
|
2022-04-26 14:55:02 -06:00
|
|
|
}
|
|
|
|
|
|
2022-04-28 01:04:35 -06:00
|
|
|
/* Horn Subsystem */
|
2022-04-26 14:55:02 -06:00
|
|
|
public final Solenoid hornSolenoid = new Solenoid(PneumaticsModuleType.REVPH, HORN_SOLENOID_ID);
|
|
|
|
|
|
2022-04-28 01:04:35 -06:00
|
|
|
/* Shooter Subsystem */
|
2022-07-04 22:02:13 -06:00
|
|
|
public final Solenoid shooterSolenoidBottomLeftOuter = new Solenoid(PneumaticsModuleType.REVPH, SHOOTER_SOLENOID_BOTTOM_LEFT_OUTER_ID);
|
|
|
|
|
public final Solenoid shooterSolenoidBottomLeftInner = new Solenoid(PneumaticsModuleType.REVPH, SHOOTER_SOLENOID_BOTTOM_LEFT_INNER_ID);
|
|
|
|
|
public final Solenoid shooterSolenoidBottomRightInner = new Solenoid(PneumaticsModuleType.REVPH, SHOOTER_SOLENOID_BOTTOM_RIGHT_INNER_ID);
|
|
|
|
|
public final Solenoid shooterSolenoidBottomRightOuter = new Solenoid(PneumaticsModuleType.REVPH, SHOOTER_SOLENOID_BOTTOM_RIGHT_OUTER_ID);
|
|
|
|
|
public final Solenoid shooterSolenoidTopLeftOuter = new Solenoid(PneumaticsModuleType.REVPH, SHOOTER_SOLENOID_TOP_LEFT_OUTER_ID);
|
|
|
|
|
public final Solenoid shooterSolenoidTopLeftInner = new Solenoid(PneumaticsModuleType.REVPH, SHOOTER_SOLENOID_TOP_LEFT_INNER_ID);
|
|
|
|
|
public final Solenoid shooterSolenoidTopRightInner = new Solenoid(PneumaticsModuleType.REVPH, SHOOTER_SOLENOID_TOP_RIGHT_INNER_ID);
|
|
|
|
|
public final Solenoid shooterSolenoidTopRightOuter = new Solenoid(PneumaticsModuleType.REVPH, SHOOTER_SOLENOID_TOP_RIGHT_OUTER_ID);
|
2022-04-25 16:47:06 -06:00
|
|
|
|
2022-04-28 01:04:35 -06:00
|
|
|
|
|
|
|
|
private void configureLiveWindow() {
|
2022-07-04 22:02:13 -06:00
|
|
|
SendableRegistry.setName(driveMotorLeftFollower, "Drive", "Motor Left Follower");
|
|
|
|
|
SendableRegistry.setName(driveMotorRightFollower, "Drive", "Motor Right Follower");
|
|
|
|
|
SendableRegistry.setName(driveBase, "Drive", "Base");
|
2022-04-28 01:04:35 -06:00
|
|
|
|
|
|
|
|
SendableRegistry.setName(hornSolenoid, "Horn", "Solenoid");
|
|
|
|
|
|
2022-07-04 22:02:13 -06:00
|
|
|
SendableRegistry.setName(shooterSolenoidBottomLeftOuter, "Shooter", "Solenoid Bottom Left Outer");
|
|
|
|
|
SendableRegistry.setName(shooterSolenoidBottomLeftInner, "Shooter", "Solenoid Bottom Left Inner");
|
|
|
|
|
SendableRegistry.setName(shooterSolenoidBottomRightInner, "Shooter", "Solenoid Bottom Right Inner");
|
|
|
|
|
SendableRegistry.setName(shooterSolenoidBottomRightOuter, "Shooter", "Solenoid Bottom Right Outer");
|
|
|
|
|
SendableRegistry.setName(shooterSolenoidTopLeftOuter, "Shooter", "Solenoid Top Left Outer");
|
|
|
|
|
SendableRegistry.setName(shooterSolenoidTopLeftInner, "Shooter", "Solenoid Top Left Inner");
|
|
|
|
|
SendableRegistry.setName(shooterSolenoidTopRightInner, "Shooter", "Solenoid Top Right Inner");
|
|
|
|
|
SendableRegistry.setName(shooterSolenoidTopRightOuter, "Shooter", "Solenoid Top Right Outer");
|
2022-04-28 01:04:35 -06:00
|
|
|
}
|
2022-04-25 16:47:06 -06:00
|
|
|
}
|