NeRF-SLAM: Build problem about gtsam

When I run the command “cmake --build build_gtsam --config RelWithDebInfo -j”, it gave an error as follows. Could you please help me to fix it? Thanks.

Traceback (most recent call last): File "/home/jiangcx/Documents/Nerf_related/NeRF-SLAM/thirdparty/gtsam/wrap/scripts/pybind_wrap.py", line 94, in <module> main() File "/home/jiangcx/Documents/Nerf_related/NeRF-SLAM/thirdparty/gtsam/wrap/scripts/pybind_wrap.py", line 90, in main wrapper.wrap(sources, args.out) File "/home/jiangcx/Documents/Nerf_related/NeRF-SLAM/thirdparty/gtsam/wrap/gtwrap/pybind_wrapper.py", line 723, in wrap submodules=submodules) File "/home/jiangcx/Documents/Nerf_related/NeRF-SLAM/thirdparty/gtsam/wrap/gtwrap/pybind_wrapper.py", line 624, in wrap_file module = parser.Module.parseString(content) File "/home/jiangcx/Documents/Nerf_related/NeRF-SLAM/thirdparty/gtsam/wrap/gtwrap/interface_parser/module.py", line 56, in parseString return Module.rule.parseString(s)[0] File "/opt/ros/noetic/lib/python3/dist-packages/pyparsing/core.py", line 1141, in parse_string raise exc.with_traceback(None) pyparsing.exceptions.ParseException: Expected string_end, found 'namespace' (at char 1249), (line:46, col:1) make[2]: *** [python/CMakeFiles/pybind_wrap_gtsam_unstable.dir/build.make:76: python/gtsam_unstable.cpp] Error 1 make[1]: *** [CMakeFiles/Makefile2:32620: python/CMakeFiles/pybind_wrap_gtsam_unstable.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 27 (1 by maintainers)

Most upvoted comments

@phamquandung Then, another error:

File “/home/user/research/NeRF-SLAM/./examples/…/slam/visual_frontends/visual_frontend.py”, line 48, in gtsam_pose_to_torch q = pose.rotation().quaternion() AttributeError: ‘gtsam.gtsam.Rot3’ object has no attribute ‘quaternion’

That line and the following return statement should be replaced like this

    q = pose.rotation().toQuaternion()
    return torch.tensor([t[0], t[1], t[2], q.x(), q.y(), q.z(), q.w()], device=device, dtype=dtype)

You may change const std::vector<const gtsam::Matrix&>& to const std::vector<gtsam::Matrix>& use & as pointer is not proper define of std::vector

Then, another error:

File “/home/user/research/NeRF-SLAM/./examples/…/slam/visual_frontends/visual_frontend.py”, line 48, in gtsam_pose_to_torch q = pose.rotation().quaternion() AttributeError: ‘gtsam.gtsam.Rot3’ object has no attribute ‘quaternion’

try “git clone https://github.com/ToniRV/gtsam-1” then cmake it!

When I run the command “cmake --build build_gtsam --config RelWithDebInfo -j”, it gave an error as follows. Could you please help me to fix it? Thanks.

Traceback (most recent call last): File "/home/jiangcx/Documents/Nerf_related/NeRF-SLAM/thirdparty/gtsam/wrap/scripts/pybind_wrap.py", line 94, in <module> main() File "/home/jiangcx/Documents/Nerf_related/NeRF-SLAM/thirdparty/gtsam/wrap/scripts/pybind_wrap.py", line 90, in main wrapper.wrap(sources, args.out) File "/home/jiangcx/Documents/Nerf_related/NeRF-SLAM/thirdparty/gtsam/wrap/gtwrap/pybind_wrapper.py", line 723, in wrap submodules=submodules) File "/home/jiangcx/Documents/Nerf_related/NeRF-SLAM/thirdparty/gtsam/wrap/gtwrap/pybind_wrapper.py", line 624, in wrap_file module = parser.Module.parseString(content) File "/home/jiangcx/Documents/Nerf_related/NeRF-SLAM/thirdparty/gtsam/wrap/gtwrap/interface_parser/module.py", line 56, in parseString return Module.rule.parseString(s)[0] File "/opt/ros/noetic/lib/python3/dist-packages/pyparsing/core.py", line 1141, in parse_string raise exc.with_traceback(None) pyparsing.exceptions.ParseException: Expected string_end, found 'namespace' (at char 1249), (line:46, col:1) make[2]: *** [python/CMakeFiles/pybind_wrap_gtsam_unstable.dir/build.make:76: python/gtsam_unstable.cpp] Error 1 make[1]: *** [CMakeFiles/Makefile2:32620: python/CMakeFiles/pybind_wrap_gtsam_unstable.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs....

thirdparty/gtsam/gtsam_unstable/gtsam_unstable.i 815,1: virtual class LinearizedHessianFactor : gtsam::LinearizedGaussianFactor { 这个类结尾 少了两个字符 }; ,加上即可

Using the branch feature/nerf_slam https://github.com/ToniRV/gtsam-1/tree/feature/nerf_slam I found that there is a syntax error in gtsam_unstable/gtsam_unstable.i causing a parsing error: virtual class LinearizedHessianFactor : gtsam::LinearizedGaussianFactor { Needs to be closed 2 lines below (line 818) with };.

EDIT: the author has fixed it and the feature/nerf_slam branch of gtsam should be ok now.

Maybe you installed gtsam to another python environment?

Also, I made a bunch the changes to adopt to new gtsam in this PR, in case it helps: https://github.com/ToniRV/NeRF-SLAM/issues/12

@phamquandung Okay, still hung up here. I moved the gtsam you specified above and built it per instructions. However… when I run I get:

File “/home/pg/repos/NeRF-SLAM/./examples/…/slam/vio_slam.py”, line 65, in initial_state naive_pose = gtsam.Pose3.identity() AttributeError: type object ‘gtsam.gtsam.Pose3’ has no attribute ‘identity’

Thoughts?

I think it’s a problem of gtsam version. According to https://github.com/borglab/gtsam/issues/1298, identity() was replaced to Identity() (UpperCase)