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 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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ area_min:0.0017850625000000004
area_similarity:0
aspect_max:20.000000
aspect_min:0.000000
black_level:0
black_level:11
blue_balance:1975
botfloorsnap:0
botlength:0.7112
Expand All @@ -28,20 +28,23 @@ cross_b_y:0
desc:Pipeline_Name
desired_contour_region:0
detector_conf:0.800000
detector_idfilters:
dilation_steps:0
direction_filter:0
dual_close_sort_origin:0
erosion_steps:0
exposure:100
exposure:126
fiducial_decoder_strictness:strict
fiducial_denoise:0.000000
fiducial_idfilters:
fiducial_locfilters:
fiducial_qualitythreshold:0.000000
fiducial_resdiv:4
fiducial_size:152.4
fiducial_skip3d:1
fiducial_type:aprilClassic16h5
fiducial_vis_mode:3dtargposebotspace
flicker_correction:0
force_convex:1
hue_max:85
hue_min:60
Expand All @@ -50,7 +53,7 @@ image_source:0
img_to_show:0
intersection_filter:0
invert_hue:0
lcgain:20
lcgain:15.2
multigroup_max:7
multigroup_min:1
multigroup_rejector:0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ area_min:0
area_similarity:0
aspect_max:20
aspect_min:0
black_level:4
black_level:5
blue_balance:1800
botfloorsnap:0
botlength:0.7112
Expand All @@ -13,8 +13,8 @@ calibration_type:0
classifier_conf:0.100000
contour_grouping:0
contour_sort_final:0
convexity_max:100
convexity_min:1
convexity_max:98.8
convexity_min:0.3
corner_approx:5.000000
crop_x_max:0.55
crop_x_min:-0.55
Expand All @@ -34,7 +34,7 @@ dilation_steps:1
direction_filter:0
dual_close_sort_origin:0
erosion_steps:1
exposure:5
exposure:24
fiducial_decoder_strictness:strict
fiducial_denoise:0.000000
fiducial_idfilters:
Expand All @@ -51,10 +51,10 @@ hue_max:110
hue_min:42
image_flip:0
image_source:0
img_to_show:0
img_to_show:1
intersection_filter:0
invert_hue:0
lcgain:1
lcgain:1.2
multigroup_max:7
multigroup_min:1
multigroup_rejector:0
Expand Down
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