Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

gtsam.utilities.extractPoint2() doesn't work #841

Closed
dishank-b opened this issue Aug 10, 2021 · 6 comments · Fixed by #851
Closed

gtsam.utilities.extractPoint2() doesn't work #841

dishank-b opened this issue Aug 10, 2021 · 6 comments · Fixed by #851
Labels
bug Bug report

Comments

@dishank-b
Copy link

gtsam.utilities.extractPoint2(Values) return empty array, even if Values have Point2 variables.

Steps to reproduce

  1. initial = gtsam.Values()
  2. initial.insert(1, gtsam.Pose2(0.0, 0.1, 0.1)
  3. initial.insert(2, gtsam.Point2(0.0, 0.1))
  4. gtsam.utilities.extractPoint2(initial) returns array([], shape=(0, 2), dtype=float64)
  5. Where as gtsam.utilities.extractPose2(initial) return correctly which is array([[0. , 0.1, 0.1]])

Expted behavior of gtsam.utilities.extractPoint2(initial) is returning array([[0. , 0.1]])

@varunagrawal varunagrawal added the bug Bug report label Aug 12, 2021
@varunagrawal
Copy link
Collaborator

Valid bug. The issue is the underlying C++ function.

@varunagrawal
Copy link
Collaborator

Okay so did a bit of investigating and the underlying C++ function is correct (verified with a unit test).
The issue seems to be that the values.filter call expects a Point2 in C++ but that type info is not being relayed in Python. As a result, when I print out the filtered values in C++, it prints as empty.

I believe this is because Point2 is stored as an Eigen::Matrix21 but when converting from numpy to Eigen, Pybind changes the type to Eigen::Matrix<double, -1, -1> and thus the filter no longer works.

@dishank-b
Copy link
Author

So what can be done about this? Do you know any alternative way to filter out Point2 type from Values() ?

@varunagrawal
Copy link
Collaborator

Already on it. Will make the PR in about 30 minutes.

@dishank-b
Copy link
Author

How do I get the fixed version? Will I have to pull and install again?

@varunagrawal
Copy link
Collaborator

Yup. git pull origin develop should get you the latest fixes.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants