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

New Button Mapping for pilot and operator #50

Merged
merged 19 commits into from
Feb 14, 2025
Merged

New Button Mapping for pilot and operator #50

merged 19 commits into from
Feb 14, 2025

Conversation

JosephBye
Copy link
Contributor

No description provided.

@JosephBye JosephBye requested a review from cycIes February 12, 2025 00:58
public final Trigger score_RB = rightBumper.and(noFn, teleop);
public final Trigger climbPrep_RDP = rightDpad.and(noFn, teleop);
public final Trigger stationIntake_LT = A.and(noFn, teleop);
public final Trigger stationExtendedIntake_LT = A.and(fn, teleop);
Copy link
Contributor

Choose a reason for hiding this comment

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

should probably be named with _LB_LT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@cycIes
Copy link
Contributor

cycIes commented Feb 12, 2025

Do you want to add the states for ground intaking with the corAl? Also I think the original plan was to keep the coral intaking on the left side and the algae intaking on the right side, but I assume you changed that to accommodate the station extended intaking. What are your thoughts?

coralIntake.setDefaultCommand(
log(coralIntake.runStop().ignoringDisable(true).withName("intake.default")));
log(coralIntake.runVelocityTcFocRpm(() -> -500).withName("intake.default")));
Copy link
Contributor

Choose a reason for hiding this comment

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

minor change if you want: intake should be coralIntake

Copy link
Contributor

@cycIes cycIes Feb 12, 2025

Choose a reason for hiding this comment

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

From what I know about intaking on the corAl, I think moving the motor one way intakes coral and ejects algae, while moving the motor the other way ejects coral and intakes algae, so this may have to be an adaptable value (otherwise it wouldn't hold one of the game pieces)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm probably gonna make coralIntake and Coraleject different from algaeIntake and algaeEject as like different command, I think that's the easiest way to fix this?

Copy link
Contributor

Choose a reason for hiding this comment

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

But what about the default command? It would have to know whether to run a positive or negative velocity depending on what it's holding


coastMode.whileTrue(log(coastMode()));
coastMode.onFalse(log(ensureBrakeMode()));
}

private static Command handOffAlgae() {
private static Command handOff() {
Copy link
Contributor

Choose a reason for hiding this comment

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

For the reason I stated above, you may have to make two handOff and two score commands for coralIntake

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

scoreState.and(L3Coral).and(backwardMode).onTrue(log(score3()));
scoreState.and(L4Coral).and(backwardMode.not()).onTrue(log(score4()));
scoreState.and(L4Coral).and(backwardMode).onTrue(log(score4()));

L2Algae.and(backwardMode.not()).whileTrue(log(l2Algae()));
Copy link
Contributor

Choose a reason for hiding this comment

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

do you have to also implement action ready stuff with retrieving algae?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, the idea for retrieving algae, atleast based on my understanding, is that we're going to be doing it as basically a pilot intake command, so pilot presses a button, and then drives in, so there's no need for a operator to control sm

Copy link
Contributor

@cycIes cycIes Feb 13, 2025

Choose a reason for hiding this comment

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

But wouldn't the arm be moving and the robot be aligning for this? Would the operator have to stage the arm for the reef algae before the pilot drives in?

}

public static DoubleSupplier getPosition() {
return () -> elbow.getPositionPercentage();
}

public static DoubleSupplier switchSigns(DoubleSupplier supplier) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you still need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, deleted, ty

@@ -87,10 +126,6 @@ public static Command l4Coral() {
.withName("Elbow.l4Coral");
}

public static Command barge() {
return elbow.moveToPercentage(() -> elbow.checkReversed(config::getBarge))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I actually need this for the position reversing. Sorry for not catching this earlier!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The barge command? I'll add it back

Copy link
Contributor

Choose a reason for hiding this comment

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

Just the check reversed part. Ty!

@@ -83,6 +96,15 @@ private static Command fullExtend() {
return elevator.moveToRotations(config::getFullExtend).withName("Elevator.fullExtend");
}

private static Command score() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not entirely sure if this could happen, but if the pilot accidentally presses the actionready button and then releases it while the elevator is at zero, would that cause issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really, I've tested it and it kinda just spins the coralIntake, nothing too bad happens, and if the operator presses home again everything goes back to being fine

@@ -15,18 +14,20 @@ public class InClimbStates {

public static void setupDefaultCommand() {
inClimb.setDefaultCommand(
log(inClimb.runHoldInClimb().ignoringDisable(true).withName("InClimb.default")));
log(InClimbStates.home().ignoringDisable(true).withName("InClimb.default")));
Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking, if the operator tries to prep for climbing and lets go of the button, the default would send the climber home, so the operator needs to hold prep climb at all times? That might make it weird for the transition to finishing the climb on pilot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I orginally changed it to auto go back home, so that after the intake of the coral or the algae it automatically folds back on itself, or in emergencies if the operator is caught in the open or smth, they can just let go of the button to bring back inclimb instead of trying to press smth else
On the other hand good point, I'll change it so that default command is changed when you press prepclimb

Copy link
Contributor

@cycIes cycIes Feb 13, 2025

Choose a reason for hiding this comment

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

You can just have an onFalse for the intaking commands so that the inClimb goes back after the button is released

public final Trigger eject_fA = A.and(fn, teleop);
public final Trigger score_RB = rightBumper.and(noFn, teleop);
public final Trigger climbPrep_RDP = rightDpad.and(noFn, teleop);
public final Trigger stationIntake_LT = A.and(noFn, teleop);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to keep this as A for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nah, I'll change it back, testing seems fine.

@@ -35,9 +46,10 @@ public static void setStates() {
L3Coral.and(backwardMode).whileTrue(log(reverse(l3Coral())));
L4Coral.and(backwardMode.not()).whileTrue(log(l4Coral()));
L4Coral.and(backwardMode).whileTrue(log(reverse(l4Coral())));
barge.and(backwardMode.not()).whileTrue(log(barge()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why was barge removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

barge wasn't removed, just shifted to another place in the setup commands, right below the other algae things

score.whileTrue(log(intake()));
handOffAlgae.whileTrue(log(handOffAlgae()));
stationExtendedIntake.whileTrue(log(intake()));
scoreState.whileTrue(log(score()));
Copy link
Contributor

@cycIes cycIes Feb 12, 2025

Choose a reason for hiding this comment

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

I think this will try to score as long as the action button isn't being pressed? That means that the default will never run and might cause issues when scheduling other commands that require coralIntake? (But I haven't tested it so I'm not sure)

Copy link
Contributor Author

@JosephBye JosephBye Feb 13, 2025

Choose a reason for hiding this comment

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

In the definition I wrote for score, and the new def I wrote for algaeScore, there will be triggers to prevent the coralIntake from running forever, in this case they check to see if the coral/algae is still there and if not they stop the command

L2Coral.and(backwardMode.not()).whileTrue(log(l2Coral()));
L2Coral.and(backwardMode).whileTrue(log(reverse(l2Coral())));
L3Coral.and(backwardMode.not()).whileTrue(log(l3Coral()));
L3Coral.and(backwardMode).whileTrue(log(reverse(l3Coral())));
L4Coral.and(backwardMode.not()).whileTrue(log(l4Coral()));
L4Coral.and(backwardMode).whileTrue(log(reverse(l4Coral())));

barge.and(backwardMode.not()).whileTrue(log(barge()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question about action ready with barge. I think action ready isn't just for scoring, but any action that might require prep and alignment like intaking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I mentioned that barge is the only algae command that'll use action ready, the other two can just be pilot commands and then the pilot drives in and intakes cuz they aren't as complicated or take as long of a time to do as the other score commands

@JosephBye
Copy link
Contributor Author

Do you want to add the states for ground intaking with the corAl? Also I think the original plan was to keep the coral intaking on the left side and the algae intaking on the right side, but I assume you changed that to accommodate the station extended intaking. What are your thoughts?

I dont think states for ground intakign with corAl is necessary for our first events? I remember Allen saying something like having that might be too complicated and require too confusing mapping, however they could be added later. Like having 3 ways to intake two game pieces means like 6 different intake buttons which seems kinda insane for right now.

SpectrumFRC3847 and others added 4 commits February 13, 2025 16:47
@JosephBye some minor fixes for things I noticed in testing
If these look okay to you, I'll go ahead and pull the branch (finally! sorry for taking so long)

Also you can use axis 2 and axis 3 of keyboard0 to simulate the controller triggers in simulation
@JosephBye JosephBye merged commit d6ef383 into main Feb 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants