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

Shooter #2

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Shooter #2

wants to merge 5 commits into from

Conversation

prasadbis
Copy link
Collaborator

Created a shooter subsystem.

@prasadbis prasadbis self-assigned this Nov 4, 2024
@@ -103,6 +107,8 @@ private void configureBindings() {
autonomous().whileTrue(new ProxyCommand(autos::get));
FaultLogger.onFailing(f -> Commands.print(f.toString()));

teleop().onTrue(shooter.shoot());
Copy link
Member

Choose a reason for hiding this comment

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

Likely left here for testing purposes, but noting this should be changed / removed soon!


public void setVoltage(double voltage);

public double getVelocityRad();
Copy link
Member

Choose a reason for hiding this comment

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

We typically avoid mentioning the unit return type in our code b/c it's unnecessary (we default to SI units anyway. Any different units should be noted in a comment (ask your mentors)

public static final double kv = 1;
public static final double ka = 1;

public static final double gearing = 1;
Copy link
Member

Choose a reason for hiding this comment

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

public static final constants (except k__ constants) should be named in SCREAMING_SNAKE_CASE

}

/**
* creates Shooter depending on if it's real or not.
Copy link
Member

Choose a reason for hiding this comment

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

All documentation should be properly capitalized and grammafied and english positive, or something

* wheel.
*/
public static Shooter create() {
return Robot.isReal() ? new Shooter(new RealWheel(true, TOP_WHEEL), new RealWheel(false, BOTTOM_WHEEL)) : new Shooter(new SimWheel(), new SimWheel());
Copy link
Member

Choose a reason for hiding this comment

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

apply spotless, ./gradlew sA in terminal to beautify this

pidTop.calculate(top.getVelocityRad(), target) + ffTop.calculate(target, (target-prevTop)/Constants.PERIOD.in(Seconds)));
}

private void setBottomSpeed(double target) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a case in which having these speeds be different is valuable? The code duplication is undesirable & the ability to make mistakes with flywheels spinning in opposite directions while compressing a note through them is very high

pidBottom.calculate(bottom.getVelocityRad(), target) + ffBottom.calculate(target, (target-prevBottom)/Constants.PERIOD.in(Seconds)));
}

private void setSpeed(double topTarget, double topBottom) {
Copy link
Member

Choose a reason for hiding this comment

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

topBottom ??


public void setVoltage(double voltage) {
sim.setInputVoltage(voltage);
sim.update(PERIOD.in(Units.Seconds));
Copy link
Member

Choose a reason for hiding this comment

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

The units library is already statically imported so you can just have Seconds there without the dot notation


/** SimWheel */
public class SimWheel implements WheelIO {
@Log.NT FlywheelSim sim;
Copy link
Member

Choose a reason for hiding this comment

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

Monologue won't ever send this over NT (it's not Sendable to begin with).

Instead, stick to placing this annotation over the subsystem getters to retrieve important information for logging in ALL of your hardware implementations, not just in your sim or real impls (you already do this so good work)

motor.setInverted(inverted);
motor.setSmartCurrentLimit(30);
motor.burnFlash();
encoder = motor.getEncoder();
Copy link
Member

Choose a reason for hiding this comment

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

Set encoder conversion somewhere for replacement when you get values

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.

2 participants