Permalink
Browse files

Add Schur-complement for ScaViSLAM + changed build system slightly

  • Loading branch information...
1 parent ffece03 commit aed36188625117b12cf70e4b8a652e520706ebd0 @strasdat committed Aug 14, 2012
Showing with 69 additions and 81 deletions.
  1. +9 −32 CMakeLists.txt
  2. +29 −29 README
  3. +1 −1 data/newcollege.cfg
  4. +3 −3 scavislam/backend.cpp
  5. +16 −4 scavislam/slam_graph-impl.cpp
  6. +5 −4 scavislam/slam_graph.cpp
  7. +6 −8 scavislam/stereo_slam.cpp
View
@@ -56,38 +56,15 @@ ENDIF()
-SET (INCLUDE_DIRS "EXTERNAL/eigen3.1/"
- "EXTERNAL/opencv2/include/opencv"
- "EXTERNAL/opencv2/include/"
- "EXTERNAL/opencv2/modules/core/include"
- "EXTERNAL/opencv2/modules/imgproc/include"
- "EXTERNAL/opencv2/modules/video/include"
- "EXTERNAL/opencv2/modules/features2d/include"
- "EXTERNAL/opencv2/modules/flann/include"
- "EXTERNAL/opencv2/modules/objdetect/include"
- "EXTERNAL/opencv2/modules/photo/include"
- "EXTERNAL/opencv2/modules/nonfree/include"
- "EXTERNAL/opencv2/modules/calib3d/include"
- "EXTERNAL/opencv2/modules/ml/include"
- "EXTERNAL/opencv2/modules/highgui/include"
- "EXTERNAL/opencv2/modules/legacy/include"
- "EXTERNAL/opencv2/modules/contrib/include"
- "EXTERNAL/g2o/svs_build"
- "EXTERNAL/g2o/"
- "EXTERNAL/g2o/EXTERNAL/csparse/"
- "EXTERNAL/Pangolin/"
- "EXTERNAL/Pangolin/svs_build"
- "EXTERNAL/Sophus"
- "EXTERNAL/VisionTools")
-
-LIST(APPEND CMAKE_LIBRARY_PATH EXTERNAL/g2o/lib
- EXTERNAL/opencv2/svs_build/lib/
- EXTERNAL/Pangolin/svs_build/pangolin
- EXTERNAL/Sophus/svs_build/
- EXTERNAL/VisionTools/svs_build/)
-
-SET (LIB_NAMES GL pangolin glut g2o_stuff g2o_core g2o_solver_csparse
- VisionTools Sophus
+SET (INCLUDE_DIRS "EXTERNAL/include/"
+ "EXTERNAL/VisionTools"
+ "/usr/include/eigen3"
+ "/usr/include/suitesparse")
+
+LIST(APPEND CMAKE_LIBRARY_PATH EXTERNAL/VisionTools/svs_build/)
+
+SET (LIB_NAMES GL pangolin glut g2o_stuff g2o_core g2o_solver_csparse csparse
+ g2o_csparse_extension VisionTools Sophus
boost_system boost_thread boost_filesystem boost_regex
opencv_core opencv_features2d opencv_flann opencv_gpu
opencv_nonfree
View
58 README
@@ -58,11 +58,13 @@ Thus, there is an optional dependency on CUDA 4.1 or higher.
Next, install dependencies:
>>
-sudo apt-get install freeglut3-dev libglu-dev libglew-dev libboost-all-dev
+sudo apt-get install libeigen3-dev libsuitesparse-dev freeglut3-dev libglu-dev libglew-dev libboost-all-dev
<<
-(This is an incomplete list at the moment, since it is hard to guess which
- libraries are installed by default on your linux distribution...)
+Important: Make sure libsuitesparse-dev is installed before you install g2o.
+
+(If you use an older linux version, you might have to install eigen3 manually
+from: http://eigen.tuxfamily.org)
Now, checkout/clone the ScaViSLAM repository.
@@ -90,50 +92,43 @@ version conflicts (e.g. different OpenCV version which might be installed
system-wide). Please follow the guide step by step and only deviate form
it if you really know what you are doing ;-)
-Download Eigen (version 3.1) in folder EXTERNAL
-
->>
-wget http://bitbucket.org/eigen/eigen/get/3.1.0.tar.gz
-
-tar xvf 3.1.0.tar.gz
-mv eigen-eigen-ca142d0540d3 eigen3.1
-<<
-
-Check out and install g2o (fork with slightly modified cmake file):
+Check out and install g2o:
>>
git clone git://github.com/strasdat/g2o.git
cd g2o
mkdir svs_build
cd svs_build
-cmake ..
-make -j8
+cmake .. -DCMAKE_INSTALL_PREFIX:PATH=..
+make -j4
+make install
cd ../..
<<
-Download and install opencv (version 2.3.1a) inside EXTERNAL:
+Download and install opencv (version 2.4.2) inside EXTERNAL:
>>
wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.2/OpenCV-2.4.2.tar.bz2
tar xvf OpenCV-2.4.2.tar.bz2
-mv OpenCV-2.4.2 opencv2
-cd opencv2
+cd OpenCV-2.4.2
mkdir svs_build
cd svs_build
-cmake ..
-make -j8
+cmake .. -DCMAKE_INSTALL_PREFIX:PATH=../..
+make -j4
+make install
cd ../..
<<
-Clone and install Pangolin
+Clone and install Pangolin inside EXTERNAL
>>
git clone git://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir svs_build
cd svs_build
-cmake ..
-make -j8
+cmake .. -DCMAKE_INSTALL_PREFIX:PATH=.. -DBUILD_SHARED_LIBS=ON
+make -j4
+make install
cd ../..
<<
@@ -144,8 +139,9 @@ git clone git://github.com/strasdat/Sophus.git
cd Sophus
mkdir svs_build
cd svs_build
-cmake ..
-make -j8
+cmake .. -DCMAKE_INSTALL_PREFIX:PATH=..
+make -j4
+make install
cd ../..
<<
@@ -156,8 +152,8 @@ git clone git://github.com/strasdat/VisionTools.git
cd VisionTools
mkdir svs_build
cd svs_build
-cmake ..
-make -j8
+cmake .. -DCMAKE_PREFIX_PATH:PATH=..
+make -j4
<<
Move to main project folder "ScaViSLAM" and install ScaViSLAM:
@@ -166,8 +162,8 @@ Move to main project folder "ScaViSLAM" and install ScaViSLAM:
cd ../../../
mkdir svs_build
cd svs_build
-cmake ..
-make -j8
+cmake .. -DCMAKE_PREFIX_PATH:PATH=EXTERNAL/
+make -j4
<<
In case you would like to compile ScaViSLAM WITHOUT CUDA support,
@@ -190,6 +186,10 @@ cd ../svs_build
*** HOW TO USE A RGB-D CAMERA? ***
+First note, that the use of RGB-D cameras in ScaViSLAM is not very well tested and
+very experimental! (ScaViSLAM is well tested in stereo-camera mode on the New College
+seqeunce.)
+
At the moment, only RGB-D cameras following the PrimeSense reference design
(e.g. Ausus Xtion PRO LIVE) are supported.
First, you need to install PCL (which includes OpenNI):
View
@@ -4,7 +4,7 @@ cam.f = 389.956085;
cam.px = 254.903519 ;
cam.py = 201.899490;
cam.baseline = 0.120005;
-framepipe.skip_imgs = 0;//240;
+framepipe.skip_imgs = 0;//240
framepipe.mask_img = 0;
framepipe.disp_img = 0;
framepipe.right_img = 1;
View
@@ -184,7 +184,7 @@ ::operator()()
monitor.pushNeighborhood(neighborhood_ptr);
if (do_optimization)
- graph_.optimize(OptParams(1,true,3));
+ graph_.optimize(OptParams(2,true,3));
}
if (local_registration_stack.size()>0)
@@ -194,7 +194,7 @@ ::operator()()
if(localRegisterFrame(frame_id))
{
if(graph_.prepareForOptimization(frame_id,-1))
- graph_.optimize(OptParams(1,true,3));
+ graph_.optimize(OptParams(2,true,3));
}
}
@@ -214,7 +214,7 @@ ::operator()()
monitor.pushClosedLoop(loop);
if(graph_.prepareForOptimization(loop.query_keyframe_id,
loop.loop_keyframe_id))
- graph_.optimize(OptParams(1,true,3));
+ graph_.optimize(OptParams(2,true,3));
}
}
}
@@ -20,6 +20,8 @@
#include "stereo_camera.h"
#include "transformations.h"
+#include <g2o/core/robust_kernel_impl.h>
+
namespace ScaViSLAM
{
@@ -81,8 +83,11 @@ ::addObsToG2o(const Vector3d & obs,
e->setMeasurement(obs);
e->information() = Lambda;
- e->setRobustKernel(robustify);
- e->setHuberWidth(huber_kernel_width);
+ if (robustify)
+ {
+ g2o::RobustKernelHuber* rk = new g2o::RobustKernelHuber;
+ e->setRobustKernel(rk);
+ }
e->resizeParameters(1);
bool param_status = e->setParameterId(0, 0);
@@ -178,8 +183,15 @@ ::addObsToG2o(const Vector2d & obs,
e->inverseMeasurement() = -obs;
e->information() = Lambda;
- e->setRobustKernel(robustify);
- e->setHuberWidth(huber_kernel_width);
+ if (robustify)
+ {
+ g2o::RobustKernelHuber* rk = new g2o::RobustKernelHuber;
+ e->setRobustKernel(rk);
+ }
+
+ e->resizeParameters(1);
+ bool param_status = e->setParameterId(0, 0);
+ assert(param_status);
optimizer->addEdge(e);
}
View
@@ -914,6 +914,7 @@ ::addPointToG2o(const Vector3d & psi_anchor,
v_point->setId(g2o_point_id);
v_point->setEstimate(invert_depth(psi_anchor));
+ v_point->setMarginalized(true);
optimizer->addVertex(v_point);
}
@@ -1063,10 +1064,10 @@ ::setupG2o(G2oCameraParameters * g2o_cam,
g2o::SparseOptimizer * optimizer)
{
optimizer->setVerbose(true);
- typename g2o::BlockSolverX::LinearSolverType * linearSolver
- = SlamGraphMethods::allocateLinearSolver<g2o::BlockSolverX>();
- g2o::BlockSolverX * block_solver
- = new g2o::BlockSolverX(linearSolver);
+ typename g2o::BlockSolver_6_3::LinearSolverType * linearSolver
+ = SlamGraphMethods::allocateLinearSolver<g2o::BlockSolver_6_3>();
+ g2o::BlockSolver_6_3 * block_solver
+ = new g2o::BlockSolver_6_3(linearSolver);
g2o::OptimizationAlgorithmLevenberg * lm
= new g2o::OptimizationAlgorithmLevenberg(block_solver);
lm->setMaxTrialsAfterFailure(5);
View
@@ -441,20 +441,18 @@ void draw(int loop_id,
}
SE3 T_cur_from_world
= modules->frontend->T_cur_from_actkey()*T_actkey_from_world;
- const pangolin::OpenGlMatrixSpec & gl_projection =
- GET_MAP_ELEM((pangolin::OpenGlStack)(GL_PROJECTION),
- views->pangolin_cam.stacks);
- pangolin::OpenGlMatrixSpec gl_modelview =
- GET_MAP_ELEM((pangolin::OpenGlStack)(GL_MODELVIEW),
- views->pangolin_cam.stacks);
+ const pangolin::OpenGlMatrix & gl_projection =
+ views->pangolin_cam.GetProjectionMatrix();
+ pangolin::OpenGlMatrix gl_modelview =
+ views->pangolin_cam.GetModelViewMatrix();
Map<Matrix<double,4,4,ColMajor> > Map_gl_modelview(&gl_modelview.m[0]);
Map_gl_modelview
= Map_gl_modelview*T_cur_from_world.matrix();
pangolin::OpenGlRenderState r_state;
- r_state.Set(gl_projection);
- r_state.Set(gl_modelview);
+ r_state.SetProjectionMatrix(gl_projection);
+ r_state.SetModelViewMatrix(gl_modelview);
views->v3d->ActivateScissorAndClear(r_state);
glClearColor(1,1,1,0);
glEnable(GL_DEPTH_TEST);

0 comments on commit aed3618

Please sign in to comment.