-
Notifications
You must be signed in to change notification settings - Fork 0
Implemented Sim, tested basic autos #16
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
Conversation
rift10
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think a lot of these values you can move to the constants file, maybe make a separate section in each constants file for sim constants
also, did you simulate it? i got an error after simulating (ports issue)
| // Logger.processInputs("Swerve/Gyro", gyroInputs); | ||
| // Logger.recordOutput("Swerve/Pose", getPose()); | ||
| // Logger.recordOutput("Swerve/Field Pose/Best Pose with offset", getBestCoralAutoAlign()); | ||
| // Logger.recordOutput( | ||
| // "Swerve/Field Pose/Best Source", getBestSourceAutoAlign().getDegrees()); | ||
| // Logger.recordOutput("Swerve/Field Pose/Robot Angle", getRotation().getDegrees()); | ||
| // Logger.recordOutput( | ||
| // "Swerve/Auto Align/Offset Transform", getBestReefTagNoOffset().minus(getPose())); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add these back
| public class GlobalConstants { | ||
|
|
||
| private static RobotType kRobotType = RobotType.BETA; | ||
| private static RobotType kRobotType = RobotType.SIMBOT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change this back before merge
|
|
||
| private ElevatorIO io; | ||
| private ElevatorIOInputsAutoLogged inputs = new ElevatorIOInputsAutoLogged(); | ||
| public ElevatorIOInputsAutoLogged inputs = new ElevatorIOInputsAutoLogged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this public now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it would be better to make a getter
| return; | ||
| } | ||
| runVolts(controller.calculate(eSim.getPositionMeters(), Units.feetToMeters(eleHeight))); | ||
| runVolts(controller.calculate(eSim.getPositionMeters(), Units.feetToMeters(setpointMeters))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this feet to meters if we're passing in meters
|
|
||
| private IntakePivotIO io; | ||
| private IntakePivotIOInputsAutoLogged inputs = new IntakePivotIOInputsAutoLogged(); | ||
| public IntakePivotIOInputsAutoLogged inputs = new IntakePivotIOInputsAutoLogged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again why public
| 180.0 // initial angle placeholder | ||
| ); | ||
| DCMotor.getKrakenX60Foc(2), | ||
| 310 / 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also if this is gearing shouldn't it match the constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all these values, i already had pid vaules tuned to them so i didn't want to retune the sim with something i already knew works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i still think you should add this to the switch case in the constants file... and do this for all the subsystem sim files
| DCMotor.getKrakenX60Foc(2), | ||
| 310 / 3, | ||
| SingleJointedArmSim.estimateMOI(0.3, 10), | ||
| .3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still lwk a magic number
|
|
||
| private WristIO io; | ||
| private WristIOInputsAutoLogged inputs = new WristIOInputsAutoLogged(); | ||
| public WristIOInputsAutoLogged inputs = new WristIOInputsAutoLogged(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
| driver.povUp(); // ! Unbound | ||
| driver.povDown(); // ! Unbound | ||
| driver.povLeft(); // ! Unbound | ||
| driver.povRight(); // ! Unbound | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put these back
src/main/java/frc/robot/subsystems/intake/pivot/IntakePivotIOSim.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| public void initiateSimulatedSequence() { | ||
| ((BeambreakIOSim) io).initiateSequence(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting.... lol
| public void setIntake(boolean val) { | ||
| intakeTriggered = val; | ||
| } | ||
|
|
||
| public void setHandoff(boolean val) { | ||
| handoffTriggered = val; | ||
| } | ||
|
|
||
| public void setEnd(boolean val) { | ||
| endTriggered = val; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you dont wanna use @ setters?
| 180.0 // initial angle placeholder | ||
| ); | ||
| DCMotor.getKrakenX60Foc(2), | ||
| 310 / 3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i still think you should add this to the switch case in the constants file... and do this for all the subsystem sim files
| DCMotor.getKrakenX60Foc(2), | ||
| 310 / 3, | ||
| SingleJointedArmSim.estimateMOI(0.3, 10), | ||
| .3, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still lwk a magic number
| private static final LoggedTunableNumber l1 = new LoggedTunableNumber("Wrist/Gains/l1", 0); | ||
| private static final LoggedTunableNumber l2 = new LoggedTunableNumber("Wrist/Gains/l2", 3); | ||
| private static final LoggedTunableNumber l3 = new LoggedTunableNumber("Wrist/Gains/l3", 2); | ||
| private static final LoggedTunableNumber l4 = new LoggedTunableNumber("Wrist/Gains/l4", 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while you're at it, there are still /gains/ in the path
| private static final double intakePivotOffsetX = Units.inchesToMeters(22.746); | ||
| private static final double intakePivotOffsetY = Units.inchesToMeters(9.577); | ||
|
|
||
| private static final double elevatorToGround = Units.inchesToMeters(5.36); | ||
| private static final double startingElevatorHeight = 0.9; | ||
| private static final double mechanismOffset = Units.inchesToMeters(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add k's in front
| public void runPosition(double angle) { | ||
| io.runPosition(angle); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
| }; | ||
|
|
||
| public static final double kBottomPosition = | ||
| public static final double kTolorance = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi this is spelled wrong
| public void runPosition(ElevatorGoal goal) { | ||
| currentGoal = goal; | ||
| io.runPosition(currentGoal.getEleHeight().getAsDouble()); | ||
| // io.runPosition(currentGoal.getEleHeight().getAsDouble()); | ||
| } | ||
|
|
||
| public void runPosition(double meters) { | ||
| io.runPosition(meters); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
| return false; | ||
| } | ||
|
|
||
| private final SysIdRoutine sysIdRoutine = new SysIdRoutine( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is all this stuff here btw, could it possibly be moved?
also it doesn't seem to be used??
Author - Your name
Description
What code was changed & why was it changed, any bugs it fixed
Checklist:
Mark with X's once you have tested