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

Fill READMEs with helpful(?) information #31

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
64d95b1
Update READMEs
anivanchen Apr 6, 2022
1378542
Update limelight README
anivanchen Apr 6, 2022
2cb2fbd
More READMEs and fix typo
anivanchen Apr 6, 2022
35d74f5
MORE READMEs
anivanchen Apr 6, 2022
6871ae1
Start Controls README
anivanchen Apr 6, 2022
6f00594
Update READMEs
anivanchen Apr 6, 2022
9cdc309
Update limelight README
anivanchen Apr 6, 2022
a425c4d
More READMEs and fix typo
anivanchen Apr 6, 2022
955281a
MORE READMEs
anivanchen Apr 6, 2022
cd2ae28
Start Controls README
anivanchen Apr 6, 2022
f78dd0b
Merge branch 'ic/readme-marathon' of https://github.com/stuypulse/stu…
anivanchen Apr 6, 2022
c0762a5
Update READMEs
anivanchen Apr 6, 2022
bf6ba94
Update limelight README
anivanchen Apr 6, 2022
cf4f56e
More READMEs and fix typo
anivanchen Apr 6, 2022
6f4414b
MORE READMEs
anivanchen Apr 6, 2022
ab8ee05
Start Controls README
anivanchen Apr 6, 2022
e3e7c51
Merge branch 'ic/readme-marathon' of https://github.com/stuypulse/stu…
anivanchen Apr 7, 2022
9a991a9
Update READMEs
anivanchen Apr 7, 2022
358cdb9
Update readme.md
anivanchen Apr 7, 2022
5bafd52
Merge branch 'ic/readme-marathon' of https://github.com/stuypulse/stu…
anivanchen Apr 7, 2022
8be77bc
Update control readme
anivanchen Apr 8, 2022
40f48de
Merge branch 'main' into ic/readme-marathon
Sam-Belliveau Aug 23, 2022
be9ff15
Merge branch 'main' into ic/readme-marathon
Sam-Belliveau Aug 23, 2022
6b96d41
Merge branch 'main' into ic/readme-marathon
Sam-Belliveau Aug 23, 2022
7bab963
Merge branch 'main' into ic/readme-marathon
Sam-Belliveau Aug 23, 2022
2382e90
Merge branch 'main' into ic/readme-marathon
Sam-Belliveau Aug 23, 2022
d9c2ab3
Merge branch 'main' into ic/readme-marathon
Sam-Belliveau Aug 23, 2022
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
Prev Previous commit
Next Next commit
Update READMEs
anivanchen committed Apr 6, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 6f00594135305708fc9643aa3efb15f79716e7f8
18 changes: 9 additions & 9 deletions src/com/stuypulse/stuylib/math/readme.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# StuyLib Math Library

## What is the point of these classes
The Math library in StuyLib contains helpful utilities that make FRC programming easier and cleaner.

### [SLMath](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/SLMath.java)

SLMath is just a class with some static math functions that are useful in robotics.
SLMath is a class with static math functions that are useful in robotics.

For example, when squaring a number, `SLMath.square(x)` will keep the sign of the number. *this is used when filtering controller inputs* `SLMath.pow(x, p)` will also keep the sign of x no matter what the value of x or p. This might not seem useful normally, but is nice to have in FRC.
For example, when squaring a number, `SLMath.square(x)` will keep the sign of the number. *This is used when filtering controller inputs.* `SLMath.pow(x, p)` will also keep the sign of `x` no matter what the value of `x` or `p`. This might not seem useful normally, but is nice to have in FRC.

Other functions like `SLMath.limit` or `SLMath.deadband` are super helpful in FRC.

### [Vector2D](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Vector2D.java)
### [Angle](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Vector2D.java)

This is just a standard Vector2D class that has every feature you would need, and also works with our other classes in Stuylib. It also works nicely with our [Angle](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Angle.java) class, which is a nice bonus.
This is an [Angle](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Vector2D.java) class that removes the confusion about degrees and radians, and works nicely with our [Vector2D](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Vector2D.java). When doing math with the [Angle](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Vector2D.java) class, you do not need to worry about the value of the angle being outside the range of `-pi < x < pi`.

### [Angle](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Vector2D.java)
### [Vector2D](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Vector2D.java)

This is an angle class that removes the confusion about degrees / radians, and works nicely with our [Vector2D](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Vector2D.java). When doing math with the angle class, you do not need to worry about the value of the angle being outside the range of `-pi < x < pi`.
The [Vector2D](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Vector2D.java) class contains features that cover common coordinate vector manipulation needs, and also works with other classes in StuyLib. It also works nicely with the [Angle](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Angle.java) class.

## Summary
### [Polar2D](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Polar2D.java)

This Math folder in stuylib contains some helpful utilities that make programming FRC code a little bit easier.
The [Polar2D](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Polar2D.java) class contains features that cover common polar vector manipulation needs. It is heavily dependant on the [Angle](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Angle.java) and [Vector2D](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/math/Vector2D.java) classes.
48 changes: 47 additions & 1 deletion src/com/stuypulse/stuylib/network/readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
# StuyLib Robot Networking Library

WIP...
The Robot Networking Library simplifies user interaction with the APIs of various network elements of FRC Robotics such as NetworkTables / SmartDashboard or the Limelight.

## Usage

Say we wanted to insert values into SmartDashboard which we could use to control a motor, either in code or on SmartDashboard, we could write:
```
SmartNumber MOTOR_SPEED = new SmartNumber("Conveyor/Motor Speed", 1.0);
SmartBoolean MOTOR_DISABLED = new SmartBoolean("Conveyor/Disabled", false)
```

By creating a new SmartNumber, we can now adjust the speed of the motor using SmartDashboard during testing. In addition, we can toggle the reject function of the motor through SmartDashboard or by manipulating the SmartBoolean value through code. Using SmartDashboard to store values allow for them to be "centralized" and more easily accessible throughout the program.

For example, if we wanted to disable a motor:
```
if (shouldDisableMotor()) {
Settings.Subsystem.MOTOR_DISABLED.set(true);
}
```
If we want to run a motor:
```
if (hasBall()) {
motor.set(Settings.Subsystem.MOTOR_SPEED.get())
}
else {
motor.stopMotor()
}
```

### [Limelight](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/limelight/readme.md)

Read the limelight [`readme.md`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/limelight/readme.md) to learn more.

### [SLNetworkTable](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/SLNetworkTable.java)

[SLNetworkTable](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/SLNetworkTable.java) is used to easily interface with a network table. It can be used to get or set values on the network table.

### [SmartBoolean](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/SmartBoolean.java)

[SmartBoolean](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/SmartBoolean.java) is a wrapper of the SmartDashboard API for manipulating `boolean` values on SmartDashboard.

### [SmartNumber](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/SmartNumber.java)

[SmartNumber](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/SmartNumber.java) is a wrapper of the SmartDashboard API for manipulating `double` values on SmartDashboard. Their values can be the returned, casted as a `double`, `float`, `int`, or `long`.

### [SmartString](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/SmartString.java)

[SmartString](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/SmartString.java) is a wrapper of the SmartDashboard API for manipulating `String` values on SmartDashboard.
34 changes: 18 additions & 16 deletions src/com/stuypulse/stuylib/streams/filters/readme.md
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@

## What is a filter?

A filter is basically a class / function that takes in a value, and returns the "filtered" value.
A filter is a class / function that takes in a value and returns the "filtered" value.

For example say we made a Moving Average Filter.
For example, below is an example of a Moving Average filter.

```java
// Returns the average of the last 3 values
@@ -17,36 +17,38 @@ System.out.println(avg.get(4)); // Prints: 3.0
System.out.println(avg.get(5)); // Prints: 4.0
```

Everytime we called `.get()` on the filter, it returned the averagee of the last 3 values, because thats what the filter was made to do.
Every time we call `.get()` on the filter, it returned the average of the last 3 values.

## What should we use them for?
## Usage

### Ramping Motors

When sending speed values to motors, you might not always want them to update immediately, as that could cause jerk and current spikes.

In WPILib, there is the option to ramp motors when configuring them. This ramping algorithm is analygous to the filtering done by the filter called [Rate Limit](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/RateLimit.java). RateLimit works good for smoothing out the motion of the robot, but through testing we have found that the filter called [LowPass Filter](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/LowPassFilter.java), does a much nicer job of providing smooth motion without introducing a large delay.
In WPILib, there is the option to ramp motors when configuring them. This ramping algorithm is analygous to the filtering done by the filter called [`RateLimit`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/RateLimit.java). `RateLimit` works well for smoothing out the motion of the robot, however through testing we have found that the filter called a [`LowPassFilter`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/LowPassFilter.java), does a significantly better job at providing smooth motion without introducing a large delay.

We did experiment with [Speed Profile](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/SpeedProfile.java), which algebraicly removes jerk from the inputs of a conroller, however the delay it introduced killed its usefulness compared to [LowPass Filter](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/LowPassFilter.java).
We experimented with [`SpeedProfile`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/SpeedProfile.java), which algebraically removes jerk from the inputs of a controller, however the delay it introduced significantly lowered usefulness compared to [`LowPassFilter`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/LowPassFilter.java).

The reduced jerk when controlling the motors is a huge advantage as it uses less power, and prevents the robot from skipping / tilting, which can mess with sensor data. This allows the driver to drive faster without worrying about damaging the robot.

Delay is the biggest issue with filters. Because they can not predict the future, it's impossible for it to smooth out values without introducing some amount of delay. We've found that filters that prioritize recent values more than past ones, are able to do the best.
The reduced jerk when controlling the motors is a huge advantage compared to unfiltered input, as it uses less power and prevents the robot from skidding / tilting, which can mess with sensor data. This allows the driver to drive faster and smoother, without worrying about damaging the robot.

### Filtering Data

When reading data from something like the Limelight or an encoder, sometimes noise can be an issue. Encoders sometimes include a form of [Moving Average](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/MovingAverage.java) to smooth out noise in data. However, filters can often add a delay, which if fed into a PID loop, can often cause decreased performance. We've found that using a small [LowPass Filter](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/LowPassFilter.java) on data that has a slight bit of noise in it can help a lot, however it will decrease performance.
When reading data from something like the Limelight or an encoder, sometimes noise can be an issue. Encoders sometimes include a form of [`MovingAverage`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/MovingAverage.java) to smooth out noise in data. However, filters can often add a delay, which if fed into a PID loop, can often cause decreased performance. We've found that using a small [`LowPassFilter`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/LowPassFilter.java) on data that has a slight bit of noise in it can help a lot, however it will decrease performance.

A recently added filter named [`MedianFilter`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/MedianFilter.java) is able to reduce noise while not having a huge impact on delay. It is good to combine this filter with other filters to get an optimal result.

## Filter Delay

A recently added filter named [Median Filter](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/MedianFilter.java) is able to reduce noise while not having a huge impact on delay. It is good to combine this filter with other filters to get an optimal result.
Delay is the biggest issue with filters. Due to their inability predict the future, it's impossible for it to smooth out values without introducing some amount of delay. We've found that filters that prioritize recent values more than past ones, are able to perform with lower delay whilst maintining impressive filtering performance.

## Which Filter should I use?
## Choosing your filter

Some filters have internal timers in them which keep track of real world time. This is helpful if the data your collecting is real time, and in a time series. When it comes to FRC Robotics, almost all data that we have used filters on is real time. Be sure to read the documentation of certain filters to see which ones use timers in them.
Some filters have internal timers in them which keep track of real world time. This is helpful if the data your collecting is real time, and in a time series. When it comes to FRC robotics, almost all data that we have used filters on is real time. Be sure to read the documentation of certain filters to see which ones use timers in them.

Depending on which type of data you are working with, some filters might be better than others. However, we've found the [LowPass Filter](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/LowPassFilter.java) to be an amazing all around filter, and should be used as a Rule of Thumb when testing out filters. *(meaning that LowPass Filters will usually be the best)*
Depending on which type of data you are working with, some filters might be better than others. However, we've found the [`LowPassFilter`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/LowPassFilter.java) to be an amazing all around filter, and should be used as a Rule of Thumb when testing out filters *(`LowPass` filters will usually be the best)*.

Also, combine filters using [IFilterGroup](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/IFilterGroup.java), as filtering filtered values can often have interesting and desirable results.
Filters can be combined using [`IFilterGroup`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/IFilterGroup.java), as filtering filtered values can often have interesting and desirable results.

## Why do filters take in `Numbers` instead of `double`?

In order to help make filters more configurable, the configuation is done using the Number class. Why? Because [SmartNumber](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/SmartNumber.java) extends `Number`, which makes it extremely easy to change values like the RC of a [LowPass Filter](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/LowPassFilter.java) on the fly.
In order to help make filters more configurable, the configuation is done using the Number class. Why? Because [SmartNumber](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/network/SmartNumber.java) extends `Number`, which makes it extremely easy to change values, such as the RC of a [`LowPassFilter`](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters/LowPassFilter.java), on the fly.
36 changes: 19 additions & 17 deletions src/com/stuypulse/stuylib/streams/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# StuyLib Streams Library

## What is a Stream
The Streams library in StuyLib contains streams which return a stream of data. It also contains [filters](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/filters) which can be used to filter through raw input to reduce noise, jitter, input spikes, and jerkiness.

## What is a stream?

A stream is any class / lambda that when you call `.get()` it returns a double.

@@ -17,7 +19,7 @@ System.out.println(speed.get()); // Prints the current desired speed

By using a stream here, we now have an object we can call / pass around to get the desired speed of the robot. All we would need to do is call `.get()` to recieve the data.

## Why is this useful
## Why is this useful?

An [IStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/IStream.java) is a useful object to pass around as it represents a constantly updating stream of information. There are things we can do with this stream to get some extra functionality.

@@ -33,6 +35,21 @@ IStream filtered_speed = new FilteredIStream(speed, new LowPassFilter(0.5));
System.out.println(filtered_speed.get()); // Prints the filtered value of the stream
```

### [PollingIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/PollingIStream.java)

[PollingIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/PollingIStream.java) is a very powerful wrapper around an [IStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/IStream.java) that polls the underlying `.get()` function a fixed number of times per second. When you call `.get()` on a [PollingIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/PollingIStream.java), it will return you the last polled value from the underlying stream.

```java
// Creates an IStream that is updated 50 times a second.
IStream polled_speed = new PollingIStream(speed, 50.0);
```

This is useful for streams where the state changes when you call `.get()`. Say you were using reading from [CSVIStream.Reader](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/CSVIStream.java), but you wanted a new value every 50th of a second. By using a PollingIStream, no matter how fast you call `.get()`, you will only ever recieve a new value every 50th of a second. When using a [Filtered IStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/FilteredIStream.java) or a [CSVIStream.Reader](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/CSVIStream.java), the value can change when you call `.get()`, so its important to be aware when you poll a stream.

### [BufferedIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/BufferedIStream.java)

A [BufferedIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/BufferedIStream.java) is just a wrapper around a normal [IStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/IStream.java) that lets you access past values with `.get(delta)`. When stored inside an IStream it acts identically to the original stream, making its usage a bit difficult.

### [CSVIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/CSVIStream.java)

CSVIStream has two child classes in it, `CSVIStream.Writer` and `CSVIStream.Reader`.
@@ -56,18 +73,3 @@ System.out.println(file_speed.get()); // The third value of the CSV file.
```

This is useful in general for things like logging or reading CSV files in a streamlined way.

### [PollingIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/PollingIStream.java)

[PollingIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/PollingIStream.java) is a very powerful wrapper around an [IStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/IStream.java) that polls the underlying `.get()` function a fixed number of times per second. When you call `.get()` on a [PollingIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/PollingIStream.java), it will return you the last polled value from the underlying stream.

```java
// Creates an IStream that is updated 50 times a second.
IStream polled_speed = new PollingIStream(speed, 50.0);
```

This is useful for streams where the state changes when you call `.get()`. Say you were using reading from [CSVIStream.Reader](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/CSVIStream.java), but you wanted a new value every 50th of a second. By using a PollingIStream, no matter how fast you call `.get()`, you will only ever recieve a new value every 50th of a second. When using a [Filtered IStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/FilteredIStream.java) or a [CSVIStream.Reader](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/CSVIStream.java), the value can change when you call `.get()`, so its important to be aware when you poll a stream.

### [BufferedIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/BufferedIStream.java)

A [BufferedIStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/BufferedIStream.java) is just a wrapper around a normal [IStream](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/streams/IStream.java) that lets you access past values with `.get(delta)`. When stored inside an IStream it acts identically to the original stream, making its usage a bit difficult.
10 changes: 9 additions & 1 deletion src/com/stuypulse/stuylib/util/readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# StuyLib Misc Utils.

WIP...
These miscellaneous utility classes do not fall under any of the other sublibraries and exist as experiments or as classes that are handy to have around.

### [StopWatch](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/util/StopWatch.java)

The [StopWatch](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/util/StopWatch.java) class can be used as timers in other classes which depend on intervals of time.

### [HashBuilder](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/util/HashBuilder.java)

The [HashBuilder](https://github.com/StuyPulse/StuyLib/blob/main/src/com/stuypulse/stuylib/util/HashBuilder.java) class implements various hash manipulation features and exists as an experiment with generating and manipulating hashes.