-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started JNI cursed bs crashes for now
Signed-off-by: Jade Turner <[email protected]>
- Loading branch information
1 parent
cd21f30
commit c456722
Showing
7 changed files
with
134 additions
and
6 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
7 changes: 7 additions & 0 deletions
7
src/main/java/org/curtinfrc/frc2025/auto/TrajectoryGenerator.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,7 @@ | ||
package org.curtinfrc.frc2025.auto; | ||
|
||
public class TrajectoryGenerator { | ||
public static void main(String... args) { | ||
TrajgenJNI.helloWorld(); | ||
} | ||
} |
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,17 @@ | ||
package org.curtinfrc.frc2025.auto; | ||
|
||
import edu.wpi.first.util.RuntimeLoader; | ||
import java.io.IOException; | ||
|
||
public class TrajgenJNI { | ||
static { | ||
try { | ||
RuntimeLoader.loadLibrary("TrajgenJNI"); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
System.exit(1); | ||
} | ||
} | ||
|
||
public static native void helloWorld(); | ||
} |
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,12 @@ | ||
#include "TrajectoryGeneration.h" | ||
#include "trajopt/SwerveTrajectoryGenerator.hpp" | ||
#include "trajopt/path/Path.hpp" | ||
#include <vector> | ||
|
||
trajopt::SwerveSolution trajgen::CreateInitialGuess(std::vector<trajopt::Waypoint> trajectory) { | ||
return trajopt::SwerveSolution{}; | ||
} | ||
|
||
trajopt::SwerveTrajectory trajgen::Generate(InputTrajectory trajectory) { | ||
return trajopt::SwerveTrajectory{}; | ||
} |
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,20 @@ | ||
#include <jni.h> | ||
#include <wpi/array.h> | ||
#include <wpi/jni_util.h> | ||
|
||
#include "fmt/base.h" | ||
#include "jni_md.h" | ||
|
||
extern "C" { | ||
/* | ||
* Class: frc_robot_jni_ShooterTrajoptJNI | ||
* Method: calculateTrajectory | ||
* Signature: ([D????)V | ||
*/ | ||
JNIEXPORT void JNICALL | ||
Java_org_curtinfrc_frc2025_auto_TrajgenJNI_helloWorld | ||
(JNIEnv* env, jclass) | ||
{ | ||
fmt::println("Hello world!"); | ||
} | ||
} // extern "C" |
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,16 @@ | ||
#pragma once | ||
|
||
#include "trajopt/SwerveTrajectoryGenerator.hpp" | ||
#include "trajopt/constraint/Constraint.hpp" | ||
#include "trajopt/path/Path.hpp" | ||
#include <vector> | ||
|
||
namespace trajgen { | ||
struct InputTrajectory { | ||
std::vector<trajopt::Waypoint> waypoints; | ||
std::vector<trajopt::Constraint> constraints; | ||
}; | ||
|
||
trajopt::SwerveSolution CreateInitialGuess(std::vector<trajopt::Waypoint> waypoints); | ||
trajopt::SwerveTrajectory Generate(InputTrajectory trajectory); | ||
} |