songuke / dvo_slam

A fork of DVO SLAM to build on Linux Mint
17 stars 12 forks source link

error in compiling g2o #1

Open YuQingL opened 7 years ago

YuQingL commented 7 years ago

Hi songuke, Sorry to bother. I already tried your dvo_slam from there. I had a few issues compiling it. When building "g2o", "git checkout 67d5fa7", appear mistakes: coutinho@coutinho-desktop:~/g2o$ git checkout 67d5fa7 fatal: Not a git repository (or any parent up to mount point /home) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I overlooked the mistakes,execute the following code in sequence,when I perform "catkin make --pkg dvo_benchmark -DCMAKE_BUILD_TYPE=Release",there are errors: Base path: /home/coutinho/dvo_slam Source space: /home/coutinho/dvo_slam/src Build space: /home/coutinho/dvo_slam/build Devel space: /home/coutinho/dvo_slam/devel Install space: /home/coutinho/dvo_slam/install

Running command: "make cmake_check_build_system" in "/home/coutinho/dvo_slam/build"

Running command: "make -j4 -l4" in "/home/coutinho/dvo_slam/build/dvo_benchmark"

[ 5%] Built target dvo_slam_gencfg [ 43%] Built target dvo_core [ 48%] Built target dvo_visualization [ 56%] Built target dvo_ros [ 97%] Built target dvo_slam Linking CXX executable /home/coutinho/dvo_slam/devel/lib/dvo_benchmark/benchmark /home/coutinho/dvo_slam/devel/lib/libdvo_slam.a(keyframe_graph.cpp.o):in the function ‘dvo_slam::Timestamped::~Timestamped()’: keyframe_graph.cpp:(.text._ZN8dvo_slam11TimestampedD2Ev[_ZN8dvo_slam11TimestampedD5Ev]+0x8):‘g2o::OptimizableGraph::Data::~Data()’ undefined reference to it. /home/coutinho/dvo_slam/devel/lib/libdvo_slam.a(keyframe_graph.cpp.o):in the function ‘dvo_slam::Timestamped::~Timestamped()’: keyframe_graph.cpp:(.text._ZN8dvo_slam11TimestampedD0Ev[_ZN8dvo_slam11TimestampedD0Ev]+0xc):‘g2o::OptimizableGraph::Data::~Data()’undefined reference to it. /home/coutinho/dvo_slam/devel/lib/libdvo_slam.a(keyframe_graph.cpp.o):in the function ‘dvo_slam::internal::KeyframeGraphImpl::insertNewKeyframe(boost::shared_ptr const&)’: keyframe_graph.cpp:(.text._ZN8dvo_slam8internal17KeyframeGraphImpl17insertNewKeyframeERKN5boost10shared_ptrINS_8LocalMapEEE[_ZN8dvo_slam8internal17KeyframeGraphImpl17insertNewKeyframeERKN5boost10shared_ptrINS_8LocalMapEEE]+0x63c):‘g2o::OptimizableGraph::Data::Data()’ undefined reference to it. /home/coutinho/dvo_slam/devel/lib/libdvo_slam.a(keyframe_graph.cpp.o):(.rodata._ZTIN8dvo_slam11TimestampedE[_ZTIN8dvo_slam11TimestampedE]+0x10):‘typeinfo for g2o::OptimizableGraph::Data’ undefined reference to it. /home/coutinho/dvo_slam/devel/lib/libdvo_slam.a(local_map.cpp.o):in the function ‘dvo_slam::LocalMap::addFrame(boost::shared_ptr const&)’: local_map.cpp:(.text+0x2563):‘g2o::OptimizableGraph::Data::Data()’ undefined reference to it. /home/coutinho/dvo_slam/devel/lib/libdvo_slam.a(local_map.cpp.o):in the function ‘dvo_slam::LocalMap::LocalMap(boost::shared_ptr const&, Eigen::Transform<double, 3, 2, 0> const&)’: local_map.cpp:(.text+0x330e):‘g2o::OptimizableGraph::Data::Data()’ undefined reference to it. /home/coutinho/dvo_slam/devel/lib/libdvo_slam.a(local_map.cpp.o):in the function ‘dvo_slam::LocalMap::create(boost::shared_ptr const&, Eigen::Transform<double, 3, 2, 0> const&)’: local_map.cpp:(.text+0x39b8):‘g2o::OptimizableGraph::Data::Data()’ undefined reference to it. /home/coutinho/dvo_slam/devel/lib/libdvo_slam.a(map_serializer.cpp.o):in the function ‘dvo_slam::serialization::TrajectorySerializer::serialize(dvo_slam::KeyframeGraph const&)’: map_serializer.cpp:(.text+0x39c):‘typeinfo for g2o::OptimizableGraph::Data’ undefined reference to it. collect2: error: ld returned 1 exit status make[2]: [/home/coutinho/dvo_slam/devel/lib/dvo_benchmark/benchmark] error1 make[1]: [dvo_benchmark/CMakeFiles/benchmark.dir/all] error2 make: *** [all] errors 2 Invoking "make -j4 -l4" failed

My OS is Ubuntu 14.04 with ROS Indigo. Can you help me? thanks a lot~

songuke commented 7 years ago

@YuQingL Did you checkout the g2o version 67d5fa7 as in the README.md?

git clone https://github.com/RainerKuemmerle/g2o.git
cd g2o
git checkout 67d5fa7
mkdir build
cd build
cmake .. -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_LGPL_SHARED_LIBS:BOOL=OFF -DG2O_BUILD_APPS:BOOL=OFF -DG2O_BUILD_EXAMPLES:BOOL=OFF
make
sudo make install

Because from your log the undefined reference seems to related to g2o.

YuQingL commented 7 years ago

@songuke
Thank you Songuke!! When I git checkout 67d5fa7 as in the README.md, the following error occurs: coutinho@coutinho-desktop:~/g2o$ git checkout 67d5fa7 fatal: Not a git repository (or any parent up to mount point /home) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I was looking for solutions on Google,but I did not fix it. Any idea?, really thanks for suggestion.

songuke commented 7 years ago

Did you execute git clone before checkout?

And is your g2o folder symlinked or mounted from somewhere?

You can try going to other folder and git clone and see if the same error happens.

2016-11-13 15:20 GMT+07:00 YuQingL notifications@github.com:

@songuke https://github.com/songuke

Thank you Songuke!! When I git checkout 67d5fa7 as in the README.md, the following error occurs: coutinho@coutinho-desktop:~/g2o$ git checkout 67d5fa7 fatal: Not a git repository (or any parent up to mount point /home) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I was looking for solutions on Google,but I did not fix it. Any idea?, really thanks for suggestion.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/songuke/dvo_slam/issues/1#issuecomment-260172881, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIXshVaads8adX142mF6UuJ5mCTW7fYks5q9shBgaJpZM4KvyV5 .

YuQingL commented 7 years ago

@songuke I had executed git clone before checkout.

Thanks for all the suggestions to fix the issues. It works for me. Follow your advice,I delete g2o, and then recompile g2o as in the README.md. Now,I finally compiled the code successfully.

YuQingL commented 7 years ago

@songuke Used TUM RGB-D benchmark, I can see right point clouds and camera positions in rviz.

I Installed Kinect v2 driver according to https://github.com/code-iai/iai_kinect2. I changed the code and then stored the 640*480 resolution of color and depth images, when connected to the hand-hold kinectv2. Used these pictures, I see wrong phenomenon in rviz after runing dvo_slam. In the rivz window, the point clouds is bad and very vague. I don't know why. Is the picture that I use the hand-hold kinect v2 to create not compatible with dvo_slam? When shooting objects,dose it have to follow a certain rule?

Can you help me? thanks a lot~

songuke commented 7 years ago

@YuQingL First I think Kinect v2 is not 640x480. Did you rescale the images? If you rescale, you have to change the focal length and center of projection properly in DVO SLAM code. For example, in dvo_benchmark/src/benchmark_slam.cpp, line 385, you can see the existing intrinsic parameters that are set for Kinect v1 and Asus Xtion. I guess you have to change them to fit Kinect v2.

In my project I used 512x424 resolution for Kinect v2 input, and the focal length and center of projection is set to fx 356.769928 fy 430.816498 cx 251.5171815 cy 237.563446

I think you can try 512x424 resolution and use the above parameters.

YuQingL commented 7 years ago

@songuke Thank you for your suggestion!

Yes,I rescale the images. First I produced the 960x540 resolution of images, according to https://github.com/code-iai/iai_kinect2. Then these images are croped to the 640x480 resolution with opencv.

In addition,except change focal length and center of projection ,which other parts need to be modified in roder to fit Kinect v2? What information and reference I need to see? If I want to figure out the codes,how to get it? There are some steps?

songuke commented 7 years ago

I think setting proper image sizes and intrinsic parameters will work. You can try that and see if you get reasonable reconstruction.

Note that rescaling and cropping are two different operators. Rescaling changes the focal length and center of projection, while cropping only changes the center of projection.

2016-12-15 22:41 GMT+08:00 YuQingL notifications@github.com:

@songuke https://github.com/songuke Thank you for your suggestion!

Yes,I rescale the images. First I produced the 960540 resolution of images, according to https://github.com/code-iai/iai_kinect2 https://github.com/code-iai/iai_kinect2. Then these images are croped to the 640480 resolution with opencv.

In addition,except change focal length and center of projection ,which other parts need to be modified in roder to fit Kinect v2? What information and reference I need to see? If I want to figure out the codes,how to get it? There are some steps?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/songuke/dvo_slam/issues/1#issuecomment-267343626, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIXsgUIVCd0sgHeF9KV3LFgCmILDWy4ks5rIVG3gaJpZM4KvyV5 .