-
Notifications
You must be signed in to change notification settings - Fork 671
[wpimath] Add Sleipnir Java bindings #8236
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
base: 2027
Are you sure you want to change the base?
[wpimath] Add Sleipnir Java bindings #8236
Conversation
7e667cd to
9749bdc
Compare
4fa1899 to
db70c2c
Compare
41dccd2 to
ef6b153
Compare
| public VariableMatrix(int rows) { | ||
| this(rows, 1); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better as a static, named factory like VariableMatrix.columnVector(int rows)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent was to be consistent with the EJML matrix API, in the same way the C++ API mirrors Eigen.
wpimath/src/main/java/org/wpilib/math/autodiff/VariableMatrix.java
Outdated
Show resolved
Hide resolved
wpimath/src/main/java/org/wpilib/math/autodiff/VariableMatrix.java
Outdated
Show resolved
Hide resolved
7021ce3 to
e8a15e7
Compare
e8a15e7 to
3cde4f4
Compare
|
One big problem this PR still needs solved is how to track the Variables created by intermediate expressions, and how to ensure their native handles are freed in a timely manner so the JVM doesn't OOM. try-with-resources isn't applicable to those, and Cleaners aren't guaranteed to run since the JVM doesn't know how much space native objects take up. The only thing I could think of was a factory object, whether that's |
4067405 to
2332858
Compare
2332858 to
dca5749
Compare
The wrapper includes reverse mode autodiff, the Problem DSL, and the optimal control problem API. I wrote it by directly translating the upstream API and tests to Java (i.e., copy-paste-modify).
I replaced the ArmFeedforward and Ellipse2d JNIs with implementations using the Sleipnir Java bindings. Switching dev binary JNIs to release by default sped up wpimath test runs from several minutes to 7 seconds.