Skip to content

Commit

Permalink
Updated TrajectoryUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathandao0 committed Jan 20, 2025
1 parent fb519a4 commit 7eb1303
Show file tree
Hide file tree
Showing 21 changed files with 26 additions and 43 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1039893cb2d96d454bbb07b2c7ddee76
944826a05947e9ec9d654327717c6008
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e754e35fe3f04e36fc97b58547d4cc134b4498a3
ccc2e684a2c3a6964d4e6197aaca5b2e0cbbf65c
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a4bb5146974fe25ad3afd4a41a29cb46f5cc8d8de30b42664e7f9a7d6890ef5a
686d5192c460bd831a794dd59f243a2c4b3ef64c93eef309a301362c2567cefd
Original file line number Diff line number Diff line change
@@ -1 +1 @@
01bf2bcf474f567f3abc4db2b62ffd494fc2a5ba9fce0775176076f786fbdd32021412a10d3fc78626b2c7cf62d26f7a35f7c307d2aa63195076524ff42faafe
f65d2f8b4b960fbbf66b36c41bd49cdb229fc5b8df6cd462304932337bfbe1804d148ef89136684f7c9e2a43e2563297167a04f5f62fba1478820da9a9a81bc3
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1c17cab6779fd74c5c8478de27e15c1f
ddada1675097debe9fb58bc5020d53d4
Original file line number Diff line number Diff line change
@@ -1 +1 @@
819859b12126dd383a75c9b89831ded10d7e4e08
360b6c55928d0a6578b7387aa66e2a760e5f27a6
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2444e07cbf5a2ded390f17e92b9263dc44dbcc778a2ef54aae547f5e481cf0f3
99a8b5d014ab3821e544ce0d751e5d1704ab990743a6bc8d40b8966922f097af
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0d7c5f4eb0eaa750cae0eed9fcfee4ab94ef966ef4bf7a9fb973bbae8f0480ca3155701f2d4fe40a4f326fb8a9932e35caf5058d1aaac01d46da2a13948280e6
0cf93894e80bbfeef7fd7e98a76f37d36aa812f83a6b459a3778cda0d6a53d5a9897d0d1f1d8a259c7ee2c073b17f5f7d0df1d31b321957784e4e2247adb349a
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
30fe87d097430ed4982367fddbfb4782
300dbce8e5ff70f377ea7d623ec4b49a
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1a1ebc0d7b0f0ea63d092b5a98b4f6c8664d4eca
4ecc8e71ee3593fbbf72a68ec6f44e24d1dbda47
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1dc1c709eeab1c92902ffc0aff33983c7c0f1b3a840baaab957ea559991ed13f
fe73e1dc026a1350ae50ff44449f780bd08f8dff645b6c37db8360f5596af9b1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e1a654e3e07cacbafdc7d2f6da02df41659b53aa207403aacc77cd801c13095e818e663f6d0d9a434d3db2f43952dc20bd524beaff365f393ec208d7fafcf230
c00af60d13c361006de9391767271e33b7602efa1d8c84753ae5175b05d036602bd2a3b7bbc38e5e8fce8c54faaa26c92e642ab7f9e6f6f475a6a4cf3c82316e
2 changes: 1 addition & 1 deletion releases/repos/org/team4201/Codex-java/maven-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<versions>
<version>2025.0.1</version>
</versions>
<lastUpdated>20250120024059</lastUpdated>
<lastUpdated>20250120070014</lastUpdated>
</versioning>
</metadata>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b9624954b8c247fd4fb269715d167b6f
5da4e91acbc2df2ccc8dc608230ad3ae
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b5c3e63d64f27b664e7920a925ebdf4bb054103a
6b90b44fa2ccaaf408882519d9425d25f1579674
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9d34104c83e6011925efcc644d954b723ed60482fab4f6296fef7cca86f37b1a
fd5485a244ce6493342ceeadd0ddd8633ba48b2cac2dd0305fcfe4a40ef8ab0f
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e75ce4a7e74dfea0e1f5bb73926b395e025c0551e352e617f0aec137efacef12a5f0873a3a1b5ec5aa71aa4de604a09af74d4ec9f4d26b516ded05b35e5622b8
7e063b74a2c2e02c294349a209e0a8bd2b0a11b5f717be29cd0c6eb7d8e81b0bda8309b9e9d1ec0be7d881b2844986141df869a083d3b45778253f7ac0346830
35 changes: 9 additions & 26 deletions src/main/java/org/team4201/codex/utils/TrajectoryUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ public TrajectoryUtils(SwerveSubsystem swerveDrive, RobotConfig robotConfig, PID
* Generate a PathPlanner Command to follow a named PathPlanner trajectory file.
*
* @param pathName The name of the PathPlanner Trajectory file to reference.
* @param maxSpeed The robot's max speed to obey (Overrides the setting in the PathPlanner trajectory file)
*
* @return Command
*/
public Command generatePPHolonomicCommand(String pathName, double maxSpeed) {
public Command generatePPHolonomicCommand(String pathName) {
try {
return generatePPHolonomicCommand(PathPlannerPath.fromPathFile(pathName), maxSpeed, false);
return generatePPHolonomicCommand(PathPlannerPath.fromPathFile(pathName), m_robotConfig, false);
} catch (Exception e) {
DriverStation.reportError("Could not load PathPlanner Path '" + pathName + "':" + e.getMessage(), e.getStackTrace());
return new WaitCommand(0);
Expand All @@ -62,14 +61,13 @@ public Command generatePPHolonomicCommand(String pathName, double maxSpeed) {
* Generate a PathPlanner Command to follow a named PathPlanner trajectory file.
*
* @param pathName The name of the PathPlanner Trajectory file to reference.
* @param maxSpeed The robot's max speed to obey (Overrides the setting in the PathPlanner trajectory file)
* @param manualFlip Option to manually flip the trajectory instead of using the robot's current {@link DriverStation.Alliance} color
*
* @return Command
*/
public Command generatePPHolonomicCommand(String pathName, double maxSpeed, boolean manualFlip) {
public Command generatePPHolonomicCommand(String pathName, boolean manualFlip) {
try {
return generatePPHolonomicCommand(PathPlannerPath.fromPathFile(pathName), maxSpeed, manualFlip);
return generatePPHolonomicCommand(PathPlannerPath.fromPathFile(pathName), m_robotConfig, manualFlip);
} catch (Exception e) {
DriverStation.reportError("Could not load PathPlanner Path '" + pathName + "':" + e.getMessage(), e.getStackTrace());
return new WaitCommand(0);
Expand All @@ -80,43 +78,28 @@ public Command generatePPHolonomicCommand(String pathName, double maxSpeed, bool
* Generate a PathPlanner Command to follow a named PathPlanner trajectory file.
*
* @param path The {@link PathPlannerPath} to follow.
* @param maxSpeed The robot's max speed to obey (Overrides the setting in the PathPlanner trajectory file)
* @param robotConfig The {@link RobotConfig} to use.
*
* @return Command
*/
public Command generatePPHolonomicCommand(PathPlannerPath path, double maxSpeed) {
public Command generatePPHolonomicCommand(PathPlannerPath path, RobotConfig robotConfig) {

return generatePPHolonomicCommand(path, maxSpeed, false);
return generatePPHolonomicCommand(path, robotConfig, false);
}

/**
* Generate a PathPlanner Command to follow a named PathPlanner trajectory file.
*
* @param path The {@link PathPlannerPath} to follow.
* @param maxSpeed The robot's max speed to obey (Overrides the setting in the PathPlanner trajectory file)
* @param robotConfig The {@link RobotConfig} to use
* @param flipPath Option to flip the trajectory around the field's center.
*
* @return Command
*/
public Command generatePPHolonomicCommand(
PathPlannerPath path,
double maxSpeed,
RobotConfig robotConfig,
boolean flipPath) {

RobotConfig robotConfig = m_robotConfig;
if (maxSpeed != 0) {
ModuleConfig moduleConfig =
new ModuleConfig(m_robotConfig.moduleConfig.wheelRadiusMeters,
maxSpeed,
m_robotConfig.moduleConfig.wheelCOF,
m_robotConfig.moduleConfig.driveMotor,
m_robotConfig.moduleConfig.driveCurrentLimit,
m_robotConfig.moduleConfig.
driveCurrentLimit,
1);
robotConfig = new RobotConfig(m_robotConfig.massKG, m_robotConfig.MOI, moduleConfig, m_robotConfig.moduleLocations);
}

return new FollowPathCommand(
path,
() -> m_swerveDrive.getState().Pose,
Expand Down

0 comments on commit 7eb1303

Please sign in to comment.