[wpimath] Move DrakeJNI to edu.wpi.first.math.WPIMathJNI

This commit is contained in:
Peter Johnson
2020-08-07 09:38:13 -07:00
parent 42993b15c6
commit 8dc3d23831
6 changed files with 17 additions and 15 deletions

View File

@@ -4,7 +4,7 @@ include(SubDirList)
include(CompileWarnings)
include(AddTest)
file(GLOB wpimath_jni_src src/main/native/cpp/jni/DrakeJNI.cpp)
file(GLOB wpimath_jni_src src/main/native/cpp/jni/WPIMathJNI.cpp)
# Java bindings
if (NOT WITHOUT_JAVA)

View File

@@ -5,10 +5,12 @@
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpiutil.math;
package edu.wpi.first.math;
import org.ejml.simple.SimpleMatrix;
import edu.wpi.first.wpiutil.math.Matrix;
public final class Drake {
private Drake() {
}
@@ -29,7 +31,7 @@ public final class Drake {
SimpleMatrix Q,
SimpleMatrix R) {
var S = new SimpleMatrix(A.numRows(), A.numCols());
DrakeJNI.discreteAlgebraicRiccatiEquation(A.getDDRM().getData(), B.getDDRM().getData(),
WPIMathJNI.discreteAlgebraicRiccatiEquation(A.getDDRM().getData(), B.getDDRM().getData(),
Q.getDDRM().getData(), R.getDDRM().getData(), A.numCols(), B.numCols(),
S.getDDRM().getData());
return S;

View File

@@ -5,22 +5,22 @@
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpiutil.math;
package edu.wpi.first.math;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import edu.wpi.first.wpiutil.RuntimeLoader;
public final class DrakeJNI {
public final class WPIMathJNI {
static boolean libraryLoaded = false;
static RuntimeLoader<DrakeJNI> loader = null;
static RuntimeLoader<WPIMathJNI> loader = null;
static {
if (Helper.getExtractOnStaticLoad()) {
try {
loader = new RuntimeLoader<>("wpimathjni", RuntimeLoader.getDefaultExtractionRoot(),
DrakeJNI.class);
WPIMathJNI.class);
loader.loadLibrary();
} catch (IOException ex) {
ex.printStackTrace();
@@ -40,7 +40,7 @@ public final class DrakeJNI {
return;
}
loader = new RuntimeLoader<>("wpimathjni", RuntimeLoader.getDefaultExtractionRoot(),
DrakeJNI.class);
WPIMathJNI.class);
loader.loadLibrary();
libraryLoaded = true;
}

View File

@@ -12,19 +12,19 @@
#include <wpi/jni_util.h>
#include "drake/math/discrete_algebraic_riccati_equation.h"
#include "edu_wpi_first_wpiutil_math_DrakeJNI.h"
#include "edu_wpi_first_math_WPIMathJNI.h"
using namespace wpi::java;
extern "C" {
/*
* Class: edu_wpi_first_wpiutil_math_DrakeJNI
* Class: edu_wpi_first_math_WPIMathJNI
* Method: discreteAlgebraicRiccatiEquation
* Signature: ([D[D[D[DII[D)V
*/
JNIEXPORT void JNICALL
Java_edu_wpi_first_wpiutil_math_DrakeJNI_discreteAlgebraicRiccatiEquation
Java_edu_wpi_first_math_WPIMathJNI_discreteAlgebraicRiccatiEquation
(JNIEnv* env, jclass, jdoubleArray A, jdoubleArray B, jdoubleArray Q,
jdoubleArray R, jint states, jint inputs, jdoubleArray S)
{

View File

@@ -5,7 +5,7 @@
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpiutil.math;
package edu.wpi.first.math;
import org.ejml.simple.SimpleMatrix;
import org.junit.jupiter.api.Test;

View File

@@ -5,15 +5,15 @@
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpiutil.math;
package edu.wpi.first.math;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
public class DrakeJNITest {
public class WPIMathJNITest {
@Test
public void testLink() {
assertDoesNotThrow(DrakeJNI::forceLoad);
assertDoesNotThrow(WPIMathJNI::forceLoad);
}
}