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

GTSAM detect wrong data type with Point3 in *windows* #1693

Open
etamarlu opened this issue Dec 17, 2023 · 2 comments
Open

GTSAM detect wrong data type with Point3 in *windows* #1693

etamarlu opened this issue Dec 17, 2023 · 2 comments
Labels
windows Related to Windows

Comments

@etamarlu
Copy link
Contributor

etamarlu commented Dec 17, 2023

Description

I built GTSAM-develop with Matlab toolbox in windows (it required applying some patches from feedstock, but the same errors appears when I use their GTSAM 4.2 which they officially support)

when trying to insert a Vector to Values an error will appear when calling the solver (I tried ISAM2).

Exception from gtsam:
Attempting to retrieve value with key "v3", type stored in Values is class gtsam::GenericValue<class
Eigen::Matrix<double,-1,1,0,-1,1> > but requested type was class Eigen::Matrix<double,3,1,0,3,1>

I tracked it down to NonlinearFactor.h.h at lines 707 or 710, when calling

x.at<ValueTypes>(keys_[Indices])

For some reason there is a discrepancy between ValueType and the value type saved.

I found a workaround (suggested in other issues -using inserPoint3 and atPoint3) for both Point3 and Velocities values. But a robust solution would help, at least to know there is no hidden bug in out faulty compilation.

I found similar problems in the past, ie, 1, 2
I saw that a possible reason was the order of overloaded functions, but I couldn't find why it happens here.

Also, I know you don't fix windows issues anymore,
I would appreciate a general direction how to debug it myself.
This bug doesn't appear in Linux

Steps to reproduce

  1. download gtsam-develop
  2. from gtsam feedstock apply those patches: (1)fix-gtsam-export-4.2.0.patch (2)python-win (3) fix-gtsam-unstable-export-4.2.0 (4)fix-python-build-win (required to build 'release' version)
    • maybe not required, but - manually add to root CMakeList.txt file the equivalent of:
set(BOOST_ROOT "C:/Boost/boost_1_75_0")
link_directories("C:/Boost/boost_1_75_0/stage/lib")
  1. compile with msvp19 with ninja and CMake commands:
    -DGTSAM_INSTALL_MATLAB_TOOLBOX=ON -DGTSAM_BUILD_PYTHON=ON -DGTSAM_PYTHON_VERSION=3.11.1 -DGTSAM_WITH_TBB=OFF
  2. add install directory to the path
  3. run IMUKITTY example

to get it running properly - when inserting velocity values - replace "insert" with "insertPoint3", when reading velocity values replace "result.atVector" with "atVector.atPoint3"

Expected behavior

Environment

  1. windows 10
  2. matlab 23a
  3. python 3.11.1

Additional information

@ProfFan
Copy link
Collaborator

ProfFan commented Jan 2, 2024

This could be related to #1685, could you take a look? Thank you very much!

@varunagrawal varunagrawal added the windows Related to Windows label Jan 5, 2024
@talregev
Copy link
Contributor

Exception from gtsam:
Attempting to retrieve value with key "v3", type stored in Values is class gtsam::GenericValue<class
Eigen::Matrix<double,-1,1,0,-1,1> > but requested type was class Eigen::Matrix<double,3,1,0,3,1>

I have the exact problem when I compile the tests on windows, and fix it on my PR.
@etamarlu Can you try my PR if it work for you?

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

No branches or pull requests

4 participants