Skip to content

Comments

Michael shooting while moving#43

Open
themehdev wants to merge 17 commits intomainfrom
michael-shooting-while-moving
Open

Michael shooting while moving#43
themehdev wants to merge 17 commits intomainfrom
michael-shooting-while-moving

Conversation

@themehdev
Copy link
Contributor

uhm idk it kinda works but not really
idk what the prob is tho, ill work on this more tomorrow

@themehdev themehdev marked this pull request as ready for review February 18, 2026 00:24
@themehdev
Copy link
Contributor Author

it works if you are not going that fast, so I reduced the max speed to 2/3 when not shooting but in alliance zone, and 1/3 when shooting

might want a trigger to remove this, or just get arid of the aiming functionality alltogeter

actually imma do that one sec

kk the aiming functionality is commented out now, but still usable in case we ever want it again

still max speed of 1/3 when shooting, might need to be changed later but max speed of even 1/5 normal is better than 0

@themehdev
Copy link
Contributor Author

also nice job anshu

@themehdev
Copy link
Contributor Author

also jsut realized that the code works exactly the same as the normal one if we set the max shooting speed to 0, so I am just going to remove the "shoot on move" variable, and add a comment to it

…tant

just need to reverse the hopper after shooting is done and I will be happy
@themehdev
Copy link
Contributor Author

#45 should eventually be fixed but idk how so yeah ill do that maybe later

all the tested positions should be in the units library and not doubles, but im too lazy to change that rn
Copy link
Contributor Author

@themehdev themehdev left a comment

Choose a reason for hiding this comment

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

hopper should be run backward for a bit after shooting is done, shooter constants should be updated to be distances, d-pad probably shouldnt interrupt the shoot command (but there is a chance this ends up being useful if it works how I think it will work, so maybe not), but none of these are breaking and can be done later, so id say it is good to be merged in

@themehdev themehdev requested a review from kausikbs February 20, 2026 05:32
@themehdev themehdev requested a review from kausikbs February 21, 2026 17:51
Comment on lines +316 to +331
private Translation2d getTarget(){
return DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Blue
? ShooterConstants.Positions.blueHubPose
: ShooterConstants.Positions.redHubPose;
}

// ONLY USE IN CONFIGURE BINDINGS
private Translation2d getVirtualTarget() {
return getTarget().minus(
new Translation2d(
MetersPerSecond.of(drivebase_.getFieldChassisSpeeds().vxMetersPerSecond).times(ShooterConstants.hangTimeOnShot),
MetersPerSecond.of(drivebase_.getFieldChassisSpeeds().vyMetersPerSecond).times(ShooterConstants.hangTimeOnShot)
)
);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

These would probably be best moved elsewhere, or if they are not used more than once, directly into your commands

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will happen when I move the main thing into a shootCommand

Comment on lines +379 to +387
DriveCommands.joystickDriveAtAngle(
drivebase_,
() -> -gamepad_.getLeftY() * Constants.shootOnMoveMaxSpeed,
() -> -gamepad_.getLeftX() * Constants.shootOnMoveMaxSpeed,
() -> {
var hubTranslation = getVirtualTarget().minus(drivebase_.getPose().getTranslation());
var rotation = new Rotation2d(hubTranslation.getX(), hubTranslation.getY());

return rotation;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe move this into the shooter subsystem as "shootCmd" / "shootOnMoveSequence" or some class like "___Commands.java". Ideally these could be two commands, shootOnMove, and shootStill, which we can choose to use either in the code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, i will just move this all into a shootCommand(boolean moving), so we can pass in that variable there instead, so that we can have it in multiple places if nessecary

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think for the cleanest setup, you could create two commands, and then bind the trigger to a conditional command based on a Boolean. This would allow auto modes to use whichever shooter they want, with clear and concise command names, while still allowing the triggers to be conditional.

private static final RobotType robotType = RobotType.COMPETITION;

public static final boolean spawnLessFuelInSim = true;
//public static final boolean shootOnMove = false; // if true, we will allow the driver to shoot while moving, but with reduced max speed. if false, we will not allow the driver to shoot while moving.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that we should keep this boolean, it's much more readable and simple to use a Boolean than to read comments for something that you wouldn't originally expect to enable or disable a feature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as I said before, because just setting a moving speed of 0 is the same thing as stationary, I don't think that we need a boolean as a constant, but there will be one in the shoot command once I move everything over to the shooter subsystem tomorrow

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