Closed catproof closed 1 year ago
OK, please help us solve this? What I would do to track down is is (a) break a debugger on the exception to see the actual reason, (b) look at the call-stack to set a breakpoint before it happens, examine what's going on.
Hi @dellaert do you have steps for setting up a debug environment? I am a bit of a C++ noob. See this google conversation. I'm trying to figure out how to debug one of the example files I modified.
I know how to setup debugging for very simple C++ programs, but am struggling to do it with the example files in GTSAM as they are a part of a larger build process.
I do this in VS Code, with lldb.
@NickPerezCarletonUniversity I think that the issue is that your problem is ill-defined, and that breaks iSAM. A simple check that I usually do is thinking of the problem like a linear system:
Pose3
unknowns, each one is 6DoF -> so we can think of it as if you have 12 unknownsIn summary, you have 12 unknowns but 9 equations, so the system is ill-defined, and that's a potential issue with iSAM. However, it should also break a batch optimization with Gauss Newton or DogLeg instead of Levenberg Marquardt. The reason why LM works anyways is because the damping factor you add when you are solving the normal equations improves the conditioning of the system (you can imagine it as setting the value of the unconstrained unknowns as the same initial value as you gave, so you get "3 extra equations" to match your 12 unknowns) but that doesn't solve the core issue in your formulation.
I also noticed that you added a GPS factor (the commented part), but that probably doesn't help either. The reason is that both the GPS factor and the Unary factor are a function of the position variables, not the orientation ones. So you get redundancy in equations to constrain the position unknowns, but you are still missing equations to solve for the orientation.
If you want to try again with iSAM, you can try adding a Pose3 prior to the second pose, with a large covariance, so it doesn't affect the contribution of the other factors but still ensures that all the variables are constrained. I hope it helps.
hi @mmattamala thank you for your insight. You are correct, it seems that I don't specify the orientation of the robot at any point.
I tried doing batch optimization using Gauss Newton and Dogleg optimizers. Contrary to what you said, it still works (despite in fact being underconstrained).
I am still able to get iSAM2 to work without specifying the orientation of the robot. See this google conversation. I needed to solve the first 100 poses with batch optimization, then if I switch to iSAM2 after that point onwards, I no longer get the error.
I also tried adding a prior (like you mentioned) to get iSAM2 to work, and indeed that also resolves the issue without needing to do any batch optimization.
@NickPerezCarletonUniversity if this is resolved, can you please close this issue?
I made a very simple factor graph that can be solved with a batch optimization via Levenberg-Marquardt. However, when I try solving it using iSAM2, I get the Indeterminant Linear System Exception. Here is my code:
It looks like this is an issue with how iSAM2 solves small graphs... other people have had this issue
In my code you can toggle the "use_isam" bool to see for yourself that the batch optimization works, but iSAM2 doesn't. Also, I tried toggling QR factorization as well as the dogleg vs gauss newton optimizers as suggested by others (here and here). This seemed to have no effect.