Skip to content
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

terminate called after throwing an instance of 'gtsam::ValuesKeyDoesNotExist' #1746

Closed
JACKLiuDay opened this issue Apr 17, 2024 · 1 comment

Comments

@JACKLiuDay
Copy link

Hi, thank you for your great work about gtsam. I tried to use FixedLagSmootherExample.cpp for my own project. But it shows error after I run my ros bag. My gtsam is 4.0.3.
image
I set the lag to be 2s. But when the factor size runs to 2.x s, the program dies.

@JACKLiuDay
Copy link
Author

JACKLiuDay commented Apr 18, 2024

I just found something wrong with my code. If I use latestState = smootherBatch->calculateEstimate(currentKey);, the program runs without error. If I use latestState = smootherBatch->calculateEstimate(); there will be error gtsam::ValuesKeyDoseNotExist.

            fixsmoother->update(swGraph, swValues, newTimestamps);                                      // isam 更新状态
            // smootherBatch->update(swGraph, swValues, newTimestamps);
            for(size_t i = 1; i < 2; ++i)
            {
                fixsmoother->update();
            }

            pcl::PointXYZI thisPose3D;
            PointTypePose thisPose6D;
            Pose3 latestState;

            newTimestamps.clear();                                                                         
            swValues.clear();
            swGraph.resize(0);

            latestState = fixsmoother->calculateEstimate<Pose3>(currentKey);
            // latestState = fixsmoother->calculateEstimate<>();                                        // wrong!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant