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

[WIP] Units Library #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

[WIP] Units Library #10

wants to merge 3 commits into from

Conversation

kaijchang
Copy link
Collaborator

Adds a lot of utilities to the library
DONT MERGE

build.gradle Outdated Show resolved Hide resolved
build.gradle Outdated
// or from command line. If not found an exception will be thrown.
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
// want to store a team number in this file.
team = frc.getTeamNumber()
Copy link

Choose a reason for hiding this comment

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

Name not indicative of type

team_number

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can't change this because it's setting a property that's used by the Gradle plugin we use


// ramsete constants (tested for most robots)
public static final double kB = 2.0;
public static final double kZeta = 0.7;
}

Copy link

Choose a reason for hiding this comment

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

Good naming here

src/main/java/org/team4159/frc/robot/Robot.java Outdated Show resolved Hide resolved
public static final Trajectory TEST_TRAJECTORY =
TrajectoryGenerator.generateTrajectory(
new Pose2d(0, 0, new Rotation2d(0)),
List.of(
Copy link

Choose a reason for hiding this comment

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

Why is there a newline here?

});
StringBuilder name = new StringBuilder();
boolean slashed = false;
for (int i = sorted_units.size() - 1; i >= 0; i--) {
Copy link

Choose a reason for hiding this comment

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

Need some newlines in the mehtod to organize the code better

@Override
public String symbol() {
ArrayList<Map.Entry<Unit, Integer>> sorted_units = new ArrayList<>(getUnits().entrySet());
sorted_units.sort((a, b) -> {
Copy link

Choose a reason for hiding this comment

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

Seperate this into another function and pass that function into the sort


@Override
public String toString() {
return amount + " " + unit.symbol();
Copy link

Choose a reason for hiding this comment

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

Does Java automatically convert doubles to string when concatenating with string?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes

@kaijchang kaijchang added the enhancement New feature or request label Feb 2, 2020
@ri-nath
Copy link
Collaborator

ri-nath commented Feb 10, 2020

do we still want to merge this, or should i close the pr?

@kaijchang kaijchang changed the title Units Library [don't merge] Units Library Feb 17, 2020
@kaijchang kaijchang changed the title [don't merge] Units Library [WIP] Units Library Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants