Skip to content

Commit

Permalink
Trying values, testing in teleop
Browse files Browse the repository at this point in the history
  • Loading branch information
JediScoy committed Mar 19, 2024
1 parent e028f27 commit dc9199d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 5 deletions.
19 changes: 15 additions & 4 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,25 @@ public static class ArmConstants {
public static final double ARM_HOME_POSE = 0;
public static final double ARM_LOW_POSE = 10;
public static final double ARM_MID_POSE = 20; // 30 // 20
/* @202 inches
* 30 was too steep at
* 40 was too flat
*/
public static final double ARM_HIGH_POSE = 55;
public static final double ARM_AMP_POSE = 90;
public static final double ARM_SAFETY_POSE = 20;
public static final int ARM_FWD_LIMIT = 100; // Previous event 91

/* Distances (inches) from front Bumper Speaker Base to front Bumper and arm in canon units
Pose 0 is at the base, Pose 1 is at the leg of the Stage, i.e. "Safety Pose"
| Pose | Dist | Arm |
|------ |----- | --- |
| 0 | 0 | 0 |
| 1 | 126 | 20 | Safety Pose
| 2 | 150 | 00 |
| 3 | 180 | 00 |
| 4 | 200 | 00 |
*/


public static final int ARM_MAX_ACCEL = 100;
public static final int ARM_MAX_VEL = 200;
public static final int ARM_JERK = 0;
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import frc.robot.commands.SetIndex;
import frc.robot.commands.SetWinch;
import frc.robot.commands.ShootClose;
import frc.robot.commands.ShootSafetyPose;
import frc.robot.generated.TunerConstants;
import frc.robot.subsystems.ArmSubsystem;
import frc.robot.subsystems.IndexSubsystem;
Expand Down Expand Up @@ -88,6 +89,8 @@ public class RobotContainer {
private final IntakeRevCommandGroup intakeRevGroup = new IntakeRevCommandGroup(index, intake);
// ChargeIntakeCommand chargeIntake = new ChargeIntakeCommand(drivetrain, intake, driveRequest);

private final ShootSafetyPose shootSafetyPose = new ShootSafetyPose(arm, index, intake, shooter);

/* Autonomous Chooser */
SendableChooser<Command> autoChooser;

Expand Down Expand Up @@ -163,7 +166,9 @@ private void configureBindings() {
m_driverController.a().whileTrue(new InstantCommand(() -> arm.setArmPose(Constants.ArmConstants.ARM_HOME_POSE)));
m_driverController.b().whileTrue(new InstantCommand(() -> arm.setArmPose(Constants.ArmConstants.ARM_MID_POSE)));
m_driverController.x().whileTrue(new InstantCommand(() -> arm.setArmPose(Constants.ArmConstants.ARM_AMP_POSE)));
m_driverController.y().whileTrue(new InstantCommand(() -> arm.setArmPose(Constants.ArmConstants.ARM_MID_POSE)));

// FIXME Using this for Testing
m_driverController.y().whileTrue(shootSafetyPose);

m_driverController.rightBumper().whileTrue(new IntakeCommandGroup(index, intake));
m_driverController.leftBumper().whileTrue(new IntakeRevCommandGroup(index, intake));
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/frc/robot/commands/ShootSafetyPose.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import frc.robot.Constants;
import frc.robot.subsystems.ArmSubsystem;
import frc.robot.subsystems.IndexSubsystem;
import frc.robot.subsystems.IntakeSubsystem;
import frc.robot.subsystems.ShooterSubsystemVelocity;

public class ShootSafetyPose extends SequentialCommandGroup {
public ShootSafetyPose(ArmSubsystem arm, IndexSubsystem index, IntakeSubsystem intake, ShooterSubsystemVelocity shooter) {

addCommands(
/* Moving the arm is shouldn't be necessary, but just in case */
new SetArmPosition(arm, Constants.ArmConstants.ARM_SAFETY_POSE),
// new ShooterIndex(shooter, index).withTimeout(1.0)
new RevAndShootCommand(index, shooter).withTimeout(1.25).andThen(new InstantCommand(() -> shooter.Disable(), shooter)),
new SetIndex(index, 0).withTimeout(.2)
);
}
}

0 comments on commit dc9199d

Please sign in to comment.