package frc.robot.commands.gpm;
+import edu.wpi.first.math.MathUtil;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.controls.BaseDriverConfig;
-import frc.robot.subsystems.drivetrain.Drivetrain;
import frc.robot.subsystems.turret.Turret;
public class TurretJoyStickAim extends Command{
}
Rotation2d rotation2d = new Rotation2d(driver.getRawSideTranslation(), driver.getRawForwardTranslation());
- double angle = Units.radiansToDegrees(rotation2d.getDegrees());
+ double angle = Units.radiansToDegrees(MathUtil.angleModulus(rotation2d.getDegrees()));
@Override
public void execute() {
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.Robot;
import frc.robot.commands.gpm.TurretAutoShoot;
+import frc.robot.commands.gpm.TurretJoyStickAim;
import frc.robot.constants.Constants;
import frc.robot.constants.FieldConstants;
import frc.robot.subsystems.drivetrain.Drivetrain;
private Pose2d alignmentPose = null;
private Command turretAutoShoot;
+ private TurretJoyStickAim turretJoyStickAim;
public PS5ControllerDriverConfig(Drivetrain drive, Shooter shooter, Turret turret) {
super(drive);
}
})
);
+
+ driver.get(PS5Button.CROSS).onTrue(
+ new InstantCommand(()->{
+ turretAutoShoot = new TurretAutoShoot(turret, getDrivetrain());
+ CommandScheduler.getInstance().schedule(turretAutoShoot);
+ })
+ ).onFalse(
+ new InstantCommand(()->{
+ turretAutoShoot.cancel();
+ })
+ );
}
public void setAlignmentPose(){