41 lines
1.2 KiB
Java
Raw Normal View History

2023-02-06 19:02:17 -05:00
// 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.
2023-02-06 19:13:18 -05:00
package frc.robot.subsystems.bras;
2023-02-06 19:02:17 -05:00
2023-02-15 18:54:35 -05:00
import edu.wpi.first.wpilibj.DigitalInput;
2023-02-20 18:23:28 -05:00
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
2023-02-22 18:50:04 -05:00
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
2023-02-06 19:02:17 -05:00
import edu.wpi.first.wpilibj2.command.SubsystemBase;
2023-02-15 18:54:35 -05:00
import frc.robot.Constants;
2023-02-08 18:53:26 -05:00
import com.revrobotics.CANSparkMax;
2023-02-15 18:54:35 -05:00
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
2023-02-06 19:02:17 -05:00
public class Pivot extends SubsystemBase {
2023-02-22 18:50:04 -05:00
ShuffleboardTab teb = Shuffleboard.getTab("teb");
2023-02-08 18:53:26 -05:00
// moteur
2023-02-15 18:54:35 -05:00
private CANSparkMax pivot = new CANSparkMax(Constants.pivot,MotorType.kBrushless);
private DigitalInput limitpivot = new DigitalInput(Constants.limitpivot);
2023-02-06 19:02:17 -05:00
2023-02-08 18:53:26 -05:00
// function
2023-02-08 18:59:45 -05:00
public void monteDescendre(double vitesse) {
2023-02-08 18:53:26 -05:00
pivot.set (vitesse);
}
// encoder
public double distance(){
return (pivot.getEncoder().getPosition());
}
public void Reset(){
pivot.getEncoder().setPosition(0);
2023-02-15 18:54:35 -05:00
}
public boolean limitpivot(){
return limitpivot.get();
2023-02-08 18:53:26 -05:00
}
2023-02-06 19:02:17 -05:00
@Override
public void periodic() {
2023-02-22 18:50:04 -05:00
teb .add("encodeur", 0.1);
2023-02-06 19:02:17 -05:00
}
2023-02-22 18:53:57 -05:00
}