Skip to content

Conversation

@Ishan1522
Copy link
Member

No description provided.

@Ishan1522 Ishan1522 linked an issue Feb 16, 2025 that may be closed by this pull request
5 tasks
@Ishan1522 Ishan1522 marked this pull request as draft February 16, 2025 15:43
@Ishan1522
Copy link
Member Author

/format

@junocapra junocapra marked this pull request as ready for review February 18, 2025 23:25
Copy link
Member

@JacksonElia JacksonElia left a comment

Choose a reason for hiding this comment

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

I think before this is merged, a lot of testing should be done, but the way you implemented it is nice. Cooking fr

// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}

Copy link
Member

Choose a reason for hiding this comment

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

Maybe you want to set the elevator motor speed to 0 when the command ends? Ask mr ishan

Copy link
Contributor

Choose a reason for hiding this comment

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

too ez- maxc

Copy link
Contributor

Choose a reason for hiding this comment

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

I hate all of you guys

@JacksonElia JacksonElia changed the base branch from main to maxcccelevatorsetpoint!!11! February 19, 2025 08:31
@JacksonElia JacksonElia changed the base branch from maxcccelevatorsetpoint!!11! to main February 19, 2025 08:31
if (Math.abs(swerveDrive.getRoll()) >= ElevatorConstants.MAX_ROLL_ANGLE // gyro safety
|| Math.abs(swerveDrive.getPitch())
>= ElevatorConstants
.MAX_PITCH_ANGLE) // TODO if robot is not in climbing state, then do this (AND
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't care about the state of the elevator when we are climbing right? In fact the elevator should be all the way down while climbing, so this should only help us.

Copy link
Contributor

Choose a reason for hiding this comment

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

W THINKING MAX L WAS WRONG LOLLLLL

// logic)
{
// elevatorSubsystem.setDefaultCommand(new ZeroElevator(elevatorSubsystem)); // maybe works
elevatorSubsystem.setElevatorPosition(0);
Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't looked into both of these things enough to comment on whether you guys did this correctly or not....

Copy link
Contributor

Choose a reason for hiding this comment

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

test it ig -maxxxxxxxxxc

import frc.robot.subsystems.elevator.ElevatorSubsystem;

/* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */
public class ZeroElevator extends Command {
Copy link
Member Author

Choose a reason for hiding this comment

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

Make this a command factory in elevator subsystem

Copy link
Contributor

Choose a reason for hiding this comment

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

ok -maxc

// The limits for the gyro
public static final double MAX_ROLL_ANGLE = 30; // degrees
public static final double MAX_PITCH_ANGLE = 20; // degrees
// public static final double MAX_ACCEL_X = 69;
Copy link
Member Author

Choose a reason for hiding this comment

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

These should be in swerve constants and wouldn't rlly have anything to do with moving the elevator; they just limit the motion of the robot so we don't tip.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok -maxc

return gyroInputs.yawDegrees;
}

public double getPitch() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Docstrings?

Copy link
Contributor

Choose a reason for hiding this comment

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

no

Copy link
Member

Choose a reason for hiding this comment

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

Make the docstring have a return in it, and specify what units/direction this is in. E.g. Gets the pitch of the robot in degrees, positive being when the robot leans forwards (this is just a guess, I could be wrong, so double check it)

@Ishan1522 Ishan1522 added this to the Catawba milestone Mar 3, 2025
@Urbanmass
Copy link
Contributor

I will delete all your code - Rohan

Copy link
Member

@JacksonElia JacksonElia left a comment

Choose a reason for hiding this comment

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

Nice work, this code could def save us

Comment on lines +312 to +314
// operatorController.b().whileTrue(Commands.none());
// operatorController.y().whileTrue(Commands.none());
// operatorController.x().whileTrue(Commands.none());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// operatorController.b().whileTrue(Commands.none());
// operatorController.y().whileTrue(Commands.none());
// operatorController.x().whileTrue(Commands.none());

Comment on lines +112 to +116
leaderMotor.setPosition(0);//set encoder back to 0
followerMotor.setPosition(0); // set encoder back to 0
//leaderMotor.setPosition(Rotations.of(0.0));
followerMotor.set(0);
leaderMotor.set(0);}
Copy link
Member

Choose a reason for hiding this comment

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

do you need to set both the leader and follower? Couldn't you just do the leader?

Comment on lines +119 to +120
leaderMotor.setPosition(ElevatorConstants.MAX_HEIGHT);//set encoder to max height
followerMotor.setPosition(ElevatorConstants.MAX_HEIGHT); // set encoder to max height
Copy link
Member

Choose a reason for hiding this comment

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

Idk if you want to set the position here, it could lead to the elevator getting zeroed wrong I think

Copy link
Member Author

Choose a reason for hiding this comment

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

dat da whole point of dis tho

Copy link
Member

Choose a reason for hiding this comment

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

no but like we should only ever zero it at the bottom i feel. Like what if the elevator gets stuck on something while its going up, or it gets 90% of the way up and bc of fucky belt stuff can't go any further?

Comment on lines +187 to +188
public static final double MAX_ROLL_ANGLE = 30; // degrees
public static final double MAX_PITCH_ANGLE = 20; // degrees
Copy link
Member

Choose a reason for hiding this comment

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

We should maybe try to "tune" these values, but these are probably pretty good

@JacksonElia JacksonElia requested a review from Copilot March 19, 2025 18:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances elevator safety by adding a new ZeroElevator command, incorporating homing logic into the PhysicalElevator, and introducing stator current monitoring and safety checks during teleop.

  • Introduces a ZeroElevator command to reset elevator position and stop motors.
  • Implements elevator homing logic based on stator current and velocity conditions in PhysicalElevator.
  • Updates elevator constants, adds current measurement support, and includes additional safety checks in teleopPeriodic.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/java/frc/robot/commands/elevator/ZeroElevator.java Adds new command for zeroing the elevator.
src/main/java/frc/robot/subsystems/elevator/PhysicalElevator.java Introduces stator current monitoring and homing functionality.
src/main/java/frc/robot/subsystems/elevator/ElevatorInterface.java Adds default methods for stator current and homing.
src/main/java/frc/robot/Robot.java Integrates ZeroElevator and homing checks in teleopPeriodic along with safety limits.
src/main/java/frc/robot/subsystems/swerve/gyro/GyroInterface.java, SwerveDrive.java, PhysicalGyro.java, SimulatedGyro.java Enhances gyro input handling by including pitch and roll.
src/main/java/frc/robot/subsystems/elevator/ElevatorConstants.java Updates elevator proportional gain and introduces stator current thresholds.
Comments suppressed due to low confidence (1)

src/main/java/frc/robot/subsystems/elevator/ElevatorConstants.java:35

  • MIN_STATOR_THRESHOLD is set to the same value as MAX_STATOR_THRESHOLD, which might lead to unintended logic in the homing method; please confirm that this is the desired behavior.
public static final double MIN_STATOR_THRESHOLD = 59343494;

Comment on lines +34 to 36
public static final double MAX_STATOR_THRESHOLD = 59343494;
public static final double MIN_STATOR_THRESHOLD = 59343494;

Copy link

Copilot AI Mar 19, 2025

Choose a reason for hiding this comment

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

The MAX_STATOR_THRESHOLD value appears unusually high; please double-check whether this constant accurately reflects operational limits.

Suggested change
public static final double MAX_STATOR_THRESHOLD = 59343494;
public static final double MIN_STATOR_THRESHOLD = 59343494;
public static final double MAX_STATOR_THRESHOLD = 40.0;
public static final double MIN_STATOR_THRESHOLD = 0.0;

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

it said 59334343494 is not operational limits???

@Ishan1522 Ishan1522 modified the milestones: Catawba, States Mar 20, 2025
@Ishan1522
Copy link
Member Author

we might merge b4 pitt idk. depends on how it goes today

@Ishan1522 Ishan1522 added needs robot for testing high priority extremely important stuff that NEEDS to get done labels Mar 28, 2025
@mychenezpz
Copy link
Contributor

ok so i did add docstrings and I did the eject coral thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

high priority extremely important stuff that NEEDS to get done needs robot for testing

Projects

No open projects
Status: In Progress

Development

Successfully merging this pull request may close these issues.

Elevator safety

6 participants