Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wpimath] Move WPILib math classes into wpimath
This includes LinearFilter and MedianFilter, controller feedforwards, geometry, kinematics, spline, and trajectory classes. Package names and include directories were not changed to avoid code breakage.
- Loading branch information
1 parent
6c90c02
commit ffb805c
Showing
178 changed files
with
622 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,7 @@ includeGuardRoots { | |
} | ||
|
||
includeOtherLibs { | ||
^Eigen/ | ||
^unsupported/ | ||
^wpi/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*----------------------------------------------------------------------------*/ | ||
/* Copyright (c) 2020 FIRST. All Rights Reserved. */ | ||
/* Open Source Software - may be modified and shared by FRC teams. The code */ | ||
/* must be accompanied by the FIRST BSD license file in the root directory of */ | ||
/* the project. */ | ||
/*----------------------------------------------------------------------------*/ | ||
|
||
package edu.wpi.first.math; | ||
|
||
public interface MathShared { | ||
/** | ||
* Report an error. | ||
* | ||
* @param error the error to set | ||
*/ | ||
void reportError(String error, StackTraceElement[] stackTrace); | ||
|
||
/** | ||
* Report usage. | ||
* | ||
* @param id the usage id | ||
* @param count the usage count | ||
*/ | ||
void reportUsage(MathUsageId id, int count); | ||
} |
59 changes: 59 additions & 0 deletions
59
wpimath/src/main/java/edu/wpi/first/math/MathSharedStore.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*----------------------------------------------------------------------------*/ | ||
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */ | ||
/* Open Source Software - may be modified and shared by FRC teams. The code */ | ||
/* must be accompanied by the FIRST BSD license file in the root directory of */ | ||
/* the project. */ | ||
/*----------------------------------------------------------------------------*/ | ||
|
||
package edu.wpi.first.math; | ||
|
||
public final class MathSharedStore { | ||
private static MathShared mathShared; | ||
|
||
private MathSharedStore() { | ||
} | ||
|
||
/** | ||
* get the MathShared object. | ||
*/ | ||
public static synchronized MathShared getMathShared() { | ||
if (mathShared == null) { | ||
mathShared = new MathShared() { | ||
@Override | ||
public void reportError(String error, StackTraceElement[] stackTrace) { | ||
} | ||
|
||
@Override | ||
public void reportUsage(MathUsageId id, int count) { | ||
} | ||
}; | ||
} | ||
return mathShared; | ||
} | ||
|
||
/** | ||
* set the MathShared object. | ||
*/ | ||
public static synchronized void setMathShared(MathShared shared) { | ||
mathShared = shared; | ||
} | ||
|
||
/** | ||
* Report an error. | ||
* | ||
* @param error the error to set | ||
*/ | ||
public static void reportError(String error, StackTraceElement[] stackTrace) { | ||
getMathShared().reportError(error, stackTrace); | ||
} | ||
|
||
/** | ||
* Report usage. | ||
* | ||
* @param id the usage id | ||
* @param count the usage count | ||
*/ | ||
public static void reportUsage(MathUsageId id, int count) { | ||
getMathShared().reportUsage(id, count); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*----------------------------------------------------------------------------*/ | ||
/* Copyright (c) 2020 FIRST. All Rights Reserved. */ | ||
/* Open Source Software - may be modified and shared by FRC teams. The code */ | ||
/* must be accompanied by the FIRST BSD license file in the root directory of */ | ||
/* the project. */ | ||
/*----------------------------------------------------------------------------*/ | ||
|
||
package edu.wpi.first.math; | ||
|
||
public enum MathUsageId { | ||
kKinematics_DifferentialDrive, | ||
kKinematics_MecanumDrive, | ||
kKinematics_SwerveDrive, | ||
kTrajectory_TrapezoidProfile, | ||
kFilter_Linear, | ||
kOdometry_DifferentialDrive, | ||
kOdometry_SwerveDrive, | ||
kOdometry_MecanumDrive | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...a/edu/wpi/first/wpilibj/MedianFilter.java → ...a/edu/wpi/first/wpilibj/MedianFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...st/wpilibj/controller/ArmFeedforward.java → ...st/wpilibj/controller/ArmFeedforward.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ilibj/controller/ElevatorFeedforward.java → ...ilibj/controller/ElevatorFeedforward.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...bj/controller/SimpleMotorFeedforward.java → ...bj/controller/SimpleMotorFeedforward.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...u/wpi/first/wpilibj/geometry/Twist2d.java → ...u/wpi/first/wpilibj/geometry/Twist2d.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rst/wpilibj/kinematics/ChassisSpeeds.java → ...rst/wpilibj/kinematics/ChassisSpeeds.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.