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

Commenting step 1 #39

Open
wants to merge 7 commits into
base: Dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,9 @@ public class RobotVersion2024 implements RobotVersionConstants {
}

public static final RobotVersion defaultRobotVersion = RobotVersion.v2024;

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 1;
}
Comment on lines +157 to +161
Copy link
Member

Choose a reason for hiding this comment

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

What is this?

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 Created a function called explanation in each class. in the explanation file people will get a clear explanation of how things work based off of the java doc of that explanation

Copy link
Member

Choose a reason for hiding this comment

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

Why is there a function rather a direct comment block with the class and comment blocks for each of the functions? Why use this arbitrary Explanation function?

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 didnt want to make the explanation for the class to long

Copy link
Member

@dlezcan1 dlezcan1 Apr 8, 2024

Choose a reason for hiding this comment

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

I think you should focus more on comment blocks, rather than this Explanation class system. I would revert these commits and go with comment blocking

Copy link
Member Author

Choose a reason for hiding this comment

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

Also We need to have explanations for things like init Sendable and command schedule and auto etc

Copy link
Member

Choose a reason for hiding this comment

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

Those can be done for the initSendable functions, individually

Copy link
Member Author

Choose a reason for hiding this comment

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

What about command Scheduler etc. I want to make it so that each student who wants to code after me knows exactly where to look for stuff. I cant java doc the init sendable stuff really and command scheduler stuff

Copy link
Member

Choose a reason for hiding this comment

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

Take this to the main comment block. I'll respond there.

}
92 changes: 92 additions & 0 deletions src/main/java/frc/robot/Other/Explanations.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package frc.robot.Other;

import frc.robot.subsystems.*;
import frc.robot.Constants;
import frc.robot.Robot;
import frc.robot.RobotContainer;
import frc.robot.commands.*;

/**
* Here, Explanations of How everything works are held.
*
* <p>When Within The class:
*
* <p>{@code - Hover over the Green Part to Get a basic explanation}
*
* <p>{@code - Hover over the Yellow Part for a More Detailed explanation}
*
* <p>{@code - Hover over The Blue Part to find what your getting an Explanation of}
*
* <p>EX: int {@link #DriveTrainExplanation} (Blue) = {@link DriveTrain} (Green) {@link
* DriveTrain#Explanation} (Yellow)
*
* <p>Sub Explanations are down Below:
*
* <ul>
* <li>Init Sendable:
* <ul>
* <li>Sendable objects are things that can be sent to the smart dashboard (WHEN TALKING
* ABOUT FRC!!!!).
* <li>Initializing a sendable object sends that object to the smart dashboard.
* <li>To send other things to the smart dashboard, Use the sendable builder (the thing that
* sends stuff)
* <li>EX: {@link Hanger#initSendable} and {@link DriveTrain#initSendable}
* <li>In order to send variables, you must do {@code builder.addDoubleProperty} (Instead of
* Double do variable type of choice)
* </ul>
*/
dlezcan1 marked this conversation as resolved.
Show resolved Hide resolved
public class Explanations {

public abstract class SubsystemExplanations {
Copy link
Member

Choose a reason for hiding this comment

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

Why is the public abstract class?

Copy link
Member Author

Choose a reason for hiding this comment

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

Dont wont to make an object of it.

Copy link
Member

Choose a reason for hiding this comment

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

Why make an object out of it at all? Why is this a class?

Copy link
Member Author

Choose a reason for hiding this comment

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

want*

Copy link
Member

Choose a reason for hiding this comment

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

Right, why is this a class at all?

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 wanted to make it clear for younger students where all the explanataions would be

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 argue that the class implementation is more confusing itself. I think this would be more smoothly implemented with your structure you have in Hanger.java minus the Explanation function.

Copy link
Member Author

Choose a reason for hiding this comment

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

When people want explanation for things I would like for everything to be in the same place

Copy link
Member Author

Choose a reason for hiding this comment

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

If you look in Hanger Module The explanation is like a good 200 words that I dont want to be shown when hovering over HangerModule.java

Copy link
Member

Choose a reason for hiding this comment

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

Break the comments into their individual functions then.


int DriveTrainExplanation = DriveTrain.Explanation();

int HangerExplanation = Hanger.Explanation();

int HangerModuleExplanation = HangerModule.Explanation();

int IntakeExplanation = Intake.Explanation();

int IntakeWheelsExplanation = IntakeWheels.Explanation();

int LimelightExplanation = Limelight.Explanation();

int ShooterExplanation = Shooter.Explanation();

int SwerveModuleExplanation = SwerveModule.Explanation();
}

public abstract class RobotExplanations {

int ConstantsExplanation = Constants.Explanation();

int RobotExplanation = Robot.Explanation();

int RobotContainerExplanation = RobotContainer.Explanation();

// Main.java Is where we initialize our robot.
// It is told which code based (Timed or Command Based or Custom) via the Robot.java class (As
// seen in the Main File)
// DO NOT CREATE ANYTHING IN MAIN.JAVA

}

public abstract class CommandExplanation {

int AprilAlignToSpeakerRadiallyCommandExplanation =
AprilAlignToSpeakerRadiallyCommand.Explanation();

int AprilAlignToTransformCommandExplanation = AprilAlignToTransformCommand.Explanation();

int AutoIntakeExplanation = AutoIntake.Explanation();

int AutoShooterExplanation = AutoShooter.Explanation();

int OrientShooterAngleExplanation = OrientShooterAngle.Explanation();

int OrientShooterAngleByEncoderValueExplanation =
OrientShooterAngleByEncoderValue.Explanation();

int SwerveDriveCommandExplanation = SwerveDriveCommand.Explanation();
}
}
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,9 @@ public void simulationInit() {}

@Override
public void simulationPeriodic() {}

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 2;
}
}
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,9 @@ public Command getAutonomousCommand() {
return autoCommand.beforeStarting(
() -> m_DriveTrain.resetPose(new Pose2d(1.27, 5.55, new Rotation2d())));
}

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 3;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,9 @@ public boolean RobotIsWithinGoalRadius() {
public boolean isFinished() {
return omegaController.atGoal() && RobotIsWithinGoalRadius();
}

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,9 @@ public void end(boolean interrupted) {
public boolean isFinished() {
return m_rotController.atGoal() && m_xController.atGoal() && m_yController.atGoal();
}

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 2;
}
}
60 changes: 5 additions & 55 deletions src/main/java/frc/robot/commands/AutoIntake.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,35 +54,7 @@ public void SetIsAmpFlag(boolean isAmp) {}

@Override
public void execute() {
// System.out.println(m_CurrentIntakeDrivingState);
/*
* if (m_IsAmp == true) {
* m_CurrentIntakeDrivingState = DrivingState.DriveIntakeAmp;
* if (m_Intake.GetIntakeMotorAngle().getDegrees() < Intake.PosAmpAngle +
* s_IntakePositioningTolerence) {
* m_Intake.RaiseIntake();
* } else if (m_Intake.GetIntakeMotorAngle().getDegrees() > Intake.PosAmpAngle -
* s_IntakePositioningTolerence) {
* m_Intake.LowerIntake();
* } else if (m_Intake.GetIntakeMotorAngle().getDegrees() < Intake.PosAmpAngle +
* s_IntakePositioningTolerence
* && m_Intake.GetIntakeMotorAngle().getDegrees() > Intake.PosAmpAngle -
* s_IntakePositioningTolerence) {
* m_Intake.StopIntake();
* m_CommandIsFinished = true;
* }
*
* }
*
*
*
*
*
*
* else
*/
if (m_CurrentIntakeDrivingState == DrivingState.DriveIntakeDown) {
// if (m_Intake.GetIntakeMotorAngle().getDegrees() < Intake.PosDownAngle) {
if (m_Intake.GetIntakeMotorAngle().getDegrees() < Intake.PosDownAngle - 40) {
m_Intake.LowerIntake();
} else {
Expand Down Expand Up @@ -118,31 +90,9 @@ public void end(boolean interrupted) {
public boolean isFinished() {
return m_CommandIsFinished;
}

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 3;
}
}
/*
* CurrentIntakePose = m_Intake.GetIntakeMotorAngle().getDegrees();
* if (m_Intake.IntakePos == 1){
* TargetDeg = Pos1;
* if (CurrentIntakePose > TargetDeg + IntakeTolerence){
* if (CurrentIntakePose > StaticSetpointDeg){
* m_Intake.intakeAngleMtr.set(-.25);
* } else {
* m_Intake.intakeAngleMtr.set(-.45);
* }
* } else{
* m_Intake.intakeAngleMtr.set(0);
* m_Intake.intakeAngleMtrEnc.setPosition(0);
* }
* }
*
* if (m_Intake.IntakePos == 2){
* TargetDeg = Pos2;
* if (CurrentIntakePose < TargetDeg - IntakeTolerence){
* m_Intake.intakeAngleMtr.set(.17);
* }
* else {
* m_Intake.intakeAngleMtr.set(0);
* }
* }
*
*/
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/commands/AutoShooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,9 @@ public void end(boolean interrupted) {
public boolean isFinished() {
return m_aprilAlignCommand.isFinished() && m_orientShooterAngleCommand.getController().atGoal();
}

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 4;
}
}
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/commands/OrientShooterAngle.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,9 @@ public boolean isFinished() {
return false;
return getController().atGoal();
}

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 5;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,9 @@ public void end(boolean interrupted) {
public boolean isFinished() {
return getController().atGoal();
}

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 6;
}
}
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/commands/SwerveDriveCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,9 @@ public void end(boolean interrupted) {}
public boolean isFinished() {
return false;
}

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 7;
}
}
20 changes: 15 additions & 5 deletions src/main/java/frc/robot/subsystems/DriveTrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SubsystemBase;

/** Represents a swerve drive style drivetrain. */
/** */
public class DriveTrain extends SubsystemBase {

public SwerveDriveKinematics m_kinematics =
Expand Down Expand Up @@ -69,10 +69,15 @@ public class DriveTrain extends SubsystemBase {
/**
* Our driveTrain Constructor.
*
* <p>In here, we initialize our swerve modules (example -> {@link #m_frontLeft}), Get input from
* autonomous and initialize our odometry -> {@link #m_odometry}.
* <p>In here, we:
*
* <p>Various other DriveTrain Related thing are initalized here too.
* <ul>
* <li>Initialize our swerve modules (EX: {@link #m_frontLeft})
* <li>Set up our autonomous builder (see below)
* <li>Initialize our odometry: {@link #m_odometry}.
* </ul>
*
* <p>Various other DriveTrain Related things are initalized here too.
*
* @param RobotVersion
*/
Expand Down Expand Up @@ -292,7 +297,7 @@ public void driveChassisSpeeds(ChassisSpeeds chassisSpeed) {
/**
* Resets the Position of the Odometer, given our Current position.
*
* @param Pose2d (pose2d) - The current position of the robot on the field. This is a {@link
* @param pose2d (pose2d) - The current position of the robot on the field. This is a {@link
Copy link
Member

Choose a reason for hiding this comment

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

Typical format is param name (Parameter's Class). change pose2d (pose2d) to pose2d (Pose2d)

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 intended to do that but misclicked apparently

Copy link
Member

Choose a reason for hiding this comment

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

Got it. Will resolve comment when addressed.

* #resetOdometry(Pose2d)}
*/
public void resetPose(Pose2d pose2d) {
Expand Down Expand Up @@ -425,4 +430,9 @@ public void initSendable(SendableBuilder builder) {
m_backLeft.initSendable(builder);
m_backRight.initSendable(builder);
}

/** <b> DETAILED EXPLANATION </b> */
public static int Explanation() {
return 1;
}
}
Loading
Loading