minisam icon indicating copy to clipboard operation
minisam copied to clipboard

Iterator over Variables and FactorGraph in Python

Open itzsid opened this issue 5 years ago • 1 comments

Hi Jing/Zhaoyang,

Great work with the library especially the Python wrapper. I was playing with it and I was not able to iterate over Variables. I could iterate over FactorGraph but I was not able to extract anything out of each factor.

I tried iterating like this:

 for key in initials:
     print(key)

And I get an error:

Traceback (most recent call last):
  File "gps_factor_example.py", line 109, in <module>
    for key in initials:
KeyError: '[python::Variables] key does not exist'

Wondering if I am doing something wrong or this is not supported yet.

itzsid avatar Dec 16 '19 05:12 itzsid

Hi Sidd @itzsid ! I don't think the key iterator is implemented now. I will have a look, and if you want to have a look ahead, the location of the python binding of Variables is at python/minisam_wrapper/variables.cpp, which needs some pybind11 knowledge to understand :)

dongjing3309 avatar Jan 21 '20 07:01 dongjing3309