2020-01-18 08:29:34 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) 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.subsystems;
|
|
|
|
|
|
2020-01-18 10:30:22 -08:00
|
|
|
import com.ctre.phoenix.motorcontrol.InvertType;
|
|
|
|
|
import com.ctre.phoenix.motorcontrol.NeutralMode;
|
2020-01-18 08:29:34 -08:00
|
|
|
import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX;
|
|
|
|
|
|
|
|
|
|
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
2020-01-18 10:30:22 -08:00
|
|
|
import frc4388.robot.Constants.ElevatorConstants;
|
2020-01-18 08:29:34 -08:00
|
|
|
|
|
|
|
|
public class Elevator extends SubsystemBase {
|
2020-01-18 10:30:22 -08:00
|
|
|
|
|
|
|
|
public WPI_TalonSRX m_talon1 = new WPI_TalonSRX(ElevatorConstants.TALON_1);
|
|
|
|
|
public WPI_TalonSRX m_talon2 = new WPI_TalonSRX(ElevatorConstants.TALON_2);
|
2020-01-18 08:29:34 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a new Elevator.
|
|
|
|
|
*/
|
|
|
|
|
public Elevator() {
|
2020-01-18 10:30:22 -08:00
|
|
|
m_talon1.configFactoryDefault();
|
|
|
|
|
m_talon2.configFactoryDefault();
|
|
|
|
|
|
|
|
|
|
m_talon2.follow(m_talon1);
|
2020-01-18 08:29:34 -08:00
|
|
|
|
2020-01-18 10:30:22 -08:00
|
|
|
m_talon1.setNeutralMode(NeutralMode.Brake);
|
|
|
|
|
m_talon2.setNeutralMode(NeutralMode.Brake);
|
|
|
|
|
|
|
|
|
|
m_talon1.setInverted(false);
|
|
|
|
|
m_talon2.setInverted(false);
|
|
|
|
|
m_talon1.setInverted(InvertType.FollowMaster);
|
|
|
|
|
m_talon2.setInverted(InvertType.FollowMaster);
|
2020-01-18 08:29:34 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void periodic() {
|
|
|
|
|
// This method will be called once per scheduler run
|
|
|
|
|
}
|
2020-01-18 10:30:22 -08:00
|
|
|
public void moveElevator(double speed) {
|
|
|
|
|
m_talon1.set(speed);
|
|
|
|
|
m_talon2.set(speed);
|
|
|
|
|
}
|
2020-01-18 08:29:34 -08:00
|
|
|
}
|