Skip to content
Merged

5 5 #106

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
4 changes: 2 additions & 2 deletions include/autonomous/positive.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Positive {
return new Sequence({
drivetrainSubsystem->setNorm(startPose.head<2>(), Eigen::Matrix2f::Identity() * 0.05, startPose.z(), flip),
new Ramsete(drivetrainSubsystem, flip ? &p_4_1_blue : &p_4_1_red),
(new Rotate(drivetrainSubsystem, 190_deg, flip))->withTimeout(700_ms),
(new Rotate(drivetrainSubsystem, 195_deg, flip))->withTimeout(700_ms),
new Ramsete(drivetrainSubsystem, flip ? &p_4_2_blue : &p_4_2_red),
SharedCommands::descoreCornerFull(),
new ScheduleCommand(intakeWithEject),
Expand All @@ -38,7 +38,7 @@ class Positive {
new ScheduleCommand(liftSubsystem->positionCommand(180_deg, 0.0)),
SharedCommands::driveToAlliance(),
new Ramsete(drivetrainSubsystem, flip ? &p_4_1_blue : &p_4_1_red),
(new Rotate(drivetrainSubsystem, 190_deg, flip))->withTimeout(700_ms),
(new Rotate(drivetrainSubsystem, 195_deg, flip))->withTimeout(700_ms),
new Ramsete(drivetrainSubsystem, flip ? &p_4_2_blue : &p_4_2_red),
SharedCommands::descoreCornerFull(),
new ScheduleCommand(intakeWithEject),
Expand Down
10 changes: 5 additions & 5 deletions include/autonomous/sharedCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,27 @@ class SharedCommands {
*/
static Command *descoreCorner() {
return new Sequence(
{drivetrainSubsystem->pct(0.3, 0.3)->with(new ScheduleCommand(bottomOuttakeWithEject))->withTimeout(200_ms), drivetrainSubsystem->pct(1.0, 1.0)->with(new ScheduleCommand(bottomOuttakeWithEject))->withTimeout(150_ms),
{drivetrainSubsystem->pct(0.3, 0.3)->with(new ScheduleCommand(bottomOuttakeWithEject))->withTimeout(100_ms), drivetrainSubsystem->pct(1.0, 1.0)->with(new ScheduleCommand(bottomOuttakeWithEject))->withTimeout(150_ms),
oneRingOutOfCorner(), cycleCorner(), oneRingOutOfCorner(), cycleCorner(), oneRingOutOfCorner()});
}

static Command *descoreCornerFull() {
return new Sequence(
{drivetrainSubsystem->pct(0.3, 0.3)->with(new ScheduleCommand(bottomOuttakeWithEject))->withTimeout(200_ms), drivetrainSubsystem->pct(1.0, 1.0)->with(new ScheduleCommand(bottomOuttakeWithEject))->withTimeout(150_ms),
{drivetrainSubsystem->pct(0.3, 0.3)->with(new ScheduleCommand(bottomOuttakeWithEject))->withTimeout(100_ms), drivetrainSubsystem->pct(1.0, 1.0)->with(new ScheduleCommand(bottomOuttakeWithEject))->withTimeout(150_ms),
oneRingOutOfCorner(), cycleCorner(), oneRingOutOfCorner(), cycleCorner(), oneRingOutOfCorner(), cycleCorner(), oneRingOutOfCorner()});
}

static Command *cycleCorner() {
return new Sequence({
drivetrainSubsystem->pct(0.0, 0.0)->withTimeout(300_ms),
drivetrainSubsystem->pct(0.4, 0.4)->withTimeout(100_ms),
drivetrainSubsystem->pct(0.4, 0.4)->withTimeout(200_ms),
});
}

static Command *oneRingOutOfCorner() {
return new Sequence({
drivetrainSubsystem->pct(0.2, 0.2)->with(new ScheduleCommand(cornerClearIntakeSequence))->withTimeout(600_ms),
drivetrainSubsystem->pct(-0.2, -0.2)->with(new ScheduleCommand(bottomIntakeSubsystem->pctCommand(1.0)->with(TopIntakePositionCommand::fromClosePositionCommand(topIntakeSubsystem, 0.95, 0.0))))->withTimeout(400_ms),
drivetrainSubsystem->pct(0.3, 0.3)->with(new ScheduleCommand(cornerClearIntakeSequence))->withTimeout(600_ms),
drivetrainSubsystem->pct(-0.3, -0.3)->with(new ScheduleCommand(bottomIntakeSubsystem->pctCommand(1.0)->with(TopIntakePositionCommand::fromClosePositionCommand(topIntakeSubsystem, 0.95, 0.0))))->withTimeout(400_ms),
});
}
};
4 changes: 2 additions & 2 deletions include/autonomous/skills.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ class Skills {
new ScheduleCommand(liftSubsystem->positionCommand(CONFIG::WALL_STAKE_PRIME_HEIGHT, 0.0)->withTimeout(200_ms)->andThen(liftSubsystem->positionCommand(200_deg, 0.0))),
new TankMotionProfiling(drivetrainSubsystem, {50_in/second, 140_in/second/second}, -5.2_in, false, 0.0, 0.0, false),
new Ramsete(drivetrainSubsystem, &skills_3),
drivetrainSubsystem->pct(0.3, 0.3)->withTimeout(0.1_s),
drivetrainSubsystem->pct(0.35, 0.35)->withTimeout(0.1_s),
new ScheduleCommand(intakeNoEject),
drivetrainSubsystem->pct(0.2, 0.2)->race(
SharedCommands::scoreWallStakesWithoutTopIntake()->asProxy())->andThen(
new ScheduleCommand(liftSubsystem->positionCommand(155_deg, 0.0))),
drivetrainSubsystem->pct(-0.5, -0.5)->withTimeout(0.24_s),
drivetrainSubsystem->pct(-0.5, -0.5)->withTimeout(0.27_s),
new Ramsete(drivetrainSubsystem, &skills_4),
drivetrainSubsystem->pct(0.0, 0.5)->withTimeout(0.2_s),
new ScheduleCommand(hang),
Expand Down
28 changes: 12 additions & 16 deletions include/subsystems/subsystems.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ inline void initializeController() {

primary.getTrigger(DIGITAL_B)->onTrue(
liftSubsystem->positionCommand(10_deg)->withTimeout(1_s)->andThen(liftSubsystem->zero()));

primary.getTrigger(DIGITAL_A)->whileTrue((new WaitCommand(200_ms))
->andThen(new InstantCommand(
[]() {
auto newAlliance = OPPONENTS;
ALLIANCE = newAlliance;
},
{})));
}

inline void initializePathCommands() {
Expand All @@ -177,7 +185,7 @@ inline void initializePathCommands() {
PathCommands::registerCommand("liftZero", liftSubsystem->positionCommand(6_deg));
PathCommands::registerCommand("scoreAllianceStake", liftSubsystem->positionCommand(200_deg, 0.0));
PathCommands::registerCommand("outtakeBottom", bottomIntakeSubsystem->pctCommand(-1.0));
PathCommands::registerCommand("LBdrop", liftSubsystem->positionCommand(140_deg, 0.0));
PathCommands::registerCommand("LBdrop", liftSubsystem->positionCommand(100_deg, 0.0));
PathCommands::registerCommand("lbTouch", liftSubsystem->positionCommand(150_deg, 0.0));
}

Expand All @@ -203,11 +211,11 @@ inline void initializeCommands() {
intakeWithEject = topIntakeWithEject->with(bottomIntakeSubsystem->pctCommand(1.0));
bottomOuttakeWithEject = topIntakeWithEject->with(bottomIntakeSubsystem->pctCommand(-1.0));
cornerClearIntakeSequence =
topIntakeWithEject->with(bottomIntakeSubsystem->pctCommand(1.0)->withTimeout(10_ms)->andThen(
topIntakeWithEject->with(bottomIntakeSubsystem->pctCommand(1.0)->withTimeout(100_ms)->andThen(
bottomIntakeSubsystem->pctCommand(-1.0)->withTimeout(200_ms)->andThen(
bottomIntakeSubsystem->pctCommand(1.0)->withTimeout(390_ms))));
bottomIntakeSubsystem->pctCommand(1.0))));

if (topIntakeSubsystem->visionConnected()) {
if (topIntakeSubsystem->visionConnected() && AUTON != SKILLS) {
basicLoadLB = new Sequence({
new ParallelRaceGroup({
bottomIntakeSubsystem->pctCommand(1.0),
Expand All @@ -224,12 +232,6 @@ inline void initializeCommands() {
topIntakeSubsystem->pctCommand(1.0)->until([]() { return topIntakeSubsystem->stalled(300_ms); }),
liftSubsystem->positionCommand(CONFIG::WALL_STAKE_LOAD_HEIGHT, 0.0),
}),
// new ParallelRaceGroup({bottomIntakeSubsystem->pctCommand(1.0), topIntakeSubsystem->pctCommand(0.0),
// liftSubsystem->positionCommand(CONFIG::WALL_STAKE_LOAD_HEIGHT, 0.0),
// new WaitCommand(50_ms)}),
// new ParallelRaceGroup({bottomIntakeSubsystem->pctCommand(1.0), topIntakeSubsystem->pctCommand(1.0),
// liftSubsystem->positionCommand(CONFIG::WALL_STAKE_LOAD_HEIGHT, 0.0),
// new WaitCommand(80_ms)}),
new ParallelRaceGroup({bottomIntakeSubsystem->pctCommand(1.0), topIntakeSubsystem->pctCommand(0.0),
liftSubsystem->positionCommand(CONFIG::WALL_STAKE_PRIME_HEIGHT, 0.0),
new WaitCommand(150_ms)}),
Expand All @@ -246,12 +248,6 @@ inline void initializeCommands() {
topIntakeSubsystem->pctCommand(1.0)->until([]() { return topIntakeSubsystem->stalled(300_ms); }),
liftSubsystem->positionCommand(CONFIG::WALL_STAKE_LOAD_HEIGHT, 0.0),
}),
// new ParallelRaceGroup({bottomIntakeSubsystem->pctCommand(1.0), topIntakeSubsystem->pctCommand(0.0),
// liftSubsystem->positionCommand(CONFIG::WALL_STAKE_LOAD_HEIGHT, 0.0),
// new WaitCommand(50_ms)}),
// new ParallelRaceGroup({bottomIntakeSubsystem->pctCommand(1.0), topIntakeSubsystem->pctCommand(1.0),
// liftSubsystem->positionCommand(CONFIG::WALL_STAKE_LOAD_HEIGHT, 0.0),
// new WaitCommand(80_ms)}),
new ParallelRaceGroup({bottomIntakeSubsystem->pctCommand(1.0), topIntakeSubsystem->pctCommand(0.0),
liftSubsystem->positionCommand(CONFIG::WALL_STAKE_PRIME_HEIGHT, 0.0),
new WaitCommand(150_ms)}),
Expand Down
8 changes: 4 additions & 4 deletions static/p_4_2_red.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
"y": 1.097
},
{
"x": -1.126,
"y": 1.325
"x": -1.125,
"y": 1.339
},
{
"x": -1.447,
"y": 1.558
"x": -1.446,
"y": 1.572
}
],
"constraints": {
Expand Down
16 changes: 8 additions & 8 deletions static/p_4_3_blue.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@
"path": [
{
"x": -1.479,
"y": 1.463
"y": -1.463
},
{
"x": -1.343,
"y": 1.338
"y": -1.338
},
{
"x": -1.303,
"y": 1.187
"y": -1.187
},
{
"x": -1.359,
"y": 0.956
"y": -0.956
}
],
"constraints": {
Expand All @@ -34,19 +34,19 @@
"path": [
{
"x": -1.359,
"y": 0.956
"y": -0.956
},
{
"x": -1.303,
"y": 1.187
"y": -1.187
},
{
"x": -0.701,
"y": 0.861
"y": -0.861
},
{
"x": -0.261,
"y": 0.7
"y": -0.7
}
],
"constraints": {
Expand Down
20 changes: 10 additions & 10 deletions static/skills_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@
"y": -0.363
},
{
"x": 1.13,
"y": -0.368
"x": 1.118,
"y": -0.367
},
{
"x": 1.183,
Expand All @@ -142,14 +142,14 @@
},
{
"x": 1.194,
"y": 1.553
"y": 1.512
},
{
"x": 1.632,
"y": 1.42
"x": 1.689,
"y": 1.497
},
{
"x": 1.516,
"x": 1.539,
"y": 1.158
}
],
Expand All @@ -163,12 +163,12 @@
"stop_end": false,
"path": [
{
"x": 1.516,
"x": 1.539,
"y": 1.158
},
{
"x": 1.332,
"y": 0.735
"x": 1.352,
"y": 0.736
},
{
"x": 1.098,
Expand Down Expand Up @@ -199,7 +199,7 @@
"name": "intakeNoEject"
},
{
"t": 5.803,
"t": 5.838,
"name": "declamp"
},
{
Expand Down
42 changes: 21 additions & 21 deletions static/skills_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@
"y": -1.103
},
{
"x": 1.308,
"y": -1.134
"x": 1.302,
"y": -1.149
},
{
"x": 1.204,
"y": -1.137
"x": 1.198,
"y": -1.152
}
],
"constraints": {
"velocity": 0.551,
"velocity": 0.475,
"accel": 3.048
}
},
Expand All @@ -85,12 +85,12 @@
"stop_end": false,
"path": [
{
"x": 1.204,
"y": -1.137
"x": 1.198,
"y": -1.152
},
{
"x": 1.107,
"y": -1.14
"x": 1.101,
"y": -1.155
},
{
"x": 0.519,
Expand Down Expand Up @@ -197,12 +197,12 @@
"y": -1.42
},
{
"x": 0.077,
"y": -1.32
"x": 0.052,
"y": -1.317
},
{
"x": -0.035,
"y": -1.149
"x": -0.059,
"y": -1.146
}
],
"constraints": {
Expand All @@ -215,20 +215,20 @@
"stop_end": false,
"path": [
{
"x": -0.035,
"y": -1.149
"x": -0.059,
"y": -1.146
},
{
"x": 0.006,
"y": -1.212
"x": -0.018,
"y": -1.209
},
{
"x": 0.015,
"y": -1.291
"x": -0.007,
"y": -1.286
},
{
"x": 0.002,
"y": -1.565
"x": -0.019,
"y": -1.56
}
],
"constraints": {
Expand Down
Loading