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

climb pivot + algae flywheel #35

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

climb pivot + algae flywheel #35

wants to merge 13 commits into from

Conversation

Abigail-27
Copy link
Contributor

@Abigail-27 Abigail-27 commented Jan 17, 2025

REVIEW REVIEWWWW

return ticksToDegrees(climbPivotMotor.getSelectedSensorPosition());
}

public void stop() {
Copy link
Member

Choose a reason for hiding this comment

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

wait I'm not sure what the mechanism looks like, but what is stop doing? If we have one method used for setting a position, it seems weird having another method for just like turning off the motor.

Rather than that it would make more sense to me that the commands that call this would just use setPivotPosition to set it to its like inactive position.

@JacksonElia
Copy link
Member

Lowkey Idk enough about our design to review this effectively

@Ishan1522
Copy link
Member

Abigail doesn't want this to be reviewed yet lol

@Ishan1522
Copy link
Member

Should make this a draft or smthn

@Ishan1522 Ishan1522 marked this pull request as draft January 18, 2025 01:29
@Ishan1522 Ishan1522 changed the title Coral pivot end effector + pneumatic Jan 28, 2025
@Abigail-27 Abigail-27 marked this pull request as ready for review January 29, 2025 19:51
@Abigail-27 Abigail-27 changed the title end effector + pneumatic climb pivot + flywheel Jan 29, 2025
Copy link
Member

@Ishan1522 Ishan1522 left a comment

Choose a reason for hiding this comment

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

uh so that's kind of a lot, ill come back to the climb pivot in a bit


public ClimbPivot(frc.robot.subsystems.pivot.ClimbPivot climbPivot, double targetPosition) {
this.climbPivot = climbPivot;
this.targetPosition = targetPosition;
// Use addRequirements() here to declare subsystem dependencies.
Copy link
Member

Choose a reason for hiding this comment

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

addRequirements(climbPivot); plz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yessir

// Use addRequirements() here to declare subsystem dependencies.
}

// Called when the command is initially scheduled.
@Override
public void initialize() {}
public void initialize() {
climbPivot.setPivotPosition(targetPosition);
Copy link
Member

Choose a reason for hiding this comment

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

i might consider using a command factory for this @Abigail-27

This is a very simple command and it could use it.
check out #53

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ummm okay


private double targetPosition = 0;

public ClimbPivot(frc.robot.subsystems.pivot.ClimbPivot climbPivot, double targetPosition) {
Copy link
Member

Choose a reason for hiding this comment

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

you shouldn't be passing ur target position into your command, it should probably be a constant for the climb pivot angle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

uhhh ur gonna help me with that later

Copy link
Member

Choose a reason for hiding this comment

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

if u need help with stuff during meetings please come and ask me :/ I will gladly help you.


private double targetPosition = 0;

public ClimbPivot(frc.robot.subsystems.pivot.ClimbPivot climbPivot, double targetPosition) {
Copy link
Member

Choose a reason for hiding this comment

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

I would probably not name the subsystem and command files the same so you can avoid weird import things like this.

We have restarted doing <Subsystem>Subsystem, so you should rename your ClimbPivot in you subsystems file to ClimbPivotSubsystem. You could also rename this file to ClimbPivotCommand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but delete it, right? like the whole command?

Copy link
Member

Choose a reason for hiding this comment

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

if you do the command factory then yes

public static final double FLYWHEEL_I = 0 - 9;
public static final double FLYWHEEL_D = 0 - 9;

public static final double JKG_METERS_SQUARED = 0 - 9;
Copy link
Member

Choose a reason for hiding this comment

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

rename this to moment of inertia

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yessirrrr

private double currentVolts;

public PhysicalFlywheel() {
PID =
Copy link
Member

Choose a reason for hiding this comment

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

Yeah also for the Physical<Subsystem>'s we generally don't use wpilib's pid, because it runs on the RoboRIO itself, which is slower than running it directly on the motors. You also need to have a flywheel motor in this impl to control, update and configure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

making a note so i can ask u later


/** Add your docs here. */
public class SimulatedFlywheel implements FlywheelInterface {
private FlywheelSim simulatedFlywheel = new FlywheelSim(null, DCMotor.getFalcon500(2), 0);
Copy link
Member

Choose a reason for hiding this comment

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

you can add these constants in :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how

}

public void setVolts(double volts) {
currentVolts = simPID.calculate(volts);
Copy link
Member

Choose a reason for hiding this comment

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

if you are setting straight voltage i wouldn't use pid.

}

public void setFlywheelSpeed(double speed) {
setVolts(simPID.calculate(getFlywheelSpeed(), speed));
Copy link
Member

Choose a reason for hiding this comment

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

make sure your units are and will be consistent.

also your setVolts method uses the pid to calculate the pid calculating speed. That's kinda not good.

public class SimulatedFlywheel implements FlywheelInterface {
private FlywheelSim simulatedFlywheel = new FlywheelSim(null, DCMotor.getFalcon500(2), 0);
private PIDController simPID;
private double currentVolts;
Copy link
Member

Choose a reason for hiding this comment

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

id log this value to akit by adding something like flywheelAppliedVolts to the interface, and then setting this value equal to that in updateInputs.

@Ishan1522 Ishan1522 changed the title climb pivot + flywheel climb pivot + algae flywheel Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Write code for the climb Write code for the de-algefier (how to spell??)
3 participants