Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arm catapult check #64

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions networktables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file can be removed

42 changes: 37 additions & 5 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public RobotContainer() {
setCubeInternalState();

m_PDH.setSwitchableChannel(false);

SmartDashboard.putNumber("cataAngle", SmartDashboard.getNumber("cataAngle", 0));
Comment on lines +98 to +99
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use this value anywhere here

}

/**
Expand Down Expand Up @@ -153,7 +155,7 @@ private void configureBindings() {

// Go to collect state sequence
_operatorController.povDown().onTrue(
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.CLOSED)
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.CLOSED)
.andThen(m_manipulator.setManipulatorStateCommand(ManipulatorState.OPEN)));

_driverController.circle().whileTrue(
Expand All @@ -176,10 +178,23 @@ private void configureBindings() {
new WaitCommand(0.5),
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.CLOSED),
m_manipulator.setManipulatorStateCommand(ManipulatorState.HOLD)));

_operatorController.cross()
.onTrue(m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.REJECT, FunnelState.OPEN)
.andThen(this.getCollectSequence()));
// catapult
_operatorController.povLeft()
.onTrue(
m_ArmFunnelSuperStructure.generateSetStateCommand(ArmState.MID_CUBE, FunnelState.COLLECT)
.andThen(
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT,
FunnelState.CLOSED)));

// catapult collect
_operatorController.triangle()
.onTrue(
m_manipulator.setManipulatorStateCommand(ManipulatorState.HOLD).andThen(
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.OPEN)));
Comment on lines +189 to +193
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need atapult collect? Can't we collect normally and when we want to score call catapult collect followed by catapult


// close funnle without opening manipulator
_operatorController.povRight().onTrue(
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.CLOSED));
Comment on lines +181 to +197
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already use almost every button on the controller, more buttons mean more chances for error. Did we practice this?

Comment on lines +195 to +197
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this used in the sequence?


}

Expand Down Expand Up @@ -209,6 +224,8 @@ private void addToChooser(String pathName) {

private void initChooser() {
SmartDashboard.putData("autonomous", this.chooser);
this.chooser.addOption("catapult", getCatapultSequence()
.andThen(m_ArmFunnelSuperStructure.generateSetStateCommand(ArmState.COLLECT, FunnelState.CLOSED)));
// addToChooser("engage");
// addToChooser("1-gp-engage");
addToChooser("1-gp-leaveCommunity");
Expand All @@ -228,8 +245,13 @@ private void initChooser() {
this.chooser.addOption("cube-engage-gyro", getAutoCubeSequence().andThen(getEngageSequence()));
// only engage
this.chooser.addOption("engage-gyro", getEngageSequence());

this.chooser.addOption("cube-mobility-engage", getAutoCubeSequence().andThen(getMobilityEngageSequence()));

this.chooser.addOption("catapult-mobility-engage", getCatapultSequence().andThen(getMobilityEngageSequence()));

this.chooser.addOption("catapult-engage", getCatapultSequence().andThen(getEngageSequence()));

// taxi
this.chooser.addOption("taxi", _autoFactory.createAuto("engage-gyro"));

Expand Down Expand Up @@ -258,6 +280,16 @@ public void updateTelemetry() {
m_drivetrain.updateTelemetry();
}

private CommandBase getCatapultSequence() {
return Commands.sequence(
m_manipulator.setManipulatorStateCommand(ManipulatorState.HOLD),
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.COLLECT),
new WaitCommand(0.3),
m_ArmFunnelSuperStructure.generateSetStateCommand(ArmState.MID_CUBE, FunnelState.COLLECT)

);
}

private CommandBase getEngageSequence() {
return Commands.sequence(
_autoFactory.createAuto("engage-gyro"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,8 @@ public CommandBase overrideCommand() {
m_arm.getSetStateCommand(ArmState.MID_CONE, ArmTrapProfile.FAST),
m_funnel.setFunnelStateCommand(FunnelState.CLOSED));
}

public double getArmAngle() {
return m_arm.getAngle();
}
Comment on lines +103 to +106
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is not used anywhere here

}