2023-03-06 18:36:32 -07: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.
|
|
|
|
|
|
|
|
|
|
package frc4388.robot.commands;
|
|
|
|
|
|
2023-03-14 15:13:41 -06:00
|
|
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
2023-03-06 18:36:32 -07:00
|
|
|
import frc4388.robot.subsystems.Arm;
|
|
|
|
|
|
2023-03-14 11:05:38 -06:00
|
|
|
public class PivotCommand extends PelvicInflammatoryDisease {
|
2023-03-14 10:47:17 -06:00
|
|
|
private final Arm arm;
|
|
|
|
|
private final double target;
|
2023-03-06 18:36:32 -07:00
|
|
|
|
|
|
|
|
/** Creates a new ArmCommand. */
|
2023-03-14 11:05:38 -06:00
|
|
|
public PivotCommand(Arm arm, double target) {
|
2023-03-14 15:13:41 -06:00
|
|
|
super(6, 1.5, 0, 0, 0.015);
|
2023-03-14 10:47:17 -06:00
|
|
|
this.arm = arm;
|
|
|
|
|
this.target = target;
|
2023-03-14 11:05:38 -06:00
|
|
|
addRequirements(arm);
|
2023-03-06 18:36:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2023-03-14 10:47:17 -06:00
|
|
|
public double getError() {
|
2023-03-14 15:13:41 -06:00
|
|
|
return (target - arm.getArmRotation()) / 360;
|
2023-03-06 18:36:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2023-03-14 10:47:17 -06:00
|
|
|
public void runWithOutput(double output) {
|
2023-03-14 15:13:41 -06:00
|
|
|
SmartDashboard.putNumber("pivot output", output);
|
2023-03-14 10:47:17 -06:00
|
|
|
arm.setRotVel(output);
|
2023-03-06 18:36:32 -07:00
|
|
|
}
|
|
|
|
|
}
|