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

Offseason auto fixes #65

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 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
49 changes: 49 additions & 0 deletions src/main/deploy/pathplanner/leaveCommunity.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

I don't know how the path looks like from this file, but make sure we qualify for leave community on both sides of the charging station

"waypoints": [
{
"anchorPoint": {
"x": 1.9,
"y": 0.47213538036098845
},
"prevControl": null,
"nextControl": {
"x": 3.276371047437692,
"y": 0.47213538036098845
},
"holonomicAngle": 0,
"isReversal": false,
"velOverride": null,
"isLocked": false,
"isStopPoint": false,
"stopEvent": {
"names": [],
"executionBehavior": "parallel",
"waitBehavior": "none",
"waitTime": 0
}
},
{
"anchorPoint": {
"x": 5.578080329092989,
"y": 0.4821808139856896
},
"prevControl": {
"x": 4.578080329092989,
"y": 0.4821808139856896
},
"nextControl": null,
"holonomicAngle": 0,
"isReversal": false,
"velOverride": null,
"isLocked": false,
"isStopPoint": false,
"stopEvent": {
"names": [],
"executionBehavior": "parallel",
"waitBehavior": "none",
"waitTime": 0
}
}
],
"markers": []
}
56 changes: 42 additions & 14 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,32 +209,40 @@ private void addToChooser(String pathName) {

private void initChooser() {
SmartDashboard.putData("autonomous", this.chooser);
// addToChooser("engage");
// addToChooser("1-gp-engage");
addToChooser("1-gp-leaveCommunity");
// addToChooser("bot-2-gp-engage");
this.chooser.addOption("2-gp", new ConditionalCommand(_autoFactory.createAuto("bot-2-gp-blue"),
_autoFactory.createAuto("bot-2-gp-red"), () -> DriverStation.getAlliance() == Alliance.Blue));
// addToChooser("bot-3-gp-engage");
// addToChooser("bot-3-gp");
addToChooser("rotate");

this.chooser.addOption("nothing", new InstantCommand());

this.chooser.addOption("cone-leaveCommunity",
getSideConeSequence()
.andThen(_autoFactory.createAuto("leaveCommunity").alongWith(
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.CLOSED))));

this.chooser.addOption("cone", getSideConeSequence().andThen(
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.CLOSED)));
// only cube
this.chooser.addOption("cube", getAutoCubeSequence());

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

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

// this.chooser.addOption("taxi", _autoFactory.createAuto("engage-gyro"));
// this.chooser.addOption("engage-gyro", getEngageSequence());
// cube taxi
this.chooser.addOption("cube-taxi", getAutoCubeSequence().andThen(_autoFactory.createAuto("engage-gyro")));
// this.chooser.addOption("cube-taxi",
// getAutoCubeSequence().andThen(_autoFactory.createAuto("engage-gyro")));
// addToChooser("engage");
// addToChooser("1-gp-engage");
// addToChooser("1-gp-leaveCommunity");
// addToChooser("bot-2-gp-engage");
// addToChooser("bot-2-gp");
// addToChooser("leaveCommunity");
// addToChooser("bot-3-gp-engage");
// addToChooser("bot-3-gp");
// addToChooser("rotate");

}

/**
Expand All @@ -258,6 +266,26 @@ public void updateTelemetry() {
m_drivetrain.updateTelemetry();
}

private CommandBase getSideConeSequence() {
return Commands.sequence(
new InstantCommand(() -> setConeInternalState()),
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.COLLECT),
new WaitCommand(0.5),
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.CLOSED),
new WaitCommand(0.5),
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.COLLECT),
new WaitCommand(0.5),
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.CLOSED),
new WaitCommand(0.5),
Commands.sequence(m_manipulator.setManipulatorStateCommand(ManipulatorState.OPEN),
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.READJUST),
new WaitCommand(0.5),
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.COLLECT, FunnelState.CLOSED),
m_manipulator.setManipulatorStateCommand(ManipulatorState.HOLD)),
m_ArmFunnelSuperStructure.getSetStateCommand(ArmState.MID_CONE, FunnelState.OPEN),
m_manipulator.setManipulatorStateCommand(ManipulatorState.OPEN));
}

private CommandBase getEngageSequence() {
return Commands.sequence(
_autoFactory.createAuto("engage-gyro"),
Expand Down