java FFM wrapper?

49 views
Skip to first unread message

Joel Truher

unread,
Mar 19, 2026, 10:50:16 AMMar 19
to gtsam users
Hi everybody,

This summer I'll be attempting a GTSAM wrapper using Java FFM, so that my Java-aware students can use it.  Has anyone else tried that?

Joel

Joel Truher

unread,
Apr 11, 2026, 12:30:23 AMApr 11
to gtsam users
Summer came early, I guess.  Please see:


for an implementation, including CustomFactor implemented in Java.  This is partial coverage of GTSAM: enough to do the FRC localization use case.

It's an interface based on C heap allocation with Java-managed pointers, and deletion using the Java Cleaner.  So it doesn't really make any use of the FFM "Arena" notion (there's just one), instead it manages C objects similarly to std::unique_ptr.

I'd appreciate any feedback or suggestions.

Dellaert, Frank

unread,
Apr 11, 2026, 10:26:56 AMApr 11
to Joel Truher, gtsam users
Wow, Joel, that’s awesome !
Frank

--
You received this message because you are subscribed to the Google Groups "gtsam users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gtsam-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/gtsam-users/83ad6cf5-6c49-4704-a02e-2a4e009ca22en%40googlegroups.com.

Joel Truher

unread,
Apr 13, 2026, 1:28:04 PMApr 13
to gtsam users
Thanks!  I have two specific questions, if you have a moment.

* Do you have any advice on memory management patterns?  It looks like GTSAM code generally uses copies or shared pointers for function arguments, so it seems safe to delete the temporaries, and I make copies (or perhaps RVO heap-allocations) of return values, so those are also safe to delete immediately.  Am I seeing all there is to see there?  How do python/matlab do it?

* I have the whole thing cross-compiled and running on the new-for-2027 FRC control (a Raspberry Pi 5 compute module on an I/O board).  There's a somewhat-standard method of packaging, so that students can install it as a sort of "library" within the WPILib robot-code workflow for deployment and also desktop simulations, etc.  The simplest approach to that would be including GTSAM as a git submodule (say, pinned to 4.3a1 at the moment), and running the cmake job as part of the packaging step. There are a few other examples of similar submodule packaging in the wild (e.g. Jan Czarnowski's DeepFactors).  Does that seem like a good approach?  What do other folks do for packaging?

Thanks again

Joel

Dellaert, Frank

unread,
Apr 13, 2026, 1:55:19 PMApr 13
to Joel Truher, gtsam users
Python wrapper uses shared pointers and passes those around. It's been a while since I looked at the internals of that, but maybe Fan or Varun can give more details here. You can also examine the source code with Claude or Codex as your sidekick 😊

That code lives in a separate repo here: https://github.com/borglab/wrap

On the second point, I have no useful information to share. 

Best
FD

Joel Truher

unread,
Apr 13, 2026, 2:09:41 PMApr 13
to gtsam users
ahhh, thank you.  https://github.com/borglab/wrap/blob/master/DOCS.md seems like a good guide.
Reply all
Reply to author
Forward
0 new messages