├── README.md ├── g2opy ├── .travis.yml ├── CMakeLists.txt ├── EXTERNAL │ ├── CMakeLists.txt │ ├── ceres │ │ ├── LICENSE │ │ ├── autodiff.h │ │ ├── eigen.h │ │ ├── fixed_array.h │ │ ├── fpclassify.h │ │ ├── jet.h │ │ ├── macros.h │ │ ├── manual_constructor.h │ │ └── variadic_evaluate.h │ ├── csparse │ │ ├── CMakeLists.txt │ │ ├── License.txt │ │ ├── README.txt │ │ ├── cs.h │ │ ├── cs_add.c │ │ ├── cs_amd.c │ │ ├── cs_api.h │ │ ├── cs_chol.c │ │ ├── cs_cholsol.c │ │ ├── cs_compress.c │ │ ├── cs_counts.c │ │ ├── cs_cumsum.c │ │ ├── cs_dfs.c │ │ ├── cs_dmperm.c │ │ ├── cs_droptol.c │ │ ├── cs_dropzeros.c │ │ ├── cs_dupl.c │ │ ├── cs_entry.c │ │ ├── cs_ereach.c │ │ ├── cs_etree.c │ │ ├── cs_fkeep.c │ │ ├── cs_gaxpy.c │ │ ├── cs_happly.c │ │ ├── cs_house.c │ │ ├── cs_ipvec.c │ │ ├── cs_leaf.c │ │ ├── cs_load.c │ │ ├── cs_lsolve.c │ │ ├── cs_ltsolve.c │ │ ├── cs_lu.c │ │ ├── cs_lusol.c │ │ ├── cs_malloc.c │ │ ├── cs_maxtrans.c │ │ ├── cs_multiply.c │ │ ├── cs_norm.c │ │ ├── cs_permute.c │ │ ├── cs_pinv.c │ │ ├── cs_post.c │ │ ├── cs_print.c │ │ ├── cs_pvec.c │ │ ├── cs_qr.c │ │ ├── cs_qrsol.c │ │ ├── cs_randperm.c │ │ ├── cs_reach.c │ │ ├── cs_scatter.c │ │ ├── cs_scc.c │ │ ├── cs_schol.c │ │ ├── cs_spsolve.c │ │ ├── cs_sqr.c │ │ ├── cs_symperm.c │ │ ├── cs_tdfs.c │ │ ├── cs_transpose.c │ │ ├── cs_updown.c │ │ ├── cs_usolve.c │ │ ├── cs_util.c │ │ ├── cs_utsolve.c │ │ └── lesser.txt │ ├── freeglut │ │ ├── CMakeLists.txt │ │ ├── COPYING │ │ ├── freeglut_font.cpp │ │ ├── freeglut_minimal.h │ │ ├── freeglut_stroke_mono_roman.cpp │ │ └── freeglut_stroke_roman.cpp │ └── pybind11 │ │ ├── .appveyor.yml │ │ ├── .gitmodules │ │ ├── .readthedocs.yml │ │ ├── .travis.yml │ │ ├── CMakeLists.txt │ │ ├── CONTRIBUTING.md │ │ ├── ISSUE_TEMPLATE.md │ │ ├── LICENSE │ │ ├── MANIFEST.in │ │ ├── README.md │ │ ├── docs │ │ ├── Doxyfile │ │ ├── _static │ │ │ └── theme_overrides.css │ │ ├── advanced │ │ │ ├── cast │ │ │ │ ├── chrono.rst │ │ │ │ ├── custom.rst │ │ │ │ ├── eigen.rst │ │ │ │ ├── functional.rst │ │ │ │ ├── index.rst │ │ │ │ ├── overview.rst │ │ │ │ ├── stl.rst │ │ │ │ └── strings.rst │ │ │ ├── classes.rst │ │ │ ├── embedding.rst │ │ │ ├── exceptions.rst │ │ │ ├── functions.rst │ │ │ ├── misc.rst │ │ │ ├── pycpp │ │ │ │ ├── index.rst │ │ │ │ ├── numpy.rst │ │ │ │ ├── object.rst │ │ │ │ └── utilities.rst │ │ │ └── smart_ptrs.rst │ │ ├── basics.rst │ │ ├── benchmark.py │ │ ├── benchmark.rst │ │ ├── changelog.rst │ │ ├── classes.rst │ │ ├── compiling.rst │ │ ├── conf.py │ │ ├── faq.rst │ │ ├── index.rst │ │ ├── intro.rst │ │ ├── limitations.rst │ │ ├── pybind11-logo.png │ │ ├── pybind11_vs_boost_python1.png │ │ ├── pybind11_vs_boost_python1.svg │ │ ├── pybind11_vs_boost_python2.png │ │ ├── pybind11_vs_boost_python2.svg │ │ ├── reference.rst │ │ ├── release.rst │ │ ├── requirements.txt │ │ └── upgrade.rst │ │ ├── include │ │ └── pybind11 │ │ │ ├── attr.h │ │ │ ├── buffer_info.h │ │ │ ├── cast.h │ │ │ ├── chrono.h │ │ │ ├── common.h │ │ │ ├── complex.h │ │ │ ├── detail │ │ │ ├── class.h │ │ │ ├── common.h │ │ │ ├── descr.h │ │ │ ├── init.h │ │ │ ├── internals.h │ │ │ └── typeid.h │ │ │ ├── eigen.h │ │ │ ├── embed.h │ │ │ ├── eval.h │ │ │ ├── functional.h │ │ │ ├── iostream.h │ │ │ ├── numpy.h │ │ │ ├── operators.h │ │ │ ├── options.h │ │ │ ├── pybind11.h │ │ │ ├── pytypes.h │ │ │ ├── stl.h │ │ │ └── stl_bind.h │ │ ├── pybind11 │ │ ├── __init__.py │ │ ├── __main__.py │ │ └── _version.py │ │ ├── setup.cfg │ │ ├── setup.py │ │ ├── tests │ │ ├── CMakeLists.txt │ │ ├── conftest.py │ │ ├── constructor_stats.h │ │ ├── local_bindings.h │ │ ├── object.h │ │ ├── pybind11_cross_module_tests.cpp │ │ ├── pybind11_tests.cpp │ │ ├── pybind11_tests.h │ │ ├── pytest.ini │ │ ├── test_buffers.cpp │ │ ├── test_buffers.py │ │ ├── test_builtin_casters.cpp │ │ ├── test_builtin_casters.py │ │ ├── test_call_policies.cpp │ │ ├── test_call_policies.py │ │ ├── test_callbacks.cpp │ │ ├── test_callbacks.py │ │ ├── test_chrono.cpp │ │ ├── test_chrono.py │ │ ├── test_class.cpp │ │ ├── test_class.py │ │ ├── test_cmake_build │ │ │ ├── CMakeLists.txt │ │ │ ├── embed.cpp │ │ │ ├── installed_embed │ │ │ │ └── CMakeLists.txt │ │ │ ├── installed_function │ │ │ │ └── CMakeLists.txt │ │ │ ├── installed_target │ │ │ │ └── CMakeLists.txt │ │ │ ├── main.cpp │ │ │ ├── subdirectory_embed │ │ │ │ └── CMakeLists.txt │ │ │ ├── subdirectory_function │ │ │ │ └── CMakeLists.txt │ │ │ ├── subdirectory_target │ │ │ │ └── CMakeLists.txt │ │ │ └── test.py │ │ ├── test_constants_and_functions.cpp │ │ ├── test_constants_and_functions.py │ │ ├── test_copy_move.cpp │ │ ├── test_copy_move.py │ │ ├── test_docstring_options.cpp │ │ ├── test_docstring_options.py │ │ ├── test_eigen.cpp │ │ ├── test_eigen.py │ │ ├── test_embed │ │ │ ├── CMakeLists.txt │ │ │ ├── catch.cpp │ │ │ ├── test_interpreter.cpp │ │ │ └── test_interpreter.py │ │ ├── test_enum.cpp │ │ ├── test_enum.py │ │ ├── test_eval.cpp │ │ ├── test_eval.py │ │ ├── test_eval_call.py │ │ ├── test_exceptions.cpp │ │ ├── test_exceptions.py │ │ ├── test_factory_constructors.cpp │ │ ├── test_factory_constructors.py │ │ ├── test_iostream.cpp │ │ ├── test_iostream.py │ │ ├── test_kwargs_and_defaults.cpp │ │ ├── test_kwargs_and_defaults.py │ │ ├── test_local_bindings.cpp │ │ ├── test_local_bindings.py │ │ ├── test_methods_and_attributes.cpp │ │ ├── test_methods_and_attributes.py │ │ ├── test_modules.cpp │ │ ├── test_modules.py │ │ ├── test_multiple_inheritance.cpp │ │ ├── test_multiple_inheritance.py │ │ ├── test_numpy_array.cpp │ │ ├── test_numpy_array.py │ │ ├── test_numpy_dtypes.cpp │ │ ├── test_numpy_dtypes.py │ │ ├── test_numpy_vectorize.cpp │ │ ├── test_numpy_vectorize.py │ │ ├── test_opaque_types.cpp │ │ ├── test_opaque_types.py │ │ ├── test_operator_overloading.cpp │ │ ├── test_operator_overloading.py │ │ ├── test_pickling.cpp │ │ ├── test_pickling.py │ │ ├── test_pytypes.cpp │ │ ├── test_pytypes.py │ │ ├── test_sequences_and_iterators.cpp │ │ ├── test_sequences_and_iterators.py │ │ ├── test_smart_ptr.cpp │ │ ├── test_smart_ptr.py │ │ ├── test_stl.cpp │ │ ├── test_stl.py │ │ ├── test_stl_binders.cpp │ │ ├── test_stl_binders.py │ │ ├── test_virtual_functions.cpp │ │ └── test_virtual_functions.py │ │ └── tools │ │ ├── FindCatch.cmake │ │ ├── FindEigen3.cmake │ │ ├── FindPythonLibsNew.cmake │ │ ├── check-style.sh │ │ ├── libsize.py │ │ ├── mkdoc.py │ │ ├── pybind11Config.cmake.in │ │ └── pybind11Tools.cmake ├── Makefile ├── README.md ├── appveyor.yml ├── cmake_modules │ ├── FindBLAS.cmake │ ├── FindCSparse.cmake │ ├── FindCholmod.cmake │ ├── FindEigen3.cmake │ ├── FindG2O.cmake │ ├── FindLAPACK.cmake │ ├── FindQGLViewer.cmake │ └── FindSuiteSparse.cmake ├── config.h.in ├── contrib │ ├── CMakeLists.txt │ ├── estimate_propagator │ │ ├── SmoothEstimatePropagator.cpp │ │ └── SmoothEstimatePropagator.hpp │ ├── sba_addons │ │ ├── types_stereo_sba.cpp │ │ └── types_stereo_sba.hpp │ └── vertigo │ │ ├── .Rhistory │ │ ├── CMakeLists.txt │ │ ├── README.md │ │ ├── cmake-modules │ │ ├── FindEigen3.cmake │ │ ├── FindG2O.cmake │ │ └── FindGTSAM.cmake │ │ ├── datasets │ │ ├── city10000 │ │ │ └── originalDataset │ │ │ │ ├── README │ │ │ │ └── city10000.g2o │ │ ├── generateDataset.py │ │ ├── intel │ │ │ └── originalDataset │ │ │ │ └── intel.g2o │ │ ├── manhattan │ │ │ ├── groundTruth │ │ │ │ ├── manhattanOlson3500_edges_groundTruth.dat │ │ │ │ └── manhattanOlson3500_nodes_groundTruth.dat │ │ │ └── originalDataset │ │ │ │ ├── Olson │ │ │ │ └── manhattanOlson3500.g2o │ │ │ │ └── g2o │ │ │ │ └── manhattanOlson3500.g2o │ │ ├── ring │ │ │ ├── groundTruth │ │ │ │ ├── edges.txt │ │ │ │ ├── poses.txt │ │ │ │ └── ring.g2o │ │ │ └── originalDataset │ │ │ │ └── ring.g2o │ │ ├── ringCity │ │ │ ├── groundTruth │ │ │ │ ├── edges.txt │ │ │ │ ├── poses.txt │ │ │ │ └── ringCity.g2o │ │ │ └── originalDataset │ │ │ │ └── ringCity.g2o │ │ └── sphere2500 │ │ │ └── originalDataset │ │ │ ├── README │ │ │ └── sphere2500.g2o │ │ ├── examples │ │ ├── CMakeLists.txt │ │ └── robustISAM2 │ │ │ ├── CMakeLists.txt │ │ │ ├── parseResults.py │ │ │ └── robustISAM2.cpp │ │ ├── include │ │ ├── g2o │ │ │ ├── edge_se2MaxMixture.h │ │ │ ├── edge_se2Switchable.h │ │ │ ├── edge_se3Switchable.h │ │ │ ├── edge_switchPrior.h │ │ │ └── vertex_switchLinear.h │ │ ├── gtsam2 │ │ │ ├── betweenFactorMaxMix.h │ │ │ ├── betweenFactorSwitchable.h │ │ │ ├── switchVariableLinear.h │ │ │ └── switchVariableSigmoid.h │ │ └── timer.h │ │ └── src │ │ ├── CMakeLists.txt │ │ ├── g2o │ │ ├── CMakeLists.txt │ │ ├── edge_se2MaxMixture.cpp │ │ ├── edge_se2Switchable.cpp │ │ ├── edge_se3Switchable.cpp │ │ ├── edge_switchPrior.cpp │ │ ├── types_g2o_robust.cpp │ │ └── vertex_switchLinear.cpp │ │ ├── gtsam2 │ │ ├── CMakeLists.txt │ │ └── betweenFactorSwitchable.cpp │ │ └── timer.cpp ├── doc │ ├── Makefile │ ├── README_IF_IT_WAS_WORKING_AND_IT_DOES_NOT.txt │ ├── doxygen │ │ ├── doxy.config │ │ └── readme.txt │ ├── g2o.pdf │ ├── g2o.tex │ ├── license-bsd.txt │ ├── license-gpl.txt │ ├── license-lgpl.txt │ ├── pics │ │ ├── classes.eps │ │ ├── classes.fig │ │ ├── classes.svg │ │ ├── hgraph.eps │ │ ├── hgraph.fig │ │ ├── slam.eps │ │ ├── slam.fig │ │ ├── viewer.eps │ │ └── viewer.png │ └── robots.bib ├── g2o │ ├── CMakeLists.txt │ ├── apps │ │ ├── CMakeLists.txt │ │ ├── g2o_cli │ │ │ ├── CMakeLists.txt │ │ │ ├── dl_wrapper.cpp │ │ │ ├── dl_wrapper.h │ │ │ ├── g2o.cpp │ │ │ ├── g2o_cli_api.h │ │ │ ├── g2o_common.cpp │ │ │ ├── g2o_common.h │ │ │ ├── output_helper.cpp │ │ │ └── output_helper.h │ │ ├── g2o_hierarchical │ │ │ ├── CMakeLists.txt │ │ │ ├── backbone_tree_action.cpp │ │ │ ├── backbone_tree_action.h │ │ │ ├── edge_creator.cpp │ │ │ ├── edge_creator.h │ │ │ ├── edge_labeler.cpp │ │ │ ├── edge_labeler.h │ │ │ ├── edge_types_cost_function.cpp │ │ │ ├── edge_types_cost_function.h │ │ │ ├── g2o_hierarchical.cpp │ │ │ ├── g2o_hierarchical_api.h │ │ │ ├── g2o_hierarchical_test_functions.cpp │ │ │ ├── simple_star_ops.cpp │ │ │ ├── simple_star_ops.h │ │ │ ├── star.cpp │ │ │ └── star.h │ │ ├── g2o_simulator │ │ │ ├── CMakeLists.txt │ │ │ ├── convertSegmentLine.cpp │ │ │ ├── converteSegmentLine.cpp │ │ │ ├── g2o_anonymize_observations.cpp │ │ │ ├── g2o_simulator_api.h │ │ │ ├── pointsensorparameters.cpp │ │ │ ├── pointsensorparameters.h │ │ │ ├── sensor_line3d.cpp │ │ │ ├── sensor_line3d.h │ │ │ ├── sensor_odometry.h │ │ │ ├── sensor_odometry2d.cpp │ │ │ ├── sensor_odometry2d.h │ │ │ ├── sensor_odometry3d.cpp │ │ │ ├── sensor_odometry3d.h │ │ │ ├── sensor_pointxy.cpp │ │ │ ├── sensor_pointxy.h │ │ │ ├── sensor_pointxy_bearing.cpp │ │ │ ├── sensor_pointxy_bearing.h │ │ │ ├── sensor_pointxy_offset.cpp │ │ │ ├── sensor_pointxy_offset.h │ │ │ ├── sensor_pointxyz.cpp │ │ │ ├── sensor_pointxyz.h │ │ │ ├── sensor_pointxyz_depth.cpp │ │ │ ├── sensor_pointxyz_depth.h │ │ │ ├── sensor_pointxyz_disparity.cpp │ │ │ ├── sensor_pointxyz_disparity.h │ │ │ ├── sensor_pose2d.cpp │ │ │ ├── sensor_pose2d.h │ │ │ ├── sensor_pose3d.cpp │ │ │ ├── sensor_pose3d.h │ │ │ ├── sensor_pose3d_offset.cpp │ │ │ ├── sensor_pose3d_offset.h │ │ │ ├── sensor_se3_prior.cpp │ │ │ ├── sensor_se3_prior.h │ │ │ ├── sensor_segment2d.cpp │ │ │ ├── sensor_segment2d.h │ │ │ ├── sensor_segment2d_line.cpp │ │ │ ├── sensor_segment2d_line.h │ │ │ ├── sensor_segment2d_pointline.cpp │ │ │ ├── sensor_segment2d_pointline.h │ │ │ ├── simulator.cpp │ │ │ ├── simulator.h │ │ │ ├── simulator2d.h │ │ │ ├── simulator2d_base.h │ │ │ ├── simulator2d_segment.cpp │ │ │ ├── simulator3d.h │ │ │ ├── simulator3d_base.h │ │ │ ├── simutils.cpp │ │ │ ├── simutils.h │ │ │ ├── test_simulator2d.cpp │ │ │ └── test_simulator3d.cpp │ │ ├── g2o_viewer │ │ │ ├── CMakeLists.txt │ │ │ ├── base_main_window.ui │ │ │ ├── base_properties_widget.ui │ │ │ ├── g2o_qglviewer.cpp │ │ │ ├── g2o_qglviewer.h │ │ │ ├── g2o_viewer.cpp │ │ │ ├── g2o_viewer_api.h │ │ │ ├── gui_hyper_graph_action.cpp │ │ │ ├── gui_hyper_graph_action.h │ │ │ ├── main_window.cpp │ │ │ ├── main_window.h │ │ │ ├── properties_widget.cpp │ │ │ ├── properties_widget.h │ │ │ ├── run_g2o_viewer.cpp │ │ │ ├── run_g2o_viewer.h │ │ │ ├── stream_redirect.cpp │ │ │ ├── stream_redirect.h │ │ │ ├── viewer_properties_widget.cpp │ │ │ └── viewer_properties_widget.h │ │ └── linked_binaries │ │ │ └── CMakeLists.txt │ ├── core │ │ ├── CMakeLists.txt │ │ ├── base_binary_edge.h │ │ ├── base_binary_edge.hpp │ │ ├── base_edge.h │ │ ├── base_multi_edge.h │ │ ├── base_multi_edge.hpp │ │ ├── base_unary_edge.h │ │ ├── base_unary_edge.hpp │ │ ├── base_vertex.h │ │ ├── base_vertex.hpp │ │ ├── batch_stats.cpp │ │ ├── batch_stats.h │ │ ├── block_solver.h │ │ ├── block_solver.hpp │ │ ├── cache.cpp │ │ ├── cache.h │ │ ├── creators.h │ │ ├── dynamic_aligned_buffer.hpp │ │ ├── eigen_types.h │ │ ├── estimate_propagator.cpp │ │ ├── estimate_propagator.h │ │ ├── factory.cpp │ │ ├── factory.h │ │ ├── g2o_core_api.h │ │ ├── hyper_dijkstra.cpp │ │ ├── hyper_dijkstra.h │ │ ├── hyper_graph.cpp │ │ ├── hyper_graph.h │ │ ├── hyper_graph_action.cpp │ │ ├── hyper_graph_action.h │ │ ├── jacobian_workspace.cpp │ │ ├── jacobian_workspace.h │ │ ├── linear_solver.h │ │ ├── marginal_covariance_cholesky.cpp │ │ ├── marginal_covariance_cholesky.h │ │ ├── matrix_operations.h │ │ ├── matrix_structure.cpp │ │ ├── matrix_structure.h │ │ ├── openmp_mutex.h │ │ ├── optimizable_graph.cpp │ │ ├── optimizable_graph.h │ │ ├── optimization_algorithm.cpp │ │ ├── optimization_algorithm.h │ │ ├── optimization_algorithm_dogleg.cpp │ │ ├── optimization_algorithm_dogleg.h │ │ ├── optimization_algorithm_factory.cpp │ │ ├── optimization_algorithm_factory.h │ │ ├── optimization_algorithm_gauss_newton.cpp │ │ ├── optimization_algorithm_gauss_newton.h │ │ ├── optimization_algorithm_levenberg.cpp │ │ ├── optimization_algorithm_levenberg.h │ │ ├── optimization_algorithm_property.h │ │ ├── optimization_algorithm_with_hessian.cpp │ │ ├── optimization_algorithm_with_hessian.h │ │ ├── ownership.h │ │ ├── parameter.cpp │ │ ├── parameter.h │ │ ├── parameter_container.cpp │ │ ├── parameter_container.h │ │ ├── robust_kernel.cpp │ │ ├── robust_kernel.h │ │ ├── robust_kernel_factory.cpp │ │ ├── robust_kernel_factory.h │ │ ├── robust_kernel_impl.cpp │ │ ├── robust_kernel_impl.h │ │ ├── solver.cpp │ │ ├── solver.h │ │ ├── sparse_block_matrix.h │ │ ├── sparse_block_matrix.hpp │ │ ├── sparse_block_matrix_ccs.h │ │ ├── sparse_block_matrix_diagonal.h │ │ ├── sparse_block_matrix_test.cpp │ │ ├── sparse_optimizer.cpp │ │ ├── sparse_optimizer.h │ │ ├── sparse_optimizer_terminate_action.cpp │ │ └── sparse_optimizer_terminate_action.h │ ├── examples │ │ ├── CMakeLists.txt │ │ ├── ba │ │ │ ├── CMakeLists.txt │ │ │ └── ba_demo.cpp │ │ ├── ba_anchored_inverse_depth │ │ │ ├── CMakeLists.txt │ │ │ └── ba_anchored_inverse_depth_demo.cpp │ │ ├── bal │ │ │ ├── CMakeLists.txt │ │ │ └── bal_example.cpp │ │ ├── calibration_odom_laser │ │ │ ├── CMakeLists.txt │ │ │ ├── closed_form_calibration.cpp │ │ │ ├── closed_form_calibration.h │ │ │ ├── edge_se2_pure_calib.cpp │ │ │ ├── edge_se2_pure_calib.h │ │ │ ├── g2o_calibration_odom_laser_api.h │ │ │ ├── gm2dl_io.cpp │ │ │ ├── gm2dl_io.h │ │ │ ├── motion_information.h │ │ │ ├── sclam_helpers.cpp │ │ │ ├── sclam_helpers.h │ │ │ ├── sclam_laser_calib.cpp │ │ │ ├── sclam_odom_laser.cpp │ │ │ └── sclam_pure_calibration.cpp │ │ ├── data_convert │ │ │ ├── CMakeLists.txt │ │ │ └── convert_sba_slam3d.cpp │ │ ├── data_fitting │ │ │ ├── CMakeLists.txt │ │ │ ├── circle_fit.cpp │ │ │ └── curve_fit.cpp │ │ ├── g2o_unfold │ │ │ ├── g2o-unfold.cpp │ │ │ ├── tools.cpp │ │ │ └── tools.h │ │ ├── icp │ │ │ ├── CMakeLists.txt │ │ │ ├── gicp-test1.dat │ │ │ ├── gicp_demo.cpp │ │ │ └── gicp_sba_demo.cpp │ │ ├── interactive_slam │ │ │ ├── CMakeLists.txt │ │ │ ├── README.txt │ │ │ ├── g2o_incremental │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── README.txt │ │ │ │ ├── g2o_incremental.cpp │ │ │ │ ├── g2o_incremental_api.h │ │ │ │ ├── graph_optimizer_sparse_incremental.cpp │ │ │ │ ├── graph_optimizer_sparse_incremental.h │ │ │ │ ├── linear_solver_cholmod_online.h │ │ │ │ └── protocol.txt │ │ │ ├── g2o_interactive │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── fast_output.h │ │ │ │ ├── g2o_interactive_api.h │ │ │ │ ├── g2o_online.cpp │ │ │ │ ├── g2o_slam_interface.cpp │ │ │ │ ├── g2o_slam_interface.h │ │ │ │ ├── generate_commands.cpp │ │ │ │ ├── graph_optimizer_sparse_online.cpp │ │ │ │ ├── graph_optimizer_sparse_online.h │ │ │ │ ├── protocol.txt │ │ │ │ ├── types_online.cpp │ │ │ │ ├── types_slam2d_online.h │ │ │ │ └── types_slam3d_online.h │ │ │ └── slam_parser │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── example │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── example_slam_interface.cpp │ │ │ │ ├── example_slam_interface.h │ │ │ │ └── test_slam_interface.cpp │ │ │ │ ├── interface │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── abstract_slam_interface.h │ │ │ │ ├── parser_interface.cpp │ │ │ │ ├── parser_interface.h │ │ │ │ ├── slam_context_interface.cpp │ │ │ │ └── slam_context_interface.h │ │ │ │ └── parser │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── FlexLexer.h │ │ │ │ ├── bison_parser.cpp │ │ │ │ ├── bison_parser.h │ │ │ │ ├── commands.h │ │ │ │ ├── driver.cpp │ │ │ │ ├── driver.h │ │ │ │ ├── flex_scanner.cpp │ │ │ │ ├── grammar.sh │ │ │ │ ├── location.hh │ │ │ │ ├── parser.yy │ │ │ │ ├── position.hh │ │ │ │ ├── scanner.h │ │ │ │ ├── scanner.l │ │ │ │ ├── slam_context.cpp │ │ │ │ ├── slam_context.h │ │ │ │ ├── stack.hh │ │ │ │ └── test_slam_parser.cpp │ │ ├── line_slam │ │ │ ├── CMakeLists.txt │ │ │ ├── line_test.cpp │ │ │ └── simulator_3d_line.cpp │ │ ├── plane_slam │ │ │ ├── CMakeLists.txt │ │ │ ├── plane_test.cpp │ │ │ └── simulator_3d_plane.cpp │ │ ├── sba │ │ │ ├── CMakeLists.txt │ │ │ └── sba_demo.cpp │ │ ├── simple_optimize │ │ │ ├── CMakeLists.txt │ │ │ └── simple_optimize.cpp │ │ ├── slam2d │ │ │ ├── CMakeLists.txt │ │ │ ├── base_main_window.ui │ │ │ ├── draw_helpers.cpp │ │ │ ├── draw_helpers.h │ │ │ ├── main_window.cpp │ │ │ ├── main_window.h │ │ │ ├── slam2d_g2o.cpp │ │ │ ├── slam2d_viewer.cpp │ │ │ └── slam2d_viewer.h │ │ ├── sphere │ │ │ ├── CMakeLists.txt │ │ │ └── create_sphere.cpp │ │ ├── target │ │ │ ├── CMakeLists.txt │ │ │ ├── constant_velocity_target.cpp │ │ │ ├── continuous_to_discrete.h │ │ │ ├── static_target.cpp │ │ │ ├── targetTypes3D.hpp │ │ │ └── targetTypes6D.hpp │ │ └── tutorial_slam2d │ │ │ ├── CMakeLists.txt │ │ │ ├── edge_se2.cpp │ │ │ ├── edge_se2.h │ │ │ ├── edge_se2_pointxy.cpp │ │ │ ├── edge_se2_pointxy.h │ │ │ ├── g2o_tutorial_slam2d_api.h │ │ │ ├── parameter_se2_offset.cpp │ │ │ ├── parameter_se2_offset.h │ │ │ ├── rand.h │ │ │ ├── se2.h │ │ │ ├── simulator.cpp │ │ │ ├── simulator.h │ │ │ ├── tutorial_slam2d.cpp │ │ │ ├── types_tutorial_slam2d.cpp │ │ │ ├── types_tutorial_slam2d.h │ │ │ ├── vertex_point_xy.cpp │ │ │ ├── vertex_point_xy.h │ │ │ ├── vertex_se2.cpp │ │ │ └── vertex_se2.h │ ├── solvers │ │ ├── CMakeLists.txt │ │ ├── cholmod │ │ │ ├── CMakeLists.txt │ │ │ ├── linear_solver_cholmod.h │ │ │ └── solver_cholmod.cpp │ │ ├── csparse │ │ │ ├── CMakeLists.txt │ │ │ ├── csparse_helper.cpp │ │ │ ├── csparse_helper.h │ │ │ ├── g2o_csparse_api.h │ │ │ ├── g2o_csparse_extension_api.h │ │ │ ├── linear_solver_csparse.h │ │ │ └── solver_csparse.cpp │ │ ├── dense │ │ │ ├── CMakeLists.txt │ │ │ ├── linear_solver_dense.h │ │ │ └── solver_dense.cpp │ │ ├── eigen │ │ │ ├── CMakeLists.txt │ │ │ ├── linear_solver_eigen.h │ │ │ └── solver_eigen.cpp │ │ ├── pcg │ │ │ ├── CMakeLists.txt │ │ │ ├── linear_solver_pcg.h │ │ │ ├── linear_solver_pcg.hpp │ │ │ └── solver_pcg.cpp │ │ ├── slam2d_linear │ │ │ ├── CMakeLists.txt │ │ │ ├── g2o_slam2d_linear_api.h │ │ │ ├── slam2d_linear.cpp │ │ │ ├── solver_slam2d_linear.cpp │ │ │ └── solver_slam2d_linear.h │ │ └── structure_only │ │ │ ├── CMakeLists.txt │ │ │ ├── structure_only.cpp │ │ │ └── structure_only_solver.h │ ├── stuff │ │ ├── CMakeLists.txt │ │ ├── color_macros.h │ │ ├── command_args.cpp │ │ ├── command_args.h │ │ ├── filesys_tools.cpp │ │ ├── filesys_tools.h │ │ ├── g2o_stuff_api.h │ │ ├── macros.h │ │ ├── misc.h │ │ ├── opengl_primitives.cpp │ │ ├── opengl_primitives.h │ │ ├── opengl_wrapper.h │ │ ├── os_specific.c │ │ ├── os_specific.h │ │ ├── property.cpp │ │ ├── property.h │ │ ├── sampler.cpp │ │ ├── sampler.h │ │ ├── scoped_pointer.h │ │ ├── sparse_helper.cpp │ │ ├── sparse_helper.h │ │ ├── string_tools.cpp │ │ ├── string_tools.h │ │ ├── tictoc.cpp │ │ ├── tictoc.h │ │ ├── timeutil.cpp │ │ ├── timeutil.h │ │ └── unscented.h │ ├── types │ │ ├── CMakeLists.txt │ │ ├── data │ │ │ ├── CMakeLists.txt │ │ │ ├── data_queue.cpp │ │ │ ├── data_queue.h │ │ │ ├── g2o_types_data_api.h │ │ │ ├── laser_parameters.cpp │ │ │ ├── laser_parameters.h │ │ │ ├── raw_laser.cpp │ │ │ ├── raw_laser.h │ │ │ ├── robot_data.cpp │ │ │ ├── robot_data.h │ │ │ ├── robot_laser.cpp │ │ │ ├── robot_laser.h │ │ │ ├── types_data.cpp │ │ │ ├── types_data.h │ │ │ ├── vertex_ellipse.cpp │ │ │ ├── vertex_ellipse.h │ │ │ ├── vertex_tag.cpp │ │ │ └── vertex_tag.h │ │ ├── deprecated │ │ │ ├── CMakeLists.txt │ │ │ └── slam3d │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── edge_se3_offset.cpp │ │ │ │ ├── edge_se3_offset.h │ │ │ │ ├── edge_se3_pointxyz.cpp │ │ │ │ ├── edge_se3_pointxyz.h │ │ │ │ ├── edge_se3_pointxyz_depth.cpp │ │ │ │ ├── edge_se3_pointxyz_depth.h │ │ │ │ ├── edge_se3_pointxyz_disparity.cpp │ │ │ │ ├── edge_se3_pointxyz_disparity.h │ │ │ │ ├── edge_se3_prior.cpp │ │ │ │ ├── edge_se3_prior.h │ │ │ │ ├── edge_se3_quat.cpp │ │ │ │ ├── edge_se3_quat.h │ │ │ │ ├── g2o_deprecated_types_slam3d_api.h │ │ │ │ ├── parameter_camera.cpp │ │ │ │ ├── parameter_camera.h │ │ │ │ ├── parameter_se3_offset.cpp │ │ │ │ ├── parameter_se3_offset.h │ │ │ │ ├── se3quat_gradients.cpp │ │ │ │ ├── se3quat_gradients.h │ │ │ │ ├── types_slam3d.cpp │ │ │ │ ├── types_slam3d.h │ │ │ │ ├── vertex_pointxyz.cpp │ │ │ │ ├── vertex_pointxyz.h │ │ │ │ ├── vertex_se3_quat.cpp │ │ │ │ └── vertex_se3_quat.h │ │ ├── icp │ │ │ ├── CMakeLists.txt │ │ │ ├── g2o_types_icp_api.h │ │ │ ├── types_icp.cpp │ │ │ └── types_icp.h │ │ ├── sba │ │ │ ├── CMakeLists.txt │ │ │ ├── g2o_types_sba_api.h │ │ │ ├── sbacam.h │ │ │ ├── types_sba.cpp │ │ │ ├── types_sba.h │ │ │ ├── types_six_dof_expmap.cpp │ │ │ └── types_six_dof_expmap.h │ │ ├── sclam2d │ │ │ ├── CMakeLists.txt │ │ │ ├── edge_se2_odom_differential_calib.cpp │ │ │ ├── edge_se2_odom_differential_calib.h │ │ │ ├── edge_se2_sensor_calib.cpp │ │ │ ├── edge_se2_sensor_calib.h │ │ │ ├── g2o_types_sclam2d_api.h │ │ │ ├── odometry_measurement.cpp │ │ │ ├── odometry_measurement.h │ │ │ ├── types_sclam2d.cpp │ │ │ ├── types_sclam2d.h │ │ │ ├── vertex_odom_differential_params.cpp │ │ │ └── vertex_odom_differential_params.h │ │ ├── sim3 │ │ │ ├── CMakeLists.txt │ │ │ ├── sim3.h │ │ │ ├── types_seven_dof_expmap.cpp │ │ │ └── types_seven_dof_expmap.h │ │ ├── slam2d │ │ │ ├── CMakeLists.txt │ │ │ ├── edge_pointxy.cpp │ │ │ ├── edge_pointxy.h │ │ │ ├── edge_se2.cpp │ │ │ ├── edge_se2.h │ │ │ ├── edge_se2_lotsofxy.cpp │ │ │ ├── edge_se2_lotsofxy.h │ │ │ ├── edge_se2_offset.cpp │ │ │ ├── edge_se2_offset.h │ │ │ ├── edge_se2_pointxy.cpp │ │ │ ├── edge_se2_pointxy.h │ │ │ ├── edge_se2_pointxy_bearing.cpp │ │ │ ├── edge_se2_pointxy_bearing.h │ │ │ ├── edge_se2_pointxy_calib.cpp │ │ │ ├── edge_se2_pointxy_calib.h │ │ │ ├── edge_se2_pointxy_offset.cpp │ │ │ ├── edge_se2_pointxy_offset.h │ │ │ ├── edge_se2_prior.cpp │ │ │ ├── edge_se2_prior.h │ │ │ ├── edge_se2_twopointsxy.cpp │ │ │ ├── edge_se2_twopointsxy.h │ │ │ ├── edge_se2_xyprior.cpp │ │ │ ├── edge_se2_xyprior.h │ │ │ ├── g2o_types_slam2d_api.h │ │ │ ├── parameter_se2_offset.cpp │ │ │ ├── parameter_se2_offset.h │ │ │ ├── se2.h │ │ │ ├── types_slam2d.cpp │ │ │ ├── types_slam2d.h │ │ │ ├── vertex_point_xy.cpp │ │ │ ├── vertex_point_xy.h │ │ │ ├── vertex_se2.cpp │ │ │ └── vertex_se2.h │ │ ├── slam2d_addons │ │ │ ├── CMakeLists.txt │ │ │ ├── edge_line2d.cpp │ │ │ ├── edge_line2d.h │ │ │ ├── edge_line2d_pointxy.cpp │ │ │ ├── edge_line2d_pointxy.h │ │ │ ├── edge_se2_line2d.cpp │ │ │ ├── edge_se2_line2d.h │ │ │ ├── edge_se2_segment2d.cpp │ │ │ ├── edge_se2_segment2d.h │ │ │ ├── edge_se2_segment2d_line.cpp │ │ │ ├── edge_se2_segment2d_line.h │ │ │ ├── edge_se2_segment2d_pointLine.cpp │ │ │ ├── edge_se2_segment2d_pointLine.h │ │ │ ├── g2o_types_slam2d_addons_api.h │ │ │ ├── line_2d.h │ │ │ ├── types_slam2d_addons.cpp │ │ │ ├── types_slam2d_addons.h │ │ │ ├── vertex_line2d.cpp │ │ │ ├── vertex_line2d.h │ │ │ ├── vertex_segment2d.cpp │ │ │ └── vertex_segment2d.h │ │ ├── slam3d │ │ │ ├── CMakeLists.txt │ │ │ ├── dquat2mat.cpp │ │ │ ├── dquat2mat.h │ │ │ ├── dquat2mat.wxm │ │ │ ├── dquat2mat_maxima_generated.cpp │ │ │ ├── edge_pointxyz.cpp │ │ │ ├── edge_pointxyz.h │ │ │ ├── edge_se3.cpp │ │ │ ├── edge_se3.h │ │ │ ├── edge_se3_lotsofxyz.cpp │ │ │ ├── edge_se3_lotsofxyz.h │ │ │ ├── edge_se3_offset.cpp │ │ │ ├── edge_se3_offset.h │ │ │ ├── edge_se3_pointxyz.cpp │ │ │ ├── edge_se3_pointxyz.h │ │ │ ├── edge_se3_pointxyz_depth.cpp │ │ │ ├── edge_se3_pointxyz_depth.h │ │ │ ├── edge_se3_pointxyz_disparity.cpp │ │ │ ├── edge_se3_pointxyz_disparity.h │ │ │ ├── edge_se3_prior.cpp │ │ │ ├── edge_se3_prior.h │ │ │ ├── g2o_types_slam3d_api.h │ │ │ ├── isometry3d_gradients.cpp │ │ │ ├── isometry3d_gradients.h │ │ │ ├── isometry3d_mappings.cpp │ │ │ ├── isometry3d_mappings.h │ │ │ ├── parameter_camera.cpp │ │ │ ├── parameter_camera.h │ │ │ ├── parameter_se3_offset.cpp │ │ │ ├── parameter_se3_offset.h │ │ │ ├── parameter_stereo_camera.cpp │ │ │ ├── parameter_stereo_camera.h │ │ │ ├── se3_ops.h │ │ │ ├── se3_ops.hpp │ │ │ ├── se3quat.h │ │ │ ├── test_isometry3d_mappings.cpp │ │ │ ├── test_mat2quat_jacobian.cpp │ │ │ ├── test_slam3d_jacobian.cpp │ │ │ ├── types_slam3d.cpp │ │ │ ├── types_slam3d.h │ │ │ ├── vertex_pointxyz.cpp │ │ │ ├── vertex_pointxyz.h │ │ │ ├── vertex_se3.cpp │ │ │ └── vertex_se3.h │ │ └── slam3d_addons │ │ │ ├── CMakeLists.txt │ │ │ ├── edge_plane.cpp │ │ │ ├── edge_plane.h │ │ │ ├── edge_se3_calib.cpp │ │ │ ├── edge_se3_calib.h │ │ │ ├── edge_se3_euler.cpp │ │ │ ├── edge_se3_euler.h │ │ │ ├── edge_se3_line.cpp │ │ │ ├── edge_se3_line.h │ │ │ ├── edge_se3_plane_calib.cpp │ │ │ ├── edge_se3_plane_calib.h │ │ │ ├── g2o_types_slam3d_addons_api.h │ │ │ ├── line3d.cpp │ │ │ ├── line3d.h │ │ │ ├── plane3d.h │ │ │ ├── types_slam3d_addons.cpp │ │ │ ├── types_slam3d_addons.h │ │ │ ├── vertex_line3d.cpp │ │ │ ├── vertex_line3d.h │ │ │ ├── vertex_plane.cpp │ │ │ ├── vertex_plane.h │ │ │ ├── vertex_se3_euler.cpp │ │ │ └── vertex_se3_euler.h │ └── what_is_in_these_directories.txt ├── install.sh ├── python │ ├── CMakeLists.txt │ ├── contrib │ │ ├── contrib.h │ │ ├── estimate_propagator │ │ │ └── smooth_estimate_propagator.h │ │ └── sba_addons │ │ │ └── types_stereo_sba.h │ ├── core │ │ ├── base_binary_edge.h │ │ ├── base_edge.h │ │ ├── base_multi_edge.h │ │ ├── base_unary_edge.h │ │ ├── base_vertex.h │ │ ├── batch_stats.h │ │ ├── block_solver.h │ │ ├── eigen_types.h │ │ ├── estimate_propagator.h │ │ ├── hyper_dijkstra.h │ │ ├── hyper_graph.h │ │ ├── hyper_graph_action.h │ │ ├── jacobian_workspace.h │ │ ├── linear_solver.h │ │ ├── optimizable_graph.h │ │ ├── optimization_algorithm.h │ │ ├── parameter.h │ │ ├── parameter_container.h │ │ ├── robust_kernel.h │ │ ├── solver.h │ │ ├── sparse_block_matrix.h │ │ ├── sparse_optimizer.h │ │ └── sparse_optimizer_terminate_action.h │ ├── examples │ │ ├── ba_anchored_inverse_depth_demo.py │ │ ├── ba_demo.py │ │ ├── gicp_demo.py │ │ ├── gicp_sba_demo.py │ │ ├── problem.g2o │ │ ├── sba_demo.py │ │ ├── sba_demo2.py │ │ ├── simple_optimize.py │ │ └── sphere2500.g2o │ ├── g2o.cpp │ └── types │ │ ├── icp │ │ └── types_icp.h │ │ ├── sba │ │ ├── sbacam.h │ │ ├── types_sba.h │ │ └── types_six_dof_expmap.h │ │ ├── sclam2d │ │ ├── edge_se2_odom_differential_calib.h │ │ ├── edge_se2_sensor_calib.h │ │ ├── odometry_measurement.h │ │ ├── types_sclam2d.h │ │ └── vertex_odom_differential_params.h │ │ ├── sim3 │ │ ├── sim3.h │ │ └── types_seven_dof_expmap.h │ │ ├── slam2d │ │ ├── edge_pointxy.h │ │ ├── edge_se2.h │ │ ├── edge_se2_pointxy.h │ │ ├── parameter_se2_offset.h │ │ ├── se2.h │ │ ├── types_slam2d.h │ │ ├── vertex_point_xy.h │ │ └── vertex_se2.h │ │ ├── slam3d │ │ ├── edge_pointxyz.h │ │ ├── edge_se3.h │ │ ├── edge_se3_pointxyz.h │ │ ├── parameter.h │ │ ├── se3quat.h │ │ ├── types_slam3d.h │ │ ├── vertex_pointxyz.h │ │ └── vertex_se3.h │ │ └── types.h ├── script │ ├── android.toolchain.cmake │ ├── install-deps-linux.sh │ └── install-deps-osx.sh └── setup.py ├── kitti-odom-eval-master ├── LICENSE ├── README.md ├── eval_odom.py ├── misc │ ├── result_summary.jpeg │ ├── run_eg.jpeg │ ├── sub_seq_err.jpeg │ └── traj_eg.jpeg ├── requirement.yml └── result │ ├── example_0 │ ├── 09.txt │ └── 10.txt │ └── example_1 │ ├── 09.txt │ └── 10.txt ├── monodepth2 ├── LICENSE ├── README.md ├── assets │ ├── copyright_notice.txt │ ├── teaser.gif │ └── test_image.jpg ├── datasets │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── kitti_dataset.cpython-38.pyc │ │ └── mono_dataset.cpython-38.pyc │ ├── kitti_dataset.py │ └── mono_dataset.py ├── depth_prediction_example.ipynb ├── evaluate_depth.py ├── evaluate_pose.py ├── experiments │ ├── mono+stereo_experiments.sh │ ├── mono_experiments.sh │ ├── odom_experiments.sh │ └── stereo_experiments.sh ├── export_gt_depth.py ├── kitti_utils.py ├── layers.py ├── networks │ ├── __init__.py │ ├── depth_decoder.py │ ├── pose_cnn.py │ ├── pose_decoder.py │ └── resnet_encoder.py ├── options.py ├── splits │ ├── benchmark │ │ ├── eigen_to_benchmark_ids.npy │ │ ├── test_files.txt │ │ ├── train_files.txt │ │ └── val_files.txt │ ├── eigen │ │ └── test_files.txt │ ├── eigen_benchmark │ │ └── test_files.txt │ ├── eigen_full │ │ ├── train_files.txt │ │ └── val_files.txt │ ├── eigen_zhou │ │ ├── train_files.txt │ │ └── val_files.txt │ ├── kitti_archives_to_download.txt │ └── odom │ │ ├── test_files_09.txt │ │ ├── test_files_10.txt │ │ ├── train_files.txt │ │ └── val_files.txt ├── test_simple.py ├── train.py ├── trainer.py └── utils.py └── src ├── d3vo.py ├── depth_pose_net.py ├── frontend.py ├── main.py ├── numpy_to_pose.py └── optimizer.py /README.md: -------------------------------------------------------------------------------- 1 | # D3VO 2 | 3 | 16-833 Robot Localization and Mapping course project 4 | 5 | Implementation of D3VO: Deep Depth, Deep Pose and Deep Uncertainty for Monocular Visual Odometry (https://arxiv.org/pdf/2003.01060.pdf) 6 | 7 | 8 | 9 | ## Setup 10 | 11 | - Use Python 3.8.10 or earlier. 12 | 13 | - Compile and install g2opy. 14 | ``` 15 | cd g2opy 16 | mkdir build 17 | cd build 18 | cmake .. 19 | make -j8 20 | cd .. 21 | python setup.py install 22 | cd .. 23 | ``` 24 | 25 | - Download trained DepthNet and PoseNet weights. https://drive.google.com/drive/folders/176fuEVP1BVQlKQNXCp3wQE_kBK_ogOCT?usp=sharing 26 | 27 | 28 | - Install Python packages. 29 | 30 | ``` 31 | python3 -m pip install torch torchvision numpy matplotlib opencv-python 32 | ``` 33 | 34 | - (Optional) Download and install the KITTI color odoometry dataset and convert frames to a video format (like MP4). Optionally also download ground truth poses for evaluation. https://www.cvlibs.net/datasets/kitti/eval_odometry.php 35 | 36 | 37 | - Run D3VO on an input video (.mp4). 38 | ``` 39 | python3 src/main.py video_path.mp4 weights_directory_path --gt optional_ground_truth_txt_path --out output_dir_path 40 | ``` 41 | 42 | 43 | 44 | ## Sources 45 | 46 | - g2opy: https://github.com/uoip/g2opy 47 | 48 | - monodepth2: https://github.com/nianticlabs/monodepth2 49 | 50 | - kitti-odom-eval: https://github.com/Huangying-Zhan/kitti-odom-eval 51 | 52 | -------------------------------------------------------------------------------- /g2opy/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | dist: trusty 3 | language: cpp 4 | 5 | os: 6 | - linux 7 | - osx 8 | 9 | notifications: 10 | email: 11 | recipients: 12 | - rainer.kuemmerle@gmail.com 13 | on_success: change # default: change 14 | on_failure: always # default: always 15 | 16 | compiler: 17 | - gcc 18 | - clang 19 | 20 | before_install: 21 | - env | sort 22 | 23 | install: 24 | #- script/install-deps-linux.sh 25 | - script/install-deps-${TRAVIS_OS_NAME}.sh 26 | 27 | before_script: 28 | - mkdir build 29 | - cd build 30 | - cmake .. 31 | - cat g2o/config.h 32 | 33 | script: make 34 | 35 | # right now only build the master branch 36 | branches: 37 | only: 38 | - master 39 | 40 | matrix: 41 | exclude: 42 | - os: osx 43 | compiler: gcc 44 | allow_failures: 45 | - os: osx 46 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Only build CSPARSE if we need to 2 | IF(BUILD_CSPARSE) 3 | ADD_SUBDIRECTORY(csparse) 4 | ENDIF(BUILD_CSPARSE) 5 | 6 | IF (G2O_HAVE_OPENGL) 7 | ADD_SUBDIRECTORY(freeglut) 8 | ENDIF() 9 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/ceres/LICENSE: -------------------------------------------------------------------------------- 1 | Ceres Solver - A fast non-linear least squares minimizer 2 | Copyright 2015 Google Inc. All rights reserved. 3 | http://ceres-solver.org/ 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright notice, 9 | this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | * Neither the name of Google Inc. nor the names of its contributors may be 14 | used to endorse or promote products derived from this software without 15 | specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/License.txt: -------------------------------------------------------------------------------- 1 | CSparse: a Concise Sparse matrix package. 2 | Copyright (c) 2006, Timothy A. Davis. 3 | http://www.cise.ufl.edu/research/sparse/CSparse 4 | 5 | -------------------------------------------------------------------------------- 6 | 7 | CSparse is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | CSparse is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with this Module; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/README.txt: -------------------------------------------------------------------------------- 1 | CSparse/Source directory: primary ANSI C source code files for CSparse. 2 | All of these files are printed verbatim in the book. To compile the 3 | libcsparse.a C-callable library, just type "make" in this directory. 4 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_add.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* C = alpha*A + beta*B */ 3 | cs *cs_add (const cs *A, const cs *B, double alpha, double beta) 4 | { 5 | csi p, j, nz = 0, anz, *Cp, *Ci, *Bp, m, n, bnz, *w, values ; 6 | double *x, *Bx, *Cx ; 7 | cs *C ; 8 | if (!CS_CSC (A) || !CS_CSC (B)) return (NULL) ; /* check inputs */ 9 | if (A->m != B->m || A->n != B->n) return (NULL) ; 10 | m = A->m ; anz = A->p [A->n] ; 11 | n = B->n ; Bp = B->p ; Bx = B->x ; bnz = Bp [n] ; 12 | w = cs_calloc (m, sizeof (csi)) ; /* get workspace */ 13 | values = (A->x != NULL) && (Bx != NULL) ; 14 | x = values ? cs_malloc (m, sizeof (double)) : NULL ; /* get workspace */ 15 | C = cs_spalloc (m, n, anz + bnz, values, 0) ; /* allocate result*/ 16 | if (!C || !w || (values && !x)) return (cs_done (C, w, x, 0)) ; 17 | Cp = C->p ; Ci = C->i ; Cx = C->x ; 18 | for (j = 0 ; j < n ; j++) 19 | { 20 | Cp [j] = nz ; /* column j of C starts here */ 21 | nz = cs_scatter (A, j, alpha, w, x, j+1, C, nz) ; /* alpha*A(:,j)*/ 22 | nz = cs_scatter (B, j, beta, w, x, j+1, C, nz) ; /* beta*B(:,j) */ 23 | if (values) for (p = Cp [j] ; p < nz ; p++) Cx [p] = x [Ci [p]] ; 24 | } 25 | Cp [n] = nz ; /* finalize the last column of C */ 26 | cs_sprealloc (C, 0) ; /* remove extra space from C */ 27 | return (cs_done (C, w, x, 1)) ; /* success; free workspace, return C */ 28 | } 29 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_cholsol.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x=A\b where A is symmetric positive definite; b overwritten with solution */ 3 | csi cs_cholsol (csi order, const cs *A, double *b) 4 | { 5 | double *x ; 6 | css *S ; 7 | csn *N ; 8 | csi n, ok ; 9 | if (!CS_CSC (A) || !b) return (0) ; /* check inputs */ 10 | n = A->n ; 11 | S = cs_schol (order, A) ; /* ordering and symbolic analysis */ 12 | N = cs_chol (A, S) ; /* numeric Cholesky factorization */ 13 | x = cs_malloc (n, sizeof (double)) ; /* get workspace */ 14 | ok = (S && N && x) ; 15 | if (ok) 16 | { 17 | cs_ipvec (S->pinv, b, x, n) ; /* x = P*b */ 18 | cs_lsolve (N->L, x) ; /* x = L\x */ 19 | cs_ltsolve (N->L, x) ; /* x = L'\x */ 20 | cs_pvec (S->pinv, x, b, n) ; /* b = P'*x */ 21 | } 22 | cs_free (x) ; 23 | cs_sfree (S) ; 24 | cs_nfree (N) ; 25 | return (ok) ; 26 | } 27 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_compress.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* C = compressed-column form of a triplet matrix T */ 3 | cs *cs_compress (const cs *T) 4 | { 5 | csi m, n, nz, p, k, *Cp, *Ci, *w, *Ti, *Tj ; 6 | double *Cx, *Tx ; 7 | cs *C ; 8 | if (!CS_TRIPLET (T)) return (NULL) ; /* check inputs */ 9 | m = T->m ; n = T->n ; Ti = T->i ; Tj = T->p ; Tx = T->x ; nz = T->nz ; 10 | C = cs_spalloc (m, n, nz, Tx != NULL, 0) ; /* allocate result */ 11 | w = cs_calloc (n, sizeof (csi)) ; /* get workspace */ 12 | if (!C || !w) return (cs_done (C, w, NULL, 0)) ; /* out of memory */ 13 | Cp = C->p ; Ci = C->i ; Cx = C->x ; 14 | for (k = 0 ; k < nz ; k++) w [Tj [k]]++ ; /* column counts */ 15 | cs_cumsum (Cp, w, n) ; /* column pointers */ 16 | for (k = 0 ; k < nz ; k++) 17 | { 18 | Ci [p = w [Tj [k]]++] = Ti [k] ; /* A(i,j) is the pth entry in C */ 19 | if (Cx) Cx [p] = Tx [k] ; 20 | } 21 | return (cs_done (C, w, NULL, 1)) ; /* success; free w and return C */ 22 | } 23 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_cumsum.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* p [0..n] = cumulative sum of c [0..n-1], and then copy p [0..n-1] into c */ 3 | double cs_cumsum (csi *p, csi *c, csi n) 4 | { 5 | csi i, nz = 0 ; 6 | double nz2 = 0 ; 7 | if (!p || !c) return (-1) ; /* check inputs */ 8 | for (i = 0 ; i < n ; i++) 9 | { 10 | p [i] = nz ; 11 | nz += c [i] ; 12 | nz2 += c [i] ; /* also in double to avoid csi overflow */ 13 | c [i] = p [i] ; /* also copy p[0..n-1] back into c[0..n-1]*/ 14 | } 15 | p [n] = nz ; 16 | return (nz2) ; /* return sum (c [0..n-1]) */ 17 | } 18 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_droptol.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | static csi cs_tol (csi i, csi j, double aij, void *tol) 3 | { 4 | return (fabs (aij) > *((double *) tol)) ; 5 | } 6 | csi cs_droptol (cs *A, double tol) 7 | { 8 | return (cs_fkeep (A, &cs_tol, &tol)) ; /* keep all large entries */ 9 | } 10 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_dropzeros.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | static csi cs_nonzero (csi i, csi j, double aij, void *other) 3 | { 4 | return (aij != 0) ; 5 | } 6 | csi cs_dropzeros (cs *A) 7 | { 8 | return (cs_fkeep (A, &cs_nonzero, NULL)) ; /* keep all nonzero entries */ 9 | } 10 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_dupl.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* remove duplicate entries from A */ 3 | csi cs_dupl (cs *A) 4 | { 5 | csi i, j, p, q, nz = 0, n, m, *Ap, *Ai, *w ; 6 | double *Ax ; 7 | if (!CS_CSC (A)) return (0) ; /* check inputs */ 8 | m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 9 | w = cs_malloc (m, sizeof (csi)) ; /* get workspace */ 10 | if (!w) return (0) ; /* out of memory */ 11 | for (i = 0 ; i < m ; i++) w [i] = -1 ; /* row i not yet seen */ 12 | for (j = 0 ; j < n ; j++) 13 | { 14 | q = nz ; /* column j will start at q */ 15 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 16 | { 17 | i = Ai [p] ; /* A(i,j) is nonzero */ 18 | if (w [i] >= q) 19 | { 20 | Ax [w [i]] += Ax [p] ; /* A(i,j) is a duplicate */ 21 | } 22 | else 23 | { 24 | w [i] = nz ; /* record where row i occurs */ 25 | Ai [nz] = i ; /* keep A(i,j) */ 26 | Ax [nz++] = Ax [p] ; 27 | } 28 | } 29 | Ap [j] = q ; /* record start of column j */ 30 | } 31 | Ap [n] = nz ; /* finalize A */ 32 | cs_free (w) ; /* free workspace */ 33 | return (cs_sprealloc (A, 0)) ; /* remove extra space from A */ 34 | } 35 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_entry.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* add an entry to a triplet matrix; return 1 if ok, 0 otherwise */ 3 | csi cs_entry (cs *T, csi i, csi j, double x) 4 | { 5 | if (!CS_TRIPLET (T) || i < 0 || j < 0) return (0) ; /* check inputs */ 6 | if (T->nz >= T->nzmax && !cs_sprealloc (T,2*(T->nzmax))) return (0) ; 7 | if (T->x) T->x [T->nz] = x ; 8 | T->i [T->nz] = i ; 9 | T->p [T->nz++] = j ; 10 | T->m = CS_MAX (T->m, i+1) ; 11 | T->n = CS_MAX (T->n, j+1) ; 12 | return (1) ; 13 | } 14 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_ereach.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* find nonzero pattern of Cholesky L(k,1:k-1) using etree and triu(A(:,k)) */ 3 | csi cs_ereach (const cs *A, csi k, const csi *parent, csi *s, csi *w) 4 | { 5 | csi i, p, n, len, top, *Ap, *Ai ; 6 | if (!CS_CSC (A) || !parent || !s || !w) return (-1) ; /* check inputs */ 7 | top = n = A->n ; Ap = A->p ; Ai = A->i ; 8 | CS_MARK (w, k) ; /* mark node k as visited */ 9 | for (p = Ap [k] ; p < Ap [k+1] ; p++) 10 | { 11 | i = Ai [p] ; /* A(i,k) is nonzero */ 12 | if (i > k) continue ; /* only use upper triangular part of A */ 13 | for (len = 0 ; !CS_MARKED (w,i) ; i = parent [i]) /* traverse up etree*/ 14 | { 15 | s [len++] = i ; /* L(k,i) is nonzero */ 16 | CS_MARK (w, i) ; /* mark i as visited */ 17 | } 18 | while (len > 0) s [--top] = s [--len] ; /* push path onto stack */ 19 | } 20 | for (p = top ; p < n ; p++) CS_MARK (w, s [p]) ; /* unmark all nodes */ 21 | CS_MARK (w, k) ; /* unmark node k */ 22 | return (top) ; /* s [top..n-1] contains pattern of L(k,:)*/ 23 | } 24 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_etree.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* compute the etree of A (using triu(A), or A'A without forming A'A */ 3 | csi *cs_etree (const cs *A, csi ata) 4 | { 5 | csi i, k, p, m, n, inext, *Ap, *Ai, *w, *parent, *ancestor, *prev ; 6 | if (!CS_CSC (A)) return (NULL) ; /* check inputs */ 7 | m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; 8 | parent = cs_malloc (n, sizeof (csi)) ; /* allocate result */ 9 | w = cs_malloc (n + (ata ? m : 0), sizeof (csi)) ; /* get workspace */ 10 | if (!w || !parent) return (cs_idone (parent, NULL, w, 0)) ; 11 | ancestor = w ; prev = w + n ; 12 | if (ata) for (i = 0 ; i < m ; i++) prev [i] = -1 ; 13 | for (k = 0 ; k < n ; k++) 14 | { 15 | parent [k] = -1 ; /* node k has no parent yet */ 16 | ancestor [k] = -1 ; /* nor does k have an ancestor */ 17 | for (p = Ap [k] ; p < Ap [k+1] ; p++) 18 | { 19 | i = ata ? (prev [Ai [p]]) : (Ai [p]) ; 20 | for ( ; i != -1 && i < k ; i = inext) /* traverse from i to k */ 21 | { 22 | inext = ancestor [i] ; /* inext = ancestor of i */ 23 | ancestor [i] = k ; /* path compression */ 24 | if (inext == -1) parent [i] = k ; /* no anc., parent is k */ 25 | } 26 | if (ata) prev [Ai [p]] = k ; 27 | } 28 | } 29 | return (cs_idone (parent, NULL, w, 1)) ; 30 | } 31 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_fkeep.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* drop entries for which fkeep(A(i,j)) is false; return nz if OK, else -1 */ 3 | csi cs_fkeep (cs *A, csi (*fkeep) (csi, csi, double, void *), void *other) 4 | { 5 | csi j, p, nz = 0, n, *Ap, *Ai ; 6 | double *Ax ; 7 | if (!CS_CSC (A) || !fkeep) return (-1) ; /* check inputs */ 8 | n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | p = Ap [j] ; /* get current location of col j */ 12 | Ap [j] = nz ; /* record new location of col j */ 13 | for ( ; p < Ap [j+1] ; p++) 14 | { 15 | if (fkeep (Ai [p], j, Ax ? Ax [p] : 1, other)) 16 | { 17 | if (Ax) Ax [nz] = Ax [p] ; /* keep A(i,j) */ 18 | Ai [nz++] = Ai [p] ; 19 | } 20 | } 21 | } 22 | Ap [n] = nz ; /* finalize A */ 23 | cs_sprealloc (A, 0) ; /* remove extra space from A */ 24 | return (nz) ; 25 | } 26 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_gaxpy.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* y = A*x+y */ 3 | csi cs_gaxpy (const cs *A, const double *x, double *y) 4 | { 5 | csi p, j, n, *Ap, *Ai ; 6 | double *Ax ; 7 | if (!CS_CSC (A) || !x || !y) return (0) ; /* check inputs */ 8 | n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 12 | { 13 | y [Ai [p]] += Ax [p] * x [j] ; 14 | } 15 | } 16 | return (1) ; 17 | } 18 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_happly.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* apply the ith Householder vector to x */ 3 | csi cs_happly (const cs *V, csi i, double beta, double *x) 4 | { 5 | csi p, *Vp, *Vi ; 6 | double *Vx, tau = 0 ; 7 | if (!CS_CSC (V) || !x) return (0) ; /* check inputs */ 8 | Vp = V->p ; Vi = V->i ; Vx = V->x ; 9 | for (p = Vp [i] ; p < Vp [i+1] ; p++) /* tau = v'*x */ 10 | { 11 | tau += Vx [p] * x [Vi [p]] ; 12 | } 13 | tau *= beta ; /* tau = beta*(v'*x) */ 14 | for (p = Vp [i] ; p < Vp [i+1] ; p++) /* x = x - v*tau */ 15 | { 16 | x [Vi [p]] -= Vx [p] * tau ; 17 | } 18 | return (1) ; 19 | } 20 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_house.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* create a Householder reflection [v,beta,s]=house(x), overwrite x with v, 3 | * where (I-beta*v*v')*x = s*e1. See Algo 5.1.1, Golub & Van Loan, 3rd ed. */ 4 | double cs_house (double *x, double *beta, csi n) 5 | { 6 | double s, sigma = 0 ; 7 | csi i ; 8 | if (!x || !beta) return (-1) ; /* check inputs */ 9 | for (i = 1 ; i < n ; i++) sigma += x [i] * x [i] ; 10 | if (sigma == 0) 11 | { 12 | s = fabs (x [0]) ; /* s = |x(0)| */ 13 | (*beta) = (x [0] <= 0) ? 2 : 0 ; 14 | x [0] = 1 ; 15 | } 16 | else 17 | { 18 | s = sqrt (x [0] * x [0] + sigma) ; /* s = norm (x) */ 19 | x [0] = (x [0] <= 0) ? (x [0] - s) : (-sigma / (x [0] + s)) ; 20 | (*beta) = -1. / (s * x [0]) ; 21 | } 22 | return (s) ; 23 | } 24 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_ipvec.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x(p) = b, for dense vectors x and b; p=NULL denotes identity */ 3 | csi cs_ipvec (const csi *p, const double *b, double *x, csi n) 4 | { 5 | csi k ; 6 | if (!x || !b) return (0) ; /* check inputs */ 7 | for (k = 0 ; k < n ; k++) x [p ? p [k] : k] = b [k] ; 8 | return (1) ; 9 | } 10 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_leaf.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* consider A(i,j), node j in ith row subtree and return lca(jprev,j) */ 3 | csi cs_leaf (csi i, csi j, const csi *first, csi *maxfirst, csi *prevleaf, 4 | csi *ancestor, csi *jleaf) 5 | { 6 | csi q, s, sparent, jprev ; 7 | if (!first || !maxfirst || !prevleaf || !ancestor || !jleaf) return (-1) ; 8 | *jleaf = 0 ; 9 | if (i <= j || first [j] <= maxfirst [i]) return (-1) ; /* j not a leaf */ 10 | maxfirst [i] = first [j] ; /* update max first[j] seen so far */ 11 | jprev = prevleaf [i] ; /* jprev = previous leaf of ith subtree */ 12 | prevleaf [i] = j ; 13 | *jleaf = (jprev == -1) ? 1: 2 ; /* j is first or subsequent leaf */ 14 | if (*jleaf == 1) return (i) ; /* if 1st leaf, q = root of ith subtree */ 15 | for (q = jprev ; q != ancestor [q] ; q = ancestor [q]) ; 16 | for (s = jprev ; s != q ; s = sparent) 17 | { 18 | sparent = ancestor [s] ; /* path compression */ 19 | ancestor [s] = q ; 20 | } 21 | return (q) ; /* q = least common ancester (jprev,j) */ 22 | } 23 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_load.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* load a triplet matrix from a file */ 3 | cs *cs_load (FILE *f) 4 | { 5 | double i, j ; /* use double for integers to avoid csi conflicts */ 6 | double x ; 7 | cs *T ; 8 | if (!f) return (NULL) ; /* check inputs */ 9 | T = cs_spalloc (0, 0, 1, 1, 1) ; /* allocate result */ 10 | while (fscanf (f, "%lg %lg %lg\n", &i, &j, &x) == 3) 11 | { 12 | if (!cs_entry (T, (csi) i, (csi) j, x)) return (cs_spfree (T)) ; 13 | } 14 | return (T) ; 15 | } 16 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_lsolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve Lx=b where x and b are dense. x=b on input, solution on output. */ 3 | csi cs_lsolve (const cs *L, double *x) 4 | { 5 | csi p, j, n, *Lp, *Li ; 6 | double *Lx ; 7 | if (!CS_CSC (L) || !x) return (0) ; /* check inputs */ 8 | n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | x [j] /= Lx [Lp [j]] ; 12 | for (p = Lp [j]+1 ; p < Lp [j+1] ; p++) 13 | { 14 | x [Li [p]] -= Lx [p] * x [j] ; 15 | } 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_ltsolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve L'x=b where x and b are dense. x=b on input, solution on output. */ 3 | csi cs_ltsolve (const cs *L, double *x) 4 | { 5 | csi p, j, n, *Lp, *Li ; 6 | double *Lx ; 7 | if (!CS_CSC (L) || !x) return (0) ; /* check inputs */ 8 | n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ; 9 | for (j = n-1 ; j >= 0 ; j--) 10 | { 11 | for (p = Lp [j]+1 ; p < Lp [j+1] ; p++) 12 | { 13 | x [j] -= Lx [p] * x [Li [p]] ; 14 | } 15 | x [j] /= Lx [Lp [j]] ; 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_lusol.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x=A\b where A is unsymmetric; b overwritten with solution */ 3 | csi cs_lusol (csi order, const cs *A, double *b, double tol) 4 | { 5 | double *x ; 6 | css *S ; 7 | csn *N ; 8 | csi n, ok ; 9 | if (!CS_CSC (A) || !b) return (0) ; /* check inputs */ 10 | n = A->n ; 11 | S = cs_sqr (order, A, 0) ; /* ordering and symbolic analysis */ 12 | N = cs_lu (A, S, tol) ; /* numeric LU factorization */ 13 | x = cs_malloc (n, sizeof (double)) ; /* get workspace */ 14 | ok = (S && N && x) ; 15 | if (ok) 16 | { 17 | cs_ipvec (N->pinv, b, x, n) ; /* x = b(p) */ 18 | cs_lsolve (N->L, x) ; /* x = L\x */ 19 | cs_usolve (N->U, x) ; /* x = U\x */ 20 | cs_ipvec (S->q, x, b, n) ; /* b(q) = x */ 21 | } 22 | cs_free (x) ; 23 | cs_sfree (S) ; 24 | cs_nfree (N) ; 25 | return (ok) ; 26 | } 27 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_malloc.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | #ifdef MATLAB_MEX_FILE 3 | #define malloc mxMalloc 4 | #define free mxFree 5 | #define realloc mxRealloc 6 | #define calloc mxCalloc 7 | #endif 8 | 9 | /* wrapper for malloc */ 10 | void *cs_malloc (csi n, size_t size) 11 | { 12 | return (malloc (CS_MAX (n,1) * size)) ; 13 | } 14 | 15 | /* wrapper for calloc */ 16 | void *cs_calloc (csi n, size_t size) 17 | { 18 | return (calloc (CS_MAX (n,1), size)) ; 19 | } 20 | 21 | /* wrapper for free */ 22 | void *cs_free (void *p) 23 | { 24 | if (p) free (p) ; /* free p if it is not already NULL */ 25 | return (NULL) ; /* return NULL to simplify the use of cs_free */ 26 | } 27 | 28 | /* wrapper for realloc */ 29 | void *cs_realloc (void *p, csi n, size_t size, csi *ok) 30 | { 31 | void *pnew ; 32 | pnew = realloc (p, CS_MAX (n,1) * size) ; /* realloc the block */ 33 | *ok = (pnew != NULL) ; /* realloc fails if pnew is NULL */ 34 | return ((*ok) ? pnew : p) ; /* return original p if failure */ 35 | } 36 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_multiply.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* C = A*B */ 3 | cs *cs_multiply (const cs *A, const cs *B) 4 | { 5 | csi p, j, nz = 0, anz, *Cp, *Ci, *Bp, m, n, bnz, *w, values, *Bi ; 6 | double *x, *Bx, *Cx ; 7 | cs *C ; 8 | if (!CS_CSC (A) || !CS_CSC (B)) return (NULL) ; /* check inputs */ 9 | if (A->n != B->m) return (NULL) ; 10 | m = A->m ; anz = A->p [A->n] ; 11 | n = B->n ; Bp = B->p ; Bi = B->i ; Bx = B->x ; bnz = Bp [n] ; 12 | w = cs_calloc (m, sizeof (csi)) ; /* get workspace */ 13 | values = (A->x != NULL) && (Bx != NULL) ; 14 | x = values ? cs_malloc (m, sizeof (double)) : NULL ; /* get workspace */ 15 | C = cs_spalloc (m, n, anz + bnz, values, 0) ; /* allocate result */ 16 | if (!C || !w || (values && !x)) return (cs_done (C, w, x, 0)) ; 17 | Cp = C->p ; 18 | for (j = 0 ; j < n ; j++) 19 | { 20 | if (nz + m > C->nzmax && !cs_sprealloc (C, 2*(C->nzmax)+m)) 21 | { 22 | return (cs_done (C, w, x, 0)) ; /* out of memory */ 23 | } 24 | Ci = C->i ; Cx = C->x ; /* C->i and C->x may be reallocated */ 25 | Cp [j] = nz ; /* column j of C starts here */ 26 | for (p = Bp [j] ; p < Bp [j+1] ; p++) 27 | { 28 | nz = cs_scatter (A, Bi [p], Bx ? Bx [p] : 1, w, x, j+1, C, nz) ; 29 | } 30 | if (values) for (p = Cp [j] ; p < nz ; p++) Cx [p] = x [Ci [p]] ; 31 | } 32 | Cp [n] = nz ; /* finalize the last column of C */ 33 | cs_sprealloc (C, 0) ; /* remove extra space from C */ 34 | return (cs_done (C, w, x, 1)) ; /* success; free workspace, return C */ 35 | } 36 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_norm.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* 1-norm of a sparse matrix = max (sum (abs (A))), largest column sum */ 3 | double cs_norm (const cs *A) 4 | { 5 | csi p, j, n, *Ap ; 6 | double *Ax, norm = 0, s ; 7 | if (!CS_CSC (A) || !A->x) return (-1) ; /* check inputs */ 8 | n = A->n ; Ap = A->p ; Ax = A->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | for (s = 0, p = Ap [j] ; p < Ap [j+1] ; p++) s += fabs (Ax [p]) ; 12 | norm = CS_MAX (norm, s) ; 13 | } 14 | return (norm) ; 15 | } 16 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_permute.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* C = A(p,q) where p and q are permutations of 0..m-1 and 0..n-1. */ 3 | cs *cs_permute (const cs *A, const csi *pinv, const csi *q, csi values) 4 | { 5 | csi t, j, k, nz = 0, m, n, *Ap, *Ai, *Cp, *Ci ; 6 | double *Cx, *Ax ; 7 | cs *C ; 8 | if (!CS_CSC (A)) return (NULL) ; /* check inputs */ 9 | m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 10 | C = cs_spalloc (m, n, Ap [n], values && Ax != NULL, 0) ; /* alloc result */ 11 | if (!C) return (cs_done (C, NULL, NULL, 0)) ; /* out of memory */ 12 | Cp = C->p ; Ci = C->i ; Cx = C->x ; 13 | for (k = 0 ; k < n ; k++) 14 | { 15 | Cp [k] = nz ; /* column k of C is column q[k] of A */ 16 | j = q ? (q [k]) : k ; 17 | for (t = Ap [j] ; t < Ap [j+1] ; t++) 18 | { 19 | if (Cx) Cx [nz] = Ax [t] ; /* row i of A is row pinv[i] of C */ 20 | Ci [nz++] = pinv ? (pinv [Ai [t]]) : Ai [t] ; 21 | } 22 | } 23 | Cp [n] = nz ; /* finalize the last column of C */ 24 | return (cs_done (C, NULL, NULL, 1)) ; 25 | } 26 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_pinv.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* pinv = p', or p = pinv' */ 3 | csi *cs_pinv (csi const *p, csi n) 4 | { 5 | csi k, *pinv ; 6 | if (!p) return (NULL) ; /* p = NULL denotes identity */ 7 | pinv = cs_malloc (n, sizeof (csi)) ; /* allocate result */ 8 | if (!pinv) return (NULL) ; /* out of memory */ 9 | for (k = 0 ; k < n ; k++) pinv [p [k]] = k ;/* invert the permutation */ 10 | return (pinv) ; /* return result */ 11 | } 12 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_post.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* post order a forest */ 3 | csi *cs_post (const csi *parent, csi n) 4 | { 5 | csi j, k = 0, *post, *w, *head, *next, *stack ; 6 | if (!parent) return (NULL) ; /* check inputs */ 7 | post = cs_malloc (n, sizeof (csi)) ; /* allocate result */ 8 | w = cs_malloc (3*n, sizeof (csi)) ; /* get workspace */ 9 | if (!w || !post) return (cs_idone (post, NULL, w, 0)) ; 10 | head = w ; next = w + n ; stack = w + 2*n ; 11 | for (j = 0 ; j < n ; j++) head [j] = -1 ; /* empty linked lists */ 12 | for (j = n-1 ; j >= 0 ; j--) /* traverse nodes in reverse order*/ 13 | { 14 | if (parent [j] == -1) continue ; /* j is a root */ 15 | next [j] = head [parent [j]] ; /* add j to list of its parent */ 16 | head [parent [j]] = j ; 17 | } 18 | for (j = 0 ; j < n ; j++) 19 | { 20 | if (parent [j] != -1) continue ; /* skip j if it is not a root */ 21 | k = cs_tdfs (j, k, head, next, post, stack) ; 22 | } 23 | return (cs_idone (post, NULL, w, 1)) ; /* success; free w, return post */ 24 | } 25 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_print.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* print a sparse matrix; use %g for integers to avoid differences with csi */ 3 | csi cs_print (const cs *A, csi brief) 4 | { 5 | csi p, j, m, n, nzmax, nz, *Ap, *Ai ; 6 | double *Ax ; 7 | if (!A) { printf ("(null)\n") ; return (0) ; } 8 | m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 9 | nzmax = A->nzmax ; nz = A->nz ; 10 | printf ("CSparse Version %d.%d.%d, %s. %s\n", CS_VER, CS_SUBVER, 11 | CS_SUBSUB, CS_DATE, CS_COPYRIGHT) ; 12 | if (nz < 0) 13 | { 14 | printf ("%g-by-%g, nzmax: %g nnz: %g, 1-norm: %g\n", (double) m, 15 | (double) n, (double) nzmax, (double) (Ap [n]), cs_norm (A)) ; 16 | for (j = 0 ; j < n ; j++) 17 | { 18 | printf (" col %g : locations %g to %g\n", (double) j, 19 | (double) (Ap [j]), (double) (Ap [j+1]-1)) ; 20 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 21 | { 22 | printf (" %g : %g\n", (double) (Ai [p]), Ax ? Ax [p] : 1) ; 23 | if (brief && p > 20) { printf (" ...\n") ; return (1) ; } 24 | } 25 | } 26 | } 27 | else 28 | { 29 | printf ("triplet: %g-by-%g, nzmax: %g nnz: %g\n", (double) m, 30 | (double) n, (double) nzmax, (double) nz) ; 31 | for (p = 0 ; p < nz ; p++) 32 | { 33 | printf (" %g %g : %g\n", (double) (Ai [p]), (double) (Ap [p]), 34 | Ax ? Ax [p] : 1) ; 35 | if (brief && p > 20) { printf (" ...\n") ; return (1) ; } 36 | } 37 | } 38 | return (1) ; 39 | } 40 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_pvec.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x = b(p), for dense vectors x and b; p=NULL denotes identity */ 3 | csi cs_pvec (const csi *p, const double *b, double *x, csi n) 4 | { 5 | csi k ; 6 | if (!x || !b) return (0) ; /* check inputs */ 7 | for (k = 0 ; k < n ; k++) x [k] = b [p ? p [k] : k] ; 8 | return (1) ; 9 | } 10 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_randperm.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* return a random permutation vector, the identity perm, or p = n-1:-1:0. 3 | * seed = -1 means p = n-1:-1:0. seed = 0 means p = identity. otherwise 4 | * p = random permutation. */ 5 | csi *cs_randperm (csi n, csi seed) 6 | { 7 | csi *p, k, j, t ; 8 | if (seed == 0) return (NULL) ; /* return p = NULL (identity) */ 9 | p = cs_malloc (n, sizeof (csi)) ; /* allocate result */ 10 | if (!p) return (NULL) ; /* out of memory */ 11 | for (k = 0 ; k < n ; k++) p [k] = n-k-1 ; 12 | if (seed == -1) return (p) ; /* return reverse permutation */ 13 | srand (seed) ; /* get new random number seed */ 14 | for (k = 0 ; k < n ; k++) 15 | { 16 | j = k + (rand ( ) % (n-k)) ; /* j = rand integer in range k to n-1 */ 17 | t = p [j] ; /* swap p[k] and p[j] */ 18 | p [j] = p [k] ; 19 | p [k] = t ; 20 | } 21 | return (p) ; 22 | } 23 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_reach.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* xi [top...n-1] = nodes reachable from graph of G*P' via nodes in B(:,k). 3 | * xi [n...2n-1] used as workspace */ 4 | csi cs_reach (cs *G, const cs *B, csi k, csi *xi, const csi *pinv) 5 | { 6 | csi p, n, top, *Bp, *Bi, *Gp ; 7 | if (!CS_CSC (G) || !CS_CSC (B) || !xi) return (-1) ; /* check inputs */ 8 | n = G->n ; Bp = B->p ; Bi = B->i ; Gp = G->p ; 9 | top = n ; 10 | for (p = Bp [k] ; p < Bp [k+1] ; p++) 11 | { 12 | if (!CS_MARKED (Gp, Bi [p])) /* start a dfs at unmarked node i */ 13 | { 14 | top = cs_dfs (Bi [p], G, top, xi, xi+n, pinv) ; 15 | } 16 | } 17 | for (p = top ; p < n ; p++) CS_MARK (Gp, xi [p]) ; /* restore G */ 18 | return (top) ; 19 | } 20 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_scatter.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* x = x + beta * A(:,j), where x is a dense vector and A(:,j) is sparse */ 3 | csi cs_scatter (const cs *A, csi j, double beta, csi *w, double *x, csi mark, 4 | cs *C, csi nz) 5 | { 6 | csi i, p, *Ap, *Ai, *Ci ; 7 | double *Ax ; 8 | if (!CS_CSC (A) || !w || !CS_CSC (C)) return (-1) ; /* check inputs */ 9 | Ap = A->p ; Ai = A->i ; Ax = A->x ; Ci = C->i ; 10 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 11 | { 12 | i = Ai [p] ; /* A(i,j) is nonzero */ 13 | if (w [i] < mark) 14 | { 15 | w [i] = mark ; /* i is new entry in column j */ 16 | Ci [nz++] = i ; /* add i to pattern of C(:,j) */ 17 | if (x) x [i] = beta * Ax [p] ; /* x(i) = beta*A(i,j) */ 18 | } 19 | else if (x) x [i] += beta * Ax [p] ; /* i exists in C(:,j) already */ 20 | } 21 | return (nz) ; 22 | } 23 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_schol.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* ordering and symbolic analysis for a Cholesky factorization */ 3 | css *cs_schol (csi order, const cs *A) 4 | { 5 | csi n, *c, *post, *P ; 6 | cs *C ; 7 | css *S ; 8 | if (!CS_CSC (A)) return (NULL) ; /* check inputs */ 9 | n = A->n ; 10 | S = cs_calloc (1, sizeof (css)) ; /* allocate result S */ 11 | if (!S) return (NULL) ; /* out of memory */ 12 | P = cs_amd (order, A) ; /* P = amd(A+A'), or natural */ 13 | S->pinv = cs_pinv (P, n) ; /* find inverse permutation */ 14 | cs_free (P) ; 15 | if (order && !S->pinv) return (cs_sfree (S)) ; 16 | C = cs_symperm (A, S->pinv, 0) ; /* C = spones(triu(A(P,P))) */ 17 | S->parent = cs_etree (C, 0) ; /* find etree of C */ 18 | post = cs_post (S->parent, n) ; /* postorder the etree */ 19 | c = cs_counts (C, S->parent, post, 0) ; /* find column counts of chol(C) */ 20 | cs_free (post) ; 21 | cs_spfree (C) ; 22 | S->cp = cs_malloc (n+1, sizeof (csi)) ; /* allocate result S->cp */ 23 | S->unz = S->lnz = cs_cumsum (S->cp, c, n) ; /* find column pointers for L */ 24 | cs_free (c) ; 25 | return ((S->lnz >= 0) ? S : cs_sfree (S)) ; 26 | } 27 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_spsolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve Gx=b(:,k), where G is either upper (lo=0) or lower (lo=1) triangular */ 3 | csi cs_spsolve (cs *G, const cs *B, csi k, csi *xi, double *x, const csi *pinv, 4 | csi lo) 5 | { 6 | csi j, J, p, q, px, top, n, *Gp, *Gi, *Bp, *Bi ; 7 | double *Gx, *Bx ; 8 | if (!CS_CSC (G) || !CS_CSC (B) || !xi || !x) return (-1) ; 9 | Gp = G->p ; Gi = G->i ; Gx = G->x ; n = G->n ; 10 | Bp = B->p ; Bi = B->i ; Bx = B->x ; 11 | top = cs_reach (G, B, k, xi, pinv) ; /* xi[top..n-1]=Reach(B(:,k)) */ 12 | for (p = top ; p < n ; p++) x [xi [p]] = 0 ; /* clear x */ 13 | for (p = Bp [k] ; p < Bp [k+1] ; p++) x [Bi [p]] = Bx [p] ; /* scatter B */ 14 | for (px = top ; px < n ; px++) 15 | { 16 | j = xi [px] ; /* x(j) is nonzero */ 17 | J = pinv ? (pinv [j]) : j ; /* j maps to col J of G */ 18 | if (J < 0) continue ; /* column J is empty */ 19 | x [j] /= Gx [lo ? (Gp [J]) : (Gp [J+1]-1)] ;/* x(j) /= G(j,j) */ 20 | p = lo ? (Gp [J]+1) : (Gp [J]) ; /* lo: L(j,j) 1st entry */ 21 | q = lo ? (Gp [J+1]) : (Gp [J+1]-1) ; /* up: U(j,j) last entry */ 22 | for ( ; p < q ; p++) 23 | { 24 | x [Gi [p]] -= Gx [p] * x [j] ; /* x(i) -= G(i,j) * x(j) */ 25 | } 26 | } 27 | return (top) ; /* return top of stack */ 28 | } 29 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_tdfs.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* depth-first search and postorder of a tree rooted at node j */ 3 | csi cs_tdfs (csi j, csi k, csi *head, const csi *next, csi *post, csi *stack) 4 | { 5 | csi i, p, top = 0 ; 6 | if (!head || !next || !post || !stack) return (-1) ; /* check inputs */ 7 | stack [0] = j ; /* place j on the stack */ 8 | while (top >= 0) /* while (stack is not empty) */ 9 | { 10 | p = stack [top] ; /* p = top of stack */ 11 | i = head [p] ; /* i = youngest child of p */ 12 | if (i == -1) 13 | { 14 | top-- ; /* p has no unordered children left */ 15 | post [k++] = p ; /* node p is the kth postordered node */ 16 | } 17 | else 18 | { 19 | head [p] = next [i] ; /* remove i from children of p */ 20 | stack [++top] = i ; /* start dfs on child node i */ 21 | } 22 | } 23 | return (k) ; 24 | } 25 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_transpose.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* C = A' */ 3 | cs *cs_transpose (const cs *A, csi values) 4 | { 5 | csi p, q, j, *Cp, *Ci, n, m, *Ap, *Ai, *w ; 6 | double *Cx, *Ax ; 7 | cs *C ; 8 | if (!CS_CSC (A)) return (NULL) ; /* check inputs */ 9 | m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ; 10 | C = cs_spalloc (n, m, Ap [n], values && Ax, 0) ; /* allocate result */ 11 | w = cs_calloc (m, sizeof (csi)) ; /* get workspace */ 12 | if (!C || !w) return (cs_done (C, w, NULL, 0)) ; /* out of memory */ 13 | Cp = C->p ; Ci = C->i ; Cx = C->x ; 14 | for (p = 0 ; p < Ap [n] ; p++) w [Ai [p]]++ ; /* row counts */ 15 | cs_cumsum (Cp, w, m) ; /* row pointers */ 16 | for (j = 0 ; j < n ; j++) 17 | { 18 | for (p = Ap [j] ; p < Ap [j+1] ; p++) 19 | { 20 | Ci [q = w [Ai [p]]++] = j ; /* place A(i,j) as entry C(j,i) */ 21 | if (Cx) Cx [q] = Ax [p] ; 22 | } 23 | } 24 | return (cs_done (C, w, NULL, 1)) ; /* success; free w and return C */ 25 | } 26 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_usolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve Ux=b where x and b are dense. x=b on input, solution on output. */ 3 | csi cs_usolve (const cs *U, double *x) 4 | { 5 | csi p, j, n, *Up, *Ui ; 6 | double *Ux ; 7 | if (!CS_CSC (U) || !x) return (0) ; /* check inputs */ 8 | n = U->n ; Up = U->p ; Ui = U->i ; Ux = U->x ; 9 | for (j = n-1 ; j >= 0 ; j--) 10 | { 11 | x [j] /= Ux [Up [j+1]-1] ; 12 | for (p = Up [j] ; p < Up [j+1]-1 ; p++) 13 | { 14 | x [Ui [p]] -= Ux [p] * x [j] ; 15 | } 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/csparse/cs_utsolve.c: -------------------------------------------------------------------------------- 1 | #include "cs.h" 2 | /* solve U'x=b where x and b are dense. x=b on input, solution on output. */ 3 | csi cs_utsolve (const cs *U, double *x) 4 | { 5 | csi p, j, n, *Up, *Ui ; 6 | double *Ux ; 7 | if (!CS_CSC (U) || !x) return (0) ; /* check inputs */ 8 | n = U->n ; Up = U->p ; Ui = U->i ; Ux = U->x ; 9 | for (j = 0 ; j < n ; j++) 10 | { 11 | for (p = Up [j] ; p < Up [j+1]-1 ; p++) 12 | { 13 | x [j] -= Ux [p] * x [Ui [p]] ; 14 | } 15 | x [j] /= Ux [Up [j+1]-1] ; 16 | } 17 | return (1) ; 18 | } 19 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/freeglut/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(freeglut_minimal ${G2O_LIB_TYPE} 2 | freeglut_font.cpp 3 | freeglut_stroke_mono_roman.cpp 4 | freeglut_stroke_roman.cpp 5 | ) 6 | 7 | TARGET_LINK_LIBRARIES(freeglut_minimal ${OPENGL_gl_LIBRARY}) 8 | 9 | SET_TARGET_PROPERTIES(freeglut_minimal PROPERTIES OUTPUT_NAME ${LIB_PREFIX}ext_freeglut_minimal) 10 | 11 | INSTALL(TARGETS freeglut_minimal 12 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 13 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 14 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 15 | ) 16 | 17 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 18 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/freeglut) 19 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/freeglut/COPYING: -------------------------------------------------------------------------------- 1 | 2 | Freeglut Copyright 3 | ------------------ 4 | 5 | Freeglut code without an explicit copyright is covered by the following 6 | copyright: 7 | 8 | Copyright (c) 1999-2000 Pawel W. Olszta. All Rights Reserved. 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies or substantial portions of the Software. 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 | PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 22 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 23 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | Except as contained in this notice, the name of Pawel W. Olszta shall not be 26 | used in advertising or otherwise to promote the sale, use or other dealings 27 | in this Software without prior written authorization from Pawel W. Olszta. 28 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tools/clang"] 2 | path = tools/clang 3 | url = https://github.com/wjakob/clang-cindex-python3 4 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/.readthedocs.yml: -------------------------------------------------------------------------------- 1 | python: 2 | version: 3 3 | requirements_file: docs/requirements.txt 4 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Make sure you've completed the following steps before submitting your issue -- thank you! 2 | 3 | 1. Check if your question has already been answered in the [FAQ](http://pybind11.readthedocs.io/en/latest/faq.html) section. 4 | 2. Make sure you've read the [documentation](http://pybind11.readthedocs.io/en/latest/). Your issue may be addressed there. 5 | 3. If those resources didn't help and you only have a short question (not a bug report), consider asking in the [Gitter chat room](https://gitter.im/pybind/Lobby). 6 | 4. If you have a genuine bug report or a more complex question which is not answered in the previous items (or not suitable for chat), please fill in the details below. 7 | 5. Include a self-contained and minimal piece of code that reproduces the problem. If that's not possible, try to make the description as clear as possible. 8 | 9 | *After reading, remove this checklist and the template text in parentheses below.* 10 | 11 | ## Issue description 12 | 13 | (Provide a short description, state the expected behavior and what actually happens.) 14 | 15 | ## Reproducible example code 16 | 17 | (The code should be minimal, have no external dependencies, isolate the function(s) that cause breakage. Submit matched and complete C++ and Python snippets that can be easily compiled and run to diagnose the issue.) 18 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include include/pybind11 *.h 2 | include LICENSE README.md CONTRIBUTING.md 3 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/Doxyfile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME = pybind11 2 | INPUT = ../include/pybind11/ 3 | RECURSIVE = YES 4 | 5 | GENERATE_HTML = NO 6 | GENERATE_LATEX = NO 7 | GENERATE_XML = YES 8 | XML_OUTPUT = .build/doxygenxml 9 | XML_PROGRAMLISTING = YES 10 | 11 | MACRO_EXPANSION = YES 12 | EXPAND_ONLY_PREDEF = YES 13 | EXPAND_AS_DEFINED = PYBIND11_RUNTIME_EXCEPTION 14 | 15 | ALIASES = "rst=\verbatim embed:rst" 16 | ALIASES += "endrst=\endverbatim" 17 | 18 | QUIET = YES 19 | WARNINGS = YES 20 | WARN_IF_UNDOCUMENTED = NO 21 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/_static/theme_overrides.css: -------------------------------------------------------------------------------- 1 | .wy-table-responsive table td, 2 | .wy-table-responsive table th { 3 | white-space: initial !important; 4 | } 5 | .rst-content table.docutils td { 6 | vertical-align: top !important; 7 | } 8 | div[class^='highlight'] pre { 9 | white-space: pre; 10 | white-space: pre-wrap; 11 | } 12 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/advanced/cast/index.rst: -------------------------------------------------------------------------------- 1 | Type conversions 2 | ################ 3 | 4 | Apart from enabling cross-language function calls, a fundamental problem 5 | that a binding tool like pybind11 must address is to provide access to 6 | native Python types in C++ and vice versa. There are three fundamentally 7 | different ways to do this—which approach is preferable for a particular type 8 | depends on the situation at hand. 9 | 10 | 1. Use a native C++ type everywhere. In this case, the type must be wrapped 11 | using pybind11-generated bindings so that Python can interact with it. 12 | 13 | 2. Use a native Python type everywhere. It will need to be wrapped so that 14 | C++ functions can interact with it. 15 | 16 | 3. Use a native C++ type on the C++ side and a native Python type on the 17 | Python side. pybind11 refers to this as a *type conversion*. 18 | 19 | Type conversions are the most "natural" option in the sense that native 20 | (non-wrapped) types are used everywhere. The main downside is that a copy 21 | of the data must be made on every Python ↔ C++ transition: this is 22 | needed since the C++ and Python versions of the same type generally won't 23 | have the same memory layout. 24 | 25 | pybind11 can perform many kinds of conversions automatically. An overview 26 | is provided in the table ":ref:`conversion_table`". 27 | 28 | The following subsections discuss the differences between these options in more 29 | detail. The main focus in this section is on type conversions, which represent 30 | the last case of the above list. 31 | 32 | .. toctree:: 33 | :maxdepth: 1 34 | 35 | overview 36 | strings 37 | stl 38 | functional 39 | chrono 40 | eigen 41 | custom 42 | 43 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/advanced/pycpp/index.rst: -------------------------------------------------------------------------------- 1 | Python C++ interface 2 | #################### 3 | 4 | pybind11 exposes Python types and functions using thin C++ wrappers, which 5 | makes it possible to conveniently call Python code from C++ without resorting 6 | to Python's C API. 7 | 8 | .. toctree:: 9 | :maxdepth: 2 10 | 11 | object 12 | numpy 13 | utilities 14 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/index.rst: -------------------------------------------------------------------------------- 1 | .. only: not latex 2 | 3 | .. image:: pybind11-logo.png 4 | 5 | pybind11 --- Seamless operability between C++11 and Python 6 | ========================================================== 7 | 8 | .. only: not latex 9 | 10 | Contents: 11 | 12 | .. toctree:: 13 | :maxdepth: 1 14 | 15 | intro 16 | changelog 17 | upgrade 18 | 19 | .. toctree:: 20 | :caption: The Basics 21 | :maxdepth: 2 22 | 23 | basics 24 | classes 25 | compiling 26 | 27 | .. toctree:: 28 | :caption: Advanced Topics 29 | :maxdepth: 2 30 | 31 | advanced/functions 32 | advanced/classes 33 | advanced/exceptions 34 | advanced/smart_ptrs 35 | advanced/cast/index 36 | advanced/pycpp/index 37 | advanced/embedding 38 | advanced/misc 39 | 40 | .. toctree:: 41 | :caption: Extra Information 42 | :maxdepth: 1 43 | 44 | faq 45 | benchmark 46 | limitations 47 | reference 48 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/limitations.rst: -------------------------------------------------------------------------------- 1 | Limitations 2 | ########### 3 | 4 | pybind11 strives to be a general solution to binding generation, but it also has 5 | certain limitations: 6 | 7 | - pybind11 casts away ``const``-ness in function arguments and return values. 8 | This is in line with the Python language, which has no concept of ``const`` 9 | values. This means that some additional care is needed to avoid bugs that 10 | would be caught by the type checker in a traditional C++ program. 11 | 12 | - The NumPy interface ``pybind11::array`` greatly simplifies accessing 13 | numerical data from C++ (and vice versa), but it's not a full-blown array 14 | class like ``Eigen::Array`` or ``boost.multi_array``. 15 | 16 | These features could be implemented but would lead to a significant increase in 17 | complexity. I've decided to draw the line here to keep this project simple and 18 | compact. Users who absolutely require these features are encouraged to fork 19 | pybind11. 20 | 21 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/pybind11-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/g2opy/EXTERNAL/pybind11/docs/pybind11-logo.png -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/pybind11_vs_boost_python1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/g2opy/EXTERNAL/pybind11/docs/pybind11_vs_boost_python1.png -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/pybind11_vs_boost_python2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/g2opy/EXTERNAL/pybind11/docs/pybind11_vs_boost_python2.png -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/release.rst: -------------------------------------------------------------------------------- 1 | To release a new version of pybind11: 2 | 3 | - Update the version number and push to pypi 4 | - Update ``pybind11/_version.py`` (set release version, remove 'dev'). 5 | - Update ``PYBIND11_VERSION_MAJOR`` etc. in ``include/pybind11/detail/common.h``. 6 | - Ensure that all the information in ``setup.py`` is up-to-date. 7 | - Update version in ``docs/conf.py``. 8 | - Tag release date in ``docs/changelog.rst``. 9 | - ``git add`` and ``git commit``. 10 | - if new minor version: ``git checkout -b vX.Y``, ``git push -u origin vX.Y`` 11 | - ``git tag -a vX.Y.Z -m 'vX.Y.Z release'``. 12 | - ``git push`` 13 | - ``git push --tags``. 14 | - ``python setup.py sdist upload``. 15 | - ``python setup.py bdist_wheel upload``. 16 | - Update conda-forge (https://github.com/conda-forge/pybind11-feedstock) via PR 17 | - download release package from Github: ``wget https://github.com/pybind/pybind11/archive/vX.Y.Z.tar.gz`` 18 | - compute checksum: ``shasum -a 256 vX.Y.Z.tar.gz`` 19 | - change version number and checksum in ``recipe/meta.yml`` 20 | - Get back to work 21 | - Update ``_version.py`` (add 'dev' and increment minor). 22 | - Update version in ``docs/conf.py`` 23 | - Update version macros in ``include/pybind11/common.h`` 24 | - ``git add`` and ``git commit``. 25 | ``git push`` 26 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/docs/requirements.txt: -------------------------------------------------------------------------------- 1 | breathe == 4.5.0 2 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/include/pybind11/common.h: -------------------------------------------------------------------------------- 1 | #include "detail/common.h" 2 | #warning "Including 'common.h' is deprecated. It will be removed in v3.0. Use 'pybind11.h'." 3 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/include/pybind11/detail/typeid.h: -------------------------------------------------------------------------------- 1 | /* 2 | pybind11/detail/typeid.h: Compiler-independent access to type identifiers 3 | 4 | Copyright (c) 2016 Wenzel Jakob 5 | 6 | All rights reserved. Use of this source code is governed by a 7 | BSD-style license that can be found in the LICENSE file. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | #if defined(__GNUG__) 16 | #include 17 | #endif 18 | 19 | NAMESPACE_BEGIN(PYBIND11_NAMESPACE) 20 | NAMESPACE_BEGIN(detail) 21 | /// Erase all occurrences of a substring 22 | inline void erase_all(std::string &string, const std::string &search) { 23 | for (size_t pos = 0;;) { 24 | pos = string.find(search, pos); 25 | if (pos == std::string::npos) break; 26 | string.erase(pos, search.length()); 27 | } 28 | } 29 | 30 | PYBIND11_NOINLINE inline void clean_type_id(std::string &name) { 31 | #if defined(__GNUG__) 32 | int status = 0; 33 | std::unique_ptr res { 34 | abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status), std::free }; 35 | if (status == 0) 36 | name = res.get(); 37 | #else 38 | detail::erase_all(name, "class "); 39 | detail::erase_all(name, "struct "); 40 | detail::erase_all(name, "enum "); 41 | #endif 42 | detail::erase_all(name, "pybind11::"); 43 | } 44 | NAMESPACE_END(detail) 45 | 46 | /// Return a string representation of a C++ type 47 | template static std::string type_id() { 48 | std::string name(typeid(T).name()); 49 | detail::clean_type_id(name); 50 | return name; 51 | } 52 | 53 | NAMESPACE_END(PYBIND11_NAMESPACE) 54 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/pybind11/__init__.py: -------------------------------------------------------------------------------- 1 | from ._version import version_info, __version__ # noqa: F401 imported but unused 2 | 3 | 4 | def get_include(*args, **kwargs): 5 | import os 6 | try: 7 | from pip import locations 8 | return os.path.dirname( 9 | locations.distutils_scheme('pybind11', *args, **kwargs)['headers']) 10 | except ImportError: 11 | return 'include' 12 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/pybind11/__main__.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | import argparse 4 | import sys 5 | import sysconfig 6 | 7 | from . import get_include 8 | 9 | 10 | def print_includes(): 11 | dirs = [sysconfig.get_path('include'), 12 | sysconfig.get_path('platinclude'), 13 | get_include(), 14 | get_include(True)] 15 | 16 | # Make unique but preserve order 17 | unique_dirs = [] 18 | for d in dirs: 19 | if d not in unique_dirs: 20 | unique_dirs.append(d) 21 | 22 | print(' '.join('-I' + d for d in unique_dirs)) 23 | 24 | 25 | def main(): 26 | parser = argparse.ArgumentParser(prog='python -m pybind11') 27 | parser.add_argument('--includes', action='store_true', 28 | help='Include flags for both pybind11 and Python headers.') 29 | args = parser.parse_args() 30 | if not sys.argv[1:]: 31 | parser.print_help() 32 | if args.includes: 33 | print_includes() 34 | 35 | 36 | if __name__ == '__main__': 37 | main() 38 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/pybind11/_version.py: -------------------------------------------------------------------------------- 1 | version_info = (2, 2, 1) 2 | __version__ = '.'.join(map(str, version_info)) 3 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | 4 | [flake8] 5 | max-line-length = 99 6 | show_source = True 7 | exclude = .git, __pycache__, build, dist, docs, tools, venv 8 | ignore = 9 | # required for pretty matrix formating: multiple spaces after `,` and `[` 10 | E201, E241 11 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | minversion = 3.0 3 | norecursedirs = test_cmake_build test_embed 4 | addopts = 5 | # show summary of skipped tests 6 | -rs 7 | # capture only Python print and C++ py::print, but not C output (low-level Python errors) 8 | --capture=sys 9 | filterwarnings = 10 | # make warnings into errors but ignore certain third-party extension issues 11 | error 12 | # importing scipy submodules on some version of Python 13 | ignore::ImportWarning 14 | # bogus numpy ABI warning (see numpy/#432) 15 | ignore:.*numpy.dtype size changed.*:RuntimeWarning 16 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_cmake_build/embed.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | namespace py = pybind11; 3 | 4 | PYBIND11_EMBEDDED_MODULE(test_cmake_build, m) { 5 | m.def("add", [](int i, int j) { return i + j; }); 6 | } 7 | 8 | int main(int argc, char *argv[]) { 9 | if (argc != 2) 10 | throw std::runtime_error("Expected test.py file as the first argument"); 11 | auto test_py_file = argv[1]; 12 | 13 | py::scoped_interpreter guard{}; 14 | 15 | auto m = py::module::import("test_cmake_build"); 16 | if (m.attr("add")(1, 2).cast() != 3) 17 | throw std::runtime_error("embed.cpp failed"); 18 | 19 | py::module::import("sys").attr("argv") = py::make_tuple("test.py", "embed.cpp"); 20 | py::eval_file(test_py_file, py::globals()); 21 | } 22 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | project(test_installed_embed CXX) 3 | 4 | set(CMAKE_MODULE_PATH "") 5 | find_package(pybind11 CONFIG REQUIRED) 6 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}") 7 | 8 | add_executable(test_cmake_build ../embed.cpp) 9 | target_link_libraries(test_cmake_build PRIVATE pybind11::embed) 10 | 11 | # Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::embed). 12 | # This may be needed to resolve header conflicts, e.g. between Python release and debug headers. 13 | set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON) 14 | 15 | add_custom_target(check $ ${PROJECT_SOURCE_DIR}/../test.py) 16 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | project(test_installed_module CXX) 3 | 4 | set(CMAKE_MODULE_PATH "") 5 | 6 | find_package(pybind11 CONFIG REQUIRED) 7 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}") 8 | 9 | pybind11_add_module(test_cmake_build SHARED NO_EXTRAS ../main.cpp) 10 | 11 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$ 12 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME}) 13 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | project(test_installed_target CXX) 3 | 4 | set(CMAKE_MODULE_PATH "") 5 | 6 | find_package(pybind11 CONFIG REQUIRED) 7 | message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}") 8 | 9 | add_library(test_cmake_build MODULE ../main.cpp) 10 | 11 | target_link_libraries(test_cmake_build PRIVATE pybind11::module) 12 | 13 | # make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib 14 | set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}" 15 | SUFFIX "${PYTHON_MODULE_EXTENSION}") 16 | 17 | # Do not treat includes from IMPORTED target as SYSTEM (Python headers in pybind11::module). 18 | # This may be needed to resolve header conflicts, e.g. between Python release and debug headers. 19 | set_target_properties(test_cmake_build PROPERTIES NO_SYSTEM_FROM_IMPORTED ON) 20 | 21 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$ 22 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME}) 23 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_cmake_build/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | namespace py = pybind11; 3 | 4 | PYBIND11_MODULE(test_cmake_build, m) { 5 | m.def("add", [](int i, int j) { return i + j; }); 6 | } 7 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | project(test_subdirectory_embed CXX) 3 | 4 | set(PYBIND11_INSTALL ON CACHE BOOL "") 5 | set(PYBIND11_EXPORT_NAME test_export) 6 | 7 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11) 8 | 9 | # Test basic target functionality 10 | add_executable(test_cmake_build ../embed.cpp) 11 | target_link_libraries(test_cmake_build PRIVATE pybind11::embed) 12 | 13 | add_custom_target(check $ ${PROJECT_SOURCE_DIR}/../test.py) 14 | 15 | # Test custom export group -- PYBIND11_EXPORT_NAME 16 | add_library(test_embed_lib ../embed.cpp) 17 | target_link_libraries(test_embed_lib PRIVATE pybind11::embed) 18 | 19 | install(TARGETS test_embed_lib 20 | EXPORT test_export 21 | ARCHIVE DESTINATION bin 22 | LIBRARY DESTINATION lib 23 | RUNTIME DESTINATION lib) 24 | install(EXPORT test_export 25 | DESTINATION lib/cmake/test_export/test_export-Targets.cmake) 26 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | project(test_subdirectory_module CXX) 3 | 4 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11) 5 | pybind11_add_module(test_cmake_build THIN_LTO ../main.cpp) 6 | 7 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$ 8 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME}) 9 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0) 2 | project(test_subdirectory_target CXX) 3 | 4 | add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11) 5 | 6 | add_library(test_cmake_build MODULE ../main.cpp) 7 | 8 | target_link_libraries(test_cmake_build PRIVATE pybind11::module) 9 | 10 | # make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib 11 | set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}" 12 | SUFFIX "${PYTHON_MODULE_EXTENSION}") 13 | 14 | add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$ 15 | ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME}) 16 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_cmake_build/test.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import test_cmake_build 3 | 4 | assert test_cmake_build.add(1, 2) == 3 5 | print("{} imports, runs, and adds: 1 + 2 = 3".format(sys.argv[1])) 6 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_constants_and_functions.py: -------------------------------------------------------------------------------- 1 | from pybind11_tests import constants_and_functions as m 2 | 3 | 4 | def test_constants(): 5 | assert m.some_constant == 14 6 | 7 | 8 | def test_function_overloading(): 9 | assert m.test_function() == "test_function()" 10 | assert m.test_function(7) == "test_function(7)" 11 | assert m.test_function(m.MyEnum.EFirstEntry) == "test_function(enum=1)" 12 | assert m.test_function(m.MyEnum.ESecondEntry) == "test_function(enum=2)" 13 | 14 | assert m.test_function() == "test_function()" 15 | assert m.test_function("abcd") == "test_function(char *)" 16 | assert m.test_function(1, 1.0) == "test_function(int, float)" 17 | assert m.test_function(1, 1.0) == "test_function(int, float)" 18 | assert m.test_function(2.0, 2) == "test_function(float, int)" 19 | 20 | 21 | def test_bytes(): 22 | assert m.print_bytes(m.return_bytes()) == "bytes[1 0 2 0]" 23 | 24 | 25 | def test_exception_specifiers(): 26 | c = m.C() 27 | assert c.m1(2) == 1 28 | assert c.m2(3) == 1 29 | assert c.m3(5) == 2 30 | assert c.m4(7) == 3 31 | assert c.m5(10) == 5 32 | assert c.m6(14) == 8 33 | assert c.m7(20) == 13 34 | assert c.m8(29) == 21 35 | 36 | assert m.f1(33) == 34 37 | assert m.f2(53) == 55 38 | assert m.f3(86) == 89 39 | assert m.f4(140) == 144 40 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_docstring_options.py: -------------------------------------------------------------------------------- 1 | from pybind11_tests import docstring_options as m 2 | 3 | 4 | def test_docstring_options(): 5 | # options.disable_function_signatures() 6 | assert not m.test_function1.__doc__ 7 | 8 | assert m.test_function2.__doc__ == "A custom docstring" 9 | 10 | # docstring specified on just the first overload definition: 11 | assert m.test_overloaded1.__doc__ == "Overload docstring" 12 | 13 | # docstring on both overloads: 14 | assert m.test_overloaded2.__doc__ == "overload docstring 1\noverload docstring 2" 15 | 16 | # docstring on only second overload: 17 | assert m.test_overloaded3.__doc__ == "Overload docstr" 18 | 19 | # options.enable_function_signatures() 20 | assert m.test_function3.__doc__ .startswith("test_function3(a: int, b: int) -> None") 21 | 22 | assert m.test_function4.__doc__ .startswith("test_function4(a: int, b: int) -> None") 23 | assert m.test_function4.__doc__ .endswith("A custom docstring\n") 24 | 25 | # options.disable_function_signatures() 26 | # options.disable_user_defined_docstrings() 27 | assert not m.test_function5.__doc__ 28 | 29 | # nested options.enable_user_defined_docstrings() 30 | assert m.test_function6.__doc__ == "A custom docstring" 31 | 32 | # RAII destructor 33 | assert m.test_function7.__doc__ .startswith("test_function7(a: int, b: int) -> None") 34 | assert m.test_function7.__doc__ .endswith("A custom docstring\n") 35 | 36 | # Suppression of user-defined docstrings for non-function objects 37 | assert not m.DocstringTestFoo.__doc__ 38 | assert not m.DocstringTestFoo.value_prop.__doc__ 39 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_embed/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(${PYTHON_MODULE_EXTENSION} MATCHES "pypy") 2 | add_custom_target(cpptest) # Dummy target on PyPy. Embedding is not supported. 3 | set(_suppress_unused_variable_warning "${DOWNLOAD_CATCH}") 4 | return() 5 | endif() 6 | 7 | find_package(Catch 1.9.3) 8 | if(NOT CATCH_FOUND) 9 | message(STATUS "Catch not detected. Interpreter tests will be skipped. Install Catch headers" 10 | " manually or use `cmake -DDOWNLOAD_CATCH=1` to fetch them automatically.") 11 | return() 12 | endif() 13 | 14 | add_executable(test_embed 15 | catch.cpp 16 | test_interpreter.cpp 17 | ) 18 | target_include_directories(test_embed PRIVATE ${CATCH_INCLUDE_DIR}) 19 | pybind11_enable_warnings(test_embed) 20 | 21 | if(NOT CMAKE_VERSION VERSION_LESS 3.0) 22 | target_link_libraries(test_embed PRIVATE pybind11::embed) 23 | else() 24 | target_include_directories(test_embed PRIVATE ${PYBIND11_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS}) 25 | target_compile_options(test_embed PRIVATE ${PYBIND11_CPP_STANDARD}) 26 | target_link_libraries(test_embed PRIVATE ${PYTHON_LIBRARIES}) 27 | endif() 28 | 29 | find_package(Threads REQUIRED) 30 | target_link_libraries(test_embed PUBLIC ${CMAKE_THREAD_LIBS_INIT}) 31 | 32 | add_custom_target(cpptest COMMAND $ 33 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 34 | add_dependencies(check cpptest) 35 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_embed/catch.cpp: -------------------------------------------------------------------------------- 1 | // The Catch implementation is compiled here. This is a standalone 2 | // translation unit to avoid recompiling it for every test change. 3 | 4 | #include 5 | 6 | #define CATCH_CONFIG_RUNNER 7 | #include 8 | 9 | namespace py = pybind11; 10 | 11 | int main(int argc, const char *argv[]) { 12 | py::scoped_interpreter guard{}; 13 | auto result = Catch::Session().run(argc, argv); 14 | 15 | return result < 0xff ? result : 0xff; 16 | } 17 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_embed/test_interpreter.py: -------------------------------------------------------------------------------- 1 | from widget_module import Widget 2 | 3 | 4 | class DerivedWidget(Widget): 5 | def __init__(self, message): 6 | super(DerivedWidget, self).__init__(message) 7 | 8 | def the_answer(self): 9 | return 42 10 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_eval.py: -------------------------------------------------------------------------------- 1 | import os 2 | from pybind11_tests import eval_ as m 3 | 4 | 5 | def test_evals(capture): 6 | with capture: 7 | assert m.test_eval_statements() 8 | assert capture == "Hello World!" 9 | 10 | assert m.test_eval() 11 | assert m.test_eval_single_statement() 12 | 13 | filename = os.path.join(os.path.dirname(__file__), "test_eval_call.py") 14 | assert m.test_eval_file(filename) 15 | 16 | assert m.test_eval_failure() 17 | assert m.test_eval_file_failure() 18 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_eval_call.py: -------------------------------------------------------------------------------- 1 | # This file is called from 'test_eval.py' 2 | 3 | if 'call_test2' in locals(): 4 | call_test2(y) # noqa: F821 undefined name 5 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tests/test_pickling.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from pybind11_tests import pickling as m 3 | 4 | try: 5 | import cPickle as pickle # Use cPickle on Python 2.7 6 | except ImportError: 7 | import pickle 8 | 9 | 10 | @pytest.mark.parametrize("cls_name", ["Pickleable", "PickleableNew"]) 11 | def test_roundtrip(cls_name): 12 | cls = getattr(m, cls_name) 13 | p = cls("test_value") 14 | p.setExtra1(15) 15 | p.setExtra2(48) 16 | 17 | data = pickle.dumps(p, 2) # Must use pickle protocol >= 2 18 | p2 = pickle.loads(data) 19 | assert p2.value() == p.value() 20 | assert p2.extra1() == p.extra1() 21 | assert p2.extra2() == p.extra2() 22 | 23 | 24 | @pytest.unsupported_on_pypy 25 | @pytest.mark.parametrize("cls_name", ["PickleableWithDict", "PickleableWithDictNew"]) 26 | def test_roundtrip_with_dict(cls_name): 27 | cls = getattr(m, cls_name) 28 | p = cls("test_value") 29 | p.extra = 15 30 | p.dynamic = "Attribute" 31 | 32 | data = pickle.dumps(p, pickle.HIGHEST_PROTOCOL) 33 | p2 = pickle.loads(data) 34 | assert p2.value == p.value 35 | assert p2.extra == p.extra 36 | assert p2.dynamic == p.dynamic 37 | -------------------------------------------------------------------------------- /g2opy/EXTERNAL/pybind11/tools/libsize.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function, division 2 | import os 3 | import sys 4 | 5 | # Internal build script for generating debugging test .so size. 6 | # Usage: 7 | # python libsize.py file.so save.txt -- displays the size of file.so and, if save.txt exists, compares it to the 8 | # size in it, then overwrites save.txt with the new size for future runs. 9 | 10 | if len(sys.argv) != 3: 11 | sys.exit("Invalid arguments: usage: python libsize.py file.so save.txt") 12 | 13 | lib = sys.argv[1] 14 | save = sys.argv[2] 15 | 16 | if not os.path.exists(lib): 17 | sys.exit("Error: requested file ({}) does not exist".format(lib)) 18 | 19 | libsize = os.path.getsize(lib) 20 | 21 | print("------", os.path.basename(lib), "file size:", libsize, end='') 22 | 23 | if os.path.exists(save): 24 | with open(save) as sf: 25 | oldsize = int(sf.readline()) 26 | 27 | if oldsize > 0: 28 | change = libsize - oldsize 29 | if change == 0: 30 | print(" (no change)") 31 | else: 32 | print(" (change of {:+} bytes = {:+.2%})".format(change, change / oldsize)) 33 | else: 34 | print() 35 | 36 | with open(save, 'w') as sf: 37 | sf.write(str(libsize)) 38 | 39 | -------------------------------------------------------------------------------- /g2opy/Makefile: -------------------------------------------------------------------------------- 1 | SHELL = /bin/bash 2 | 3 | ifeq ($(VERBOSE), 1) 4 | QUIET= 5 | else 6 | QUIET=-s --no-print-directory 7 | endif 8 | 9 | all: build/Makefile 10 | @ $(MAKE) $(QUIET) -C build 11 | 12 | debug: build/Makefile 13 | @ $(MAKE) $(QUIET) -C build 14 | 15 | clean: build/Makefile 16 | @ $(MAKE) $(QUIET) -C build clean 17 | 18 | build/Makefile: 19 | @ echo "Running cmake to generate Makefile"; \ 20 | cd build; \ 21 | cmake ../; \ 22 | cd - 23 | 24 | -------------------------------------------------------------------------------- /g2opy/appveyor.yml: -------------------------------------------------------------------------------- 1 | branches: 2 | only: 3 | - master 4 | 5 | os: Visual Studio 2015 6 | 7 | clone_folder: c:\projects\g2o 8 | 9 | platform: x64 10 | configuration: Release 11 | 12 | build: 13 | project: c:\projects\g2o\build\g2o.sln 14 | 15 | install: 16 | - set QTDIR=C:\Qt\5.8\msvc2015_64 17 | - set PATH=%PATH%;%QTDIR%\bin 18 | - ps: wget http://bitbucket.org/eigen/eigen/get/3.3.3.zip -outfile eigen3.zip 19 | - cmd: 7z x eigen3.zip -o"C:\projects" -y > nul 20 | 21 | before_build: 22 | - cd c:\projects\g2o 23 | - mkdir build 24 | - cd build 25 | - cmake -G "Visual Studio 14 2015 Win64" -D EIGEN3_INCLUDE_DIR=C:\projects\eigen-eigen-67e894c6cd8f .. 26 | -------------------------------------------------------------------------------- /g2opy/cmake_modules/FindCSparse.cmake: -------------------------------------------------------------------------------- 1 | # Look for csparse; note the difference in the directory specifications! 2 | FIND_PATH(CSPARSE_INCLUDE_DIR NAMES cs.h 3 | PATHS 4 | /usr/include/suitesparse 5 | /usr/include 6 | /opt/local/include 7 | /usr/local/include 8 | /sw/include 9 | /usr/include/ufsparse 10 | /opt/local/include/ufsparse 11 | /usr/local/include/ufsparse 12 | /sw/include/ufsparse 13 | ) 14 | 15 | FIND_LIBRARY(CSPARSE_LIBRARY NAMES cxsparse 16 | PATHS 17 | /usr/lib 18 | /usr/local/lib 19 | /opt/local/lib 20 | /sw/lib 21 | ) 22 | 23 | include(FindPackageHandleStandardArgs) 24 | find_package_handle_standard_args(CSPARSE DEFAULT_MSG 25 | CSPARSE_INCLUDE_DIR CSPARSE_LIBRARY) 26 | -------------------------------------------------------------------------------- /g2opy/cmake_modules/FindQGLViewer.cmake: -------------------------------------------------------------------------------- 1 | FIND_PACKAGE(Qt5 COMPONENTS Core Xml OpenGL Gui Widgets) 2 | IF(NOT Qt5_FOUND) 3 | MESSAGE("Qt5 not found. Install it and set Qt5_DIR accordingly") 4 | IF (WIN32) 5 | MESSAGE(" In Windows, Qt5_DIR should be something like C:/Qt/5.4/msvc2013_64_opengl/lib/cmake/Qt5") 6 | ENDIF() 7 | ENDIF() 8 | 9 | FIND_PATH(QGLVIEWER_INCLUDE_DIR qglviewer.h 10 | /usr/include/QGLViewer 11 | /opt/local/include/QGLViewer 12 | /usr/local/include/QGLViewer 13 | /sw/include/QGLViewer 14 | ENV QGLVIEWERROOT 15 | ) 16 | 17 | find_library(QGLVIEWER_LIBRARY_RELEASE 18 | NAMES qglviewer QGLViewer qglviewer-qt5 QGLViewer-qt5 19 | PATHS /usr/lib 20 | /usr/local/lib 21 | /opt/local/lib 22 | /sw/lib 23 | ENV QGLVIEWERROOT 24 | ENV LD_LIBRARY_PATH 25 | ENV LIBRARY_PATH 26 | PATH_SUFFIXES QGLViewer QGLViewer/release 27 | ) 28 | find_library(QGLVIEWER_LIBRARY_DEBUG 29 | NAMES dqglviewer dQGLViewer dqglviewer-qt5 dQGLViewer-qt5 QGLViewerd2 30 | PATHS /usr/lib 31 | /usr/local/lib 32 | /opt/local/lib 33 | /sw/lib 34 | ENV QGLVIEWERROOT 35 | ENV LD_LIBRARY_PATH 36 | ENV LIBRARY_PATH 37 | PATH_SUFFIXES QGLViewer QGLViewer/debug 38 | ) 39 | 40 | if(QGLVIEWER_LIBRARY_RELEASE) 41 | if(QGLVIEWER_LIBRARY_DEBUG) 42 | set(QGLVIEWER_LIBRARY optimized ${QGLVIEWER_LIBRARY_RELEASE} debug ${QGLVIEWER_LIBRARY_DEBUG}) 43 | else() 44 | set(QGLVIEWER_LIBRARY ${QGLVIEWER_LIBRARY_RELEASE}) 45 | endif() 46 | endif() 47 | 48 | include(FindPackageHandleStandardArgs) 49 | find_package_handle_standard_args(QGLVIEWER DEFAULT_MSG 50 | QGLVIEWER_INCLUDE_DIR QGLVIEWER_LIBRARY) 51 | -------------------------------------------------------------------------------- /g2opy/config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef G2O_CONFIG_H 2 | #define G2O_CONFIG_H 3 | 4 | 5 | #cmakedefine G2O_HAVE_OPENGL 1 6 | #cmakedefine G2O_OPENGL_FOUND 1 7 | #cmakedefine G2O_OPENMP 1 8 | #cmakedefine G2O_SHARED_LIBS 1 9 | #cmakedefine G2O_LGPL_SHARED_LIBS 1 10 | 11 | // available sparse matrix libraries 12 | #cmakedefine G2O_HAVE_CHOLMOD 1 13 | #cmakedefine G2O_HAVE_CSPARSE 1 14 | 15 | #cmakedefine G2O_NO_IMPLICIT_OWNERSHIP_OF_OBJECTS 16 | 17 | #ifdef G2O_NO_IMPLICIT_OWNERSHIP_OF_OBJECTS 18 | #define G2O_DELETE_IMPLICITLY_OWNED_OBJECTS 0 19 | #else 20 | #define G2O_DELETE_IMPLICITLY_OWNED_OBJECTS 1 21 | #endif 22 | 23 | #cmakedefine G2O_CXX_COMPILER "@G2O_CXX_COMPILER@" 24 | 25 | #ifdef __cplusplus 26 | #include 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /g2opy/contrib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${PROJECT_SOURCE_DIR}) 2 | 3 | 4 | add_library(contrib SHARED ${G2O_LIB_TYPE} 5 | sba_addons/types_stereo_sba.cpp 6 | estimate_propagator/SmoothEstimatePropagator.hpp 7 | estimate_propagator/SmoothEstimatePropagator.cpp 8 | ) 9 | 10 | 11 | set_target_properties(contrib PROPERTIES OUTPUT_NAME ${LIB_PREFIX}contrib) 12 | target_link_libraries(contrib 13 | core 14 | types_sba 15 | ) -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/.Rhistory: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/g2opy/contrib/vertigo/.Rhistory -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project (vertigo) 4 | 5 | # we have our own find script for g2o 6 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake-modules/") 7 | 8 | # check if we have gtsam and / or g2o 9 | find_package(GTSAM) 10 | find_package(G2O) 11 | 12 | # set compiler options depending on build type 13 | SET(CMAKE_BUILD_TYPE Release) 14 | if("${CMAKE_BUILD_TYPE}" STREQUAL "") 15 | set(CMAKE_BUILD_TYPE Release) 16 | endif() 17 | 18 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfpmath=sse -msse3 -fPIC -O3 -DNDEBUG") 19 | set(CMAKE_LD_FLAGS_RELEASE "${CMAKE_LD_FLAGS_RELEASE} -O3") 20 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC -ggdb") 21 | 22 | 23 | add_subdirectory(src) 24 | add_subdirectory(examples) 25 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/datasets/city10000/originalDataset/README: -------------------------------------------------------------------------------- 1 | This dataset is courtesy of Michael Kaess and was published along with iSAM2: 2 | 3 | M. Kaess, H. Johannsson, R. Roberts, V. Ila, J.J. Leonard, and F. Dellaert 4 | "iSAM2: Incremental Smoothing and Mapping Using the Bayes Tree", 5 | International Journal of Robotics Research, 6 | vol. 31, Feb. 2012, pp. 217-236. 7 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/datasets/sphere2500/originalDataset/README: -------------------------------------------------------------------------------- 1 | This dataset is courtesy of Michael Kaess and was published along with iSAM2: 2 | 3 | M. Kaess, H. Johannsson, R. Roberts, V. Ila, J.J. Leonard, and F. Dellaert 4 | "iSAM2: Incremental Smoothing and Mapping Using the Bayes Tree", 5 | International Journal of Robotics Research, 6 | vol. 31, Feb. 2012, pp. 217-236. 7 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (GTSAM_FOUND) 2 | add_subdirectory(robustISAM2) 3 | endif() 4 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/examples/robustISAM2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project (robustISAM2) 4 | 5 | # GTSAM is required 6 | find_package(GTSAM REQUIRED) 7 | 8 | find_package(Eigen3 REQUIRED) 9 | 10 | # boost is required 11 | find_package(Boost 1.46 COMPONENTS program_options REQUIRED) 12 | 13 | # specify our own source files that need to be compiled and linked into the lib 14 | include_directories(${PROJECT_SOURCE_DIR}/../../include) 15 | include_directories(${PROJECT_SOURCE_DIR}/../../include/gtsam2) 16 | include_directories(${GTSAM_INCLUDE_DIR} ${Boost_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR}) 17 | set (LINK_LIBRARIES ${LINK_LIBRARIES} vertigo-gtsam ${GTSAM_LIBS} ${Boost_LIBRARIES} ${EIGEN3_LIBRARIES}) 18 | 19 | add_executable(robustISAM2 robustISAM2.cpp) 20 | target_link_libraries(robustISAM2 ${LINK_LIBRARIES}) 21 | 22 | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}) # specify where the resulting binaries should be created 23 | 24 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/examples/robustISAM2/parseResults.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys 4 | 5 | 6 | f=file(sys.argv[1], 'r'); 7 | 8 | ll = f.readlines() 9 | 10 | poses = file('poses.txt', 'w') 11 | edges = file('edges.txt', 'w') 12 | switches = file('switches.txt', 'w') 13 | 14 | for l in [x for x in ll if x.startswith('VERTEX_SE2')]: 15 | l=l.split() 16 | s = ' '.join(l[1:]) + '\n' 17 | poses.write(s) 18 | 19 | 20 | for l in [x for x in ll if x.startswith('EDGE_SE2 ')]: 21 | l=l.split() 22 | s = ' '.join(l[1:]) + '\n' 23 | edges.write(s) 24 | 25 | 26 | 27 | for l in [x for x in ll if x.startswith('EDGE_SE2_SWITCHABLE')]: 28 | l=l.split() 29 | s = ' '.join(l[1:]) + '\n' 30 | edges.write(s) 31 | 32 | for l in [x for x in ll if x.startswith('EDGE_SE2_MAXMIX')]: 33 | l=l.split() 34 | s = ' '.join(l[1:]) + '\n' 35 | edges.write(s) 36 | 37 | 38 | for l in [x for x in ll if x.startswith('VERTEX_SWITCH')]: 39 | l=l.split() 40 | s = l[-1] + '\n' 41 | switches.write(s) 42 | 43 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/include/g2o/edge_se2MaxMixture.h: -------------------------------------------------------------------------------- 1 | /* 2 | * edge_se2MaxMixture.h 3 | * 4 | * Created on: 12.06.2012 5 | * Author: niko 6 | */ 7 | 8 | #ifndef EDGE_SE2MAXMIXTURE_H_ 9 | #define EDGE_SE2MAXMIXTURE_H_ 10 | 11 | #include "g2o/types/slam2d/vertex_se2.h" 12 | #include "g2o/types/slam2d/edge_se2.h" 13 | 14 | 15 | class EdgeSE2MaxMixture : public g2o::EdgeSE2 16 | { 17 | public: 18 | EdgeSE2MaxMixture(); 19 | 20 | virtual bool read(std::istream& is); 21 | virtual bool write(std::ostream& os) const; 22 | void computeError(); 23 | void linearizeOplus(); 24 | 25 | double weight; 26 | 27 | bool nullHypothesisMoreLikely; 28 | 29 | InformationType information_nullHypothesis; 30 | double nu_nullHypothesis; 31 | InformationType information_constraint; 32 | double nu_constraint ; 33 | }; 34 | 35 | 36 | #ifdef G2O_HAVE_OPENGL 37 | class EdgeSE2MaxMixtureDrawAction: public g2o::DrawAction{ 38 | public: 39 | EdgeSE2MaxMixtureDrawAction(); 40 | virtual g2o::HyperGraphElementAction* operator()(g2o::HyperGraph::HyperGraphElement* element, 41 | g2o::HyperGraphElementAction::Parameters* params_); 42 | }; 43 | #endif 44 | 45 | 46 | #endif /* EDGE_SE2MAXMIXTURE_H_ */ 47 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/include/g2o/edge_se2Switchable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * edge_se2Switchable.h 3 | * 4 | * Created on: 13.07.2011 5 | * Author: niko 6 | */ 7 | 8 | #ifndef EDGE_SE2SWITCHABLE_H_ 9 | #define EDGE_SE2SWITCHABLE_H_ 10 | 11 | #include "g2o/types/slam2d/vertex_se2.h" 12 | #include "g2o/core/base_multi_edge.h" 13 | #include "g2o/core/hyper_graph_action.h" 14 | 15 | class EdgeSE2Switchable : public g2o::BaseMultiEdge<3, g2o::SE2> 16 | { 17 | public: 18 | EdgeSE2Switchable(); 19 | 20 | virtual bool read(std::istream& is); 21 | virtual bool write(std::ostream& os) const; 22 | void computeError(); 23 | void linearizeOplus(); 24 | 25 | }; 26 | 27 | 28 | #ifdef G2O_HAVE_OPENGL 29 | class EdgeSE2SwitchableDrawAction: public g2o::DrawAction{ 30 | public: 31 | EdgeSE2SwitchableDrawAction(); 32 | virtual g2o::HyperGraphElementAction* operator()(g2o::HyperGraph::HyperGraphElement* element, 33 | g2o::HyperGraphElementAction::Parameters* params_); 34 | }; 35 | #endif 36 | 37 | 38 | 39 | #endif /* EDGE_SE2SWITCHABLE_H_ */ 40 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/include/g2o/edge_se3Switchable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * edge_se3Switchable.h 3 | * 4 | * Created on: 17.10.2011 5 | * Author: niko 6 | */ 7 | 8 | #ifndef EDGE_SE3SWITCHABLE_H_ 9 | #define EDGE_SE3SWITCHABLE_H_ 10 | 11 | #include "g2o/types/slam3d/vertex_se3_quat.h" 12 | #include "g2o/core/base_multi_edge.h" 13 | #include "g2o/core/hyper_graph_action.h" 14 | 15 | class EdgeSE3Switchable : public g2o::BaseMultiEdge<6, g2o::SE3Quat> 16 | { 17 | public: 18 | EdgeSE3Switchable(); 19 | 20 | virtual bool read(std::istream& is); 21 | virtual bool write(std::ostream& os) const; 22 | void computeError(); 23 | void linearizeOplus(); 24 | 25 | }; 26 | 27 | 28 | #ifdef G2O_HAVE_OPENGL 29 | class EdgeSE3SwitchableDrawAction: public g2o::DrawAction{ 30 | public: 31 | EdgeSE3SwitchableDrawAction(); 32 | virtual g2o::HyperGraphElementAction* operator()(g2o::HyperGraph::HyperGraphElement* element, 33 | g2o::HyperGraphElementAction::Parameters* params_); 34 | }; 35 | #endif 36 | 37 | 38 | #endif /* EDGE_SE3SWITCHABLE_H_ */ 39 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/include/g2o/edge_switchPrior.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #include "vertex_switchLinear.h" 5 | #include "g2o/core/base_unary_edge.h" 6 | 7 | 8 | 9 | class EdgeSwitchPrior : public g2o::BaseUnaryEdge<1, double, VertexSwitchLinear> 10 | { 11 | public: 12 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW 13 | EdgeSwitchPrior() {}; 14 | 15 | virtual bool read(std::istream& is); 16 | virtual bool write(std::ostream& os) const; 17 | void linearizeOplus(); 18 | void computeError(); 19 | }; 20 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/include/g2o/vertex_switchLinear.h: -------------------------------------------------------------------------------- 1 | /* 2 | * vertex_switchLinear.h 3 | * 4 | * Created on: 17.10.2011 5 | * Author: niko 6 | */ 7 | 8 | 9 | #pragma once 10 | 11 | #include "g2o/core/base_vertex.h" 12 | #include 13 | 14 | 15 | 16 | class VertexSwitchLinear : public g2o::BaseVertex<1, double> 17 | { 18 | 19 | public: 20 | VertexSwitchLinear() { setToOrigin(); }; 21 | 22 | virtual void setToOrigin(); 23 | 24 | virtual void oplus(double* update); 25 | 26 | virtual bool read(std::istream& is); 27 | virtual bool write(std::ostream& os) const; 28 | virtual void setEstimate(double &et); 29 | 30 | 31 | double x() const { return _x; }; 32 | 33 | 34 | //! The gradient at the current estimate is always 1; 35 | double gradient() const { return 1; } ; 36 | 37 | private: 38 | double _x; 39 | 40 | }; 41 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/include/timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "sys/time.h" 4 | #include 5 | #include 6 | 7 | 8 | int timeval_subtract (timeval *result, timeval *x, timeval *y); 9 | void startTimer(); 10 | double stopTimer(); 11 | 12 | /** 13 | start a time measurement 14 | - to get passed time since started, use stopTimeMeasure with the return parameter of startTimeMeasure as parameter 15 | - it's possible to have several time measurements run at the same time 16 | 17 | example: 18 | double t = startTimeMeasure(); 19 | functionToEvaluate(); 20 | cout << "passed time: "<< stopTimeMeasure(t)< measurements; 60 | }; 61 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if (G2O_FOUND) 2 | add_subdirectory(g2o) 3 | endif() 4 | 5 | if (GTSAM_FOUND) 6 | add_subdirectory(gtsam2) 7 | endif() 8 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/src/g2o/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project (vertigo-g2o) 4 | 5 | # specify where the resulting shared library should be created 6 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../../lib) 7 | 8 | # G2O is required 9 | find_package(G2O REQUIRED) 10 | 11 | 12 | # Eigen3 is required 13 | find_package(Eigen3 REQUIRED) 14 | 15 | # opengl is required 16 | find_package(OpenGL REQUIRED) 17 | 18 | # glut is required 19 | find_package(GLUT REQUIRED) 20 | 21 | 22 | # specify our own source files that need to be compiled and linked into the lib 23 | set(SOURCEFILES 24 | types_g2o_robust.cpp 25 | edge_switchPrior.cpp 26 | edge_se2Switchable.cpp 27 | edge_se2MaxMixture.cpp 28 | edge_se3Switchable.cpp 29 | vertex_switchLinear.cpp 30 | ) 31 | 32 | include_directories(${PROJECT_SOURCE_DIR}/../../include/g2o) 33 | include_directories(${G2O_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR}) 34 | 35 | add_library(${PROJECT_NAME} SHARED ${SOURCEFILES}) 36 | 37 | set (LINKLIBRARIES ${G2O_LIBRARIES} ${EIGEN3_LIBRARIES} ${OpenGL_LIBRARIES} ${GLUT_LIBRARIES}) 38 | 39 | target_link_libraries(${PROJECT_NAME} ${LINKLIBRARIES}) 40 | 41 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/src/g2o/edge_switchPrior.cpp: -------------------------------------------------------------------------------- 1 | #include "edge_switchPrior.h" 2 | using namespace std; 3 | 4 | bool EdgeSwitchPrior::read(std::istream &is) 5 | { 6 | is >> measurement(); 7 | is >> information()(0,0); 8 | return true; 9 | } 10 | 11 | bool EdgeSwitchPrior::write(std::ostream &os) const 12 | { 13 | os << measurement() << " " << information()(0,0); 14 | return true; 15 | } 16 | 17 | void EdgeSwitchPrior::linearizeOplus() 18 | { 19 | _jacobianOplusXi[0]=-1.0; 20 | } 21 | 22 | void EdgeSwitchPrior::computeError() 23 | { 24 | const VertexSwitchLinear* s = static_cast(_vertices[0]); 25 | 26 | _error[0] = measurement() - s->x(); 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/src/g2o/types_g2o_robust.cpp: -------------------------------------------------------------------------------- 1 | #include "g2o/core/factory.h" 2 | #include "g2o/stuff/macros.h" 3 | 4 | #include "edge_switchPrior.h" 5 | #include "edge_se2Switchable.h" 6 | #include "edge_se2MaxMixture.h" 7 | #include "edge_se3Switchable.h" 8 | #include "vertex_switchLinear.h" 9 | 10 | 11 | using namespace g2o; 12 | 13 | 14 | void G2O_ATTRIBUTE_CONSTRUCTOR init_types_veloc(void) 15 | { 16 | Factory* factory = Factory::instance(); 17 | factory->registerType("EDGE_SWITCH_PRIOR", new HyperGraphElementCreator); 18 | factory->registerType("EDGE_SE2_SWITCHABLE", new HyperGraphElementCreator); 19 | factory->registerType("EDGE_SE2_MAXMIX", new HyperGraphElementCreator); 20 | factory->registerType("EDGE_SE3_SWITCHABLE", new HyperGraphElementCreator); 21 | factory->registerType("VERTEX_SWITCH", new HyperGraphElementCreator); 22 | 23 | 24 | 25 | g2o::HyperGraphActionLibrary* actionLib = g2o::HyperGraphActionLibrary::instance(); 26 | 27 | #ifdef G2O_HAVE_OPENGL 28 | actionLib->registerAction(new EdgeSE2SwitchableDrawAction); 29 | actionLib->registerAction(new EdgeSE2MaxMixtureDrawAction); 30 | actionLib->registerAction(new EdgeSE3SwitchableDrawAction); 31 | #endif 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/src/g2o/vertex_switchLinear.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * vertex_switchLinear.cpp 3 | * 4 | * Created on: 17.10.2011 5 | * Author: niko 6 | */ 7 | 8 | #include "vertex_switchLinear.h" 9 | #include 10 | 11 | using namespace std; 12 | 13 | bool VertexSwitchLinear:: read(std::istream& is) 14 | { 15 | is >> _x; 16 | _estimate=_x; 17 | 18 | return true; 19 | } 20 | 21 | bool VertexSwitchLinear::write(std::ostream& os) const 22 | { 23 | os << _x; 24 | return os.good(); 25 | } 26 | 27 | void VertexSwitchLinear::setToOrigin() 28 | { 29 | _x=0; 30 | _estimate=_x; 31 | } 32 | 33 | 34 | void VertexSwitchLinear::setEstimate(double &et) 35 | { 36 | _x=et; 37 | _estimate=_x; 38 | } 39 | 40 | 41 | void VertexSwitchLinear::oplus(double* update) 42 | { 43 | _x += update[0]; 44 | 45 | if (_x<0) _x=0; 46 | if (_x>1) _x=1; 47 | 48 | _estimate=_x; 49 | } 50 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/src/gtsam2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | 3 | project (vertigo-gtsam) 4 | 5 | # specify where the resulting shared library should be created 6 | set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../../lib) 7 | 8 | # GTSAN is required 9 | find_package(GTSAM REQUIRED) 10 | 11 | 12 | # specify our own source files that need to be compiled and linked into the lib 13 | set(SOURCEFILES 14 | ../timer.cpp 15 | betweenFactorSwitchable.cpp 16 | ) 17 | 18 | include_directories(${PROJECT_SOURCE_DIR}/../../include) 19 | include_directories(${PROJECT_SOURCE_DIR}/../../include/gtsam2) 20 | include_directories(${GTSAM_INCLUDE_DIR}) 21 | 22 | add_library(${PROJECT_NAME} SHARED ${SOURCEFILES}) 23 | 24 | set (LINKLIBRARIES ${GTSAM_LIBS} ) 25 | 26 | target_link_libraries(${PROJECT_NAME} ${LINKLIBRARIES}) 27 | 28 | 29 | 30 | install (TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib) 31 | -------------------------------------------------------------------------------- /g2opy/contrib/vertigo/src/gtsam2/betweenFactorSwitchable.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * betweenFactorSwitchable.cpp 3 | * 4 | * Created on: 02.08.2012 5 | * Author: niko 6 | */ 7 | 8 | 9 | namespace robust_gtsam 10 | { 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /g2opy/doc/Makefile: -------------------------------------------------------------------------------- 1 | all: g2o.pdf 2 | 3 | %.pdf: %.dvi 4 | dvipdf $< 5 | 6 | g2o.dvi: g2o.tex 7 | latex g2o.tex 8 | bibtex g2o 9 | latex g2o.tex 10 | latex g2o.tex 11 | -------------------------------------------------------------------------------- /g2opy/doc/doxygen/readme.txt: -------------------------------------------------------------------------------- 1 | run the following in the current folder 2 | 3 | doxygen doxy.config 4 | 5 | assumes that dot tool is installed and available from path 6 | -------------------------------------------------------------------------------- /g2opy/doc/g2o.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/g2opy/doc/g2o.pdf -------------------------------------------------------------------------------- /g2opy/doc/license-bsd.txt: -------------------------------------------------------------------------------- 1 | g2o - General Graph Optimization 2 | Copyright (C) 2011 Rainer Kuemmerle, Giorgio Grisetti, Hauke Strasdat, 3 | Kurt Konolige, and Wolfram Burgard 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 17 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 22 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /g2opy/doc/pics/viewer.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/g2opy/doc/pics/viewer.eps -------------------------------------------------------------------------------- /g2opy/doc/pics/viewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/g2opy/doc/pics/viewer.png -------------------------------------------------------------------------------- /g2opy/g2o/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6) 2 | 3 | ADD_SUBDIRECTORY(stuff) 4 | ADD_SUBDIRECTORY(core) 5 | 6 | IF(G2O_BUILD_APPS) 7 | ADD_SUBDIRECTORY(apps) 8 | ENDIF(G2O_BUILD_APPS) 9 | 10 | # Pre-canned types 11 | ADD_SUBDIRECTORY(types) 12 | 13 | # Solvers 14 | ADD_SUBDIRECTORY(solvers) 15 | 16 | # Examples 17 | IF(G2O_BUILD_EXAMPLES) 18 | ADD_SUBDIRECTORY(examples) 19 | ENDIF(G2O_BUILD_EXAMPLES) 20 | 21 | IF(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/playground") 22 | # Playground 23 | OPTION (G2O_BUILD_PLAYGROUND "Build g2o playground" ON) 24 | IF (G2O_BUILD_PLAYGROUND) 25 | MESSAGE(STATUS "building playground") 26 | ADD_SUBDIRECTORY(playground) 27 | ENDIF() 28 | ENDIF() 29 | -------------------------------------------------------------------------------- /g2opy/g2o/apps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(g2o_cli) 2 | ADD_SUBDIRECTORY(g2o_hierarchical) 3 | 4 | IF (G2O_HAVE_OPENGL) 5 | ADD_SUBDIRECTORY(g2o_simulator) 6 | ENDIF() 7 | 8 | IF(QGLVIEWER_FOUND AND Qt5_FOUND) 9 | ADD_SUBDIRECTORY(g2o_viewer) 10 | ENDIF() 11 | 12 | IF(G2O_BUILD_LINKED_APPS) 13 | ADD_SUBDIRECTORY(linked_binaries) 14 | ENDIF() 15 | -------------------------------------------------------------------------------- /g2opy/g2o/apps/g2o_hierarchical/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(g2o_hierarchical_library ${G2O_LIB_TYPE} 2 | edge_labeler.cpp 3 | edge_creator.cpp 4 | star.cpp 5 | edge_types_cost_function.cpp 6 | backbone_tree_action.cpp 7 | simple_star_ops.cpp 8 | g2o_hierarchical_test_functions.cpp 9 | edge_labeler.h 10 | edge_creator.h 11 | star.h 12 | edge_types_cost_function.h 13 | backbone_tree_action.h 14 | simple_star_ops.h 15 | g2o_hierarchical_api.h 16 | ) 17 | 18 | 19 | SET_TARGET_PROPERTIES(g2o_hierarchical_library PROPERTIES OUTPUT_NAME ${LIB_PREFIX}hierarchical) 20 | 21 | TARGET_LINK_LIBRARIES(g2o_hierarchical_library core) 22 | 23 | ADD_EXECUTABLE(g2o_hierarchical_application 24 | g2o_hierarchical.cpp) 25 | 26 | TARGET_LINK_LIBRARIES(g2o_hierarchical_application g2o_hierarchical_library g2o_cli_library types_slam3d ) #types_slam3d_new 27 | 28 | SET_TARGET_PROPERTIES(g2o_hierarchical_application PROPERTIES OUTPUT_NAME g2o_hierarchical${EXE_POSTFIX}) 29 | 30 | # INSTALL(TARGETS g2o_hierarchical_library g2o_cli_application 31 | # RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 32 | # LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 33 | # ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 34 | # ) 35 | 36 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 37 | INSTALL(FILES 38 | ${headers} 39 | DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/apps/g2o_hierarchical) 40 | -------------------------------------------------------------------------------- /g2opy/g2o/apps/g2o_viewer/gui_hyper_graph_action.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // 4 | // This file is part of g2o. 5 | // 6 | // g2o is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // g2o is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with g2o. If not, see . 18 | 19 | #ifndef G2O_GUI_HYPER_GRAPH_ACTION_H 20 | #define G2O_GUI_HYPER_GRAPH_ACTION_H 21 | 22 | #include "g2o_viewer_api.h" 23 | #include "g2o/core/hyper_graph_action.h" 24 | 25 | namespace g2o { 26 | 27 | class G2oQGLViewer; 28 | 29 | /** 30 | * \brief action which calls an GUI update after each iteration 31 | */ 32 | class G2O_VIEWER_API GuiHyperGraphAction : public HyperGraphAction 33 | { 34 | public: 35 | GuiHyperGraphAction(); 36 | ~GuiHyperGraphAction(); 37 | 38 | /** 39 | * calling updateGL, processEvents to visualize the current state after each iteration 40 | */ 41 | HyperGraphAction* operator()(const HyperGraph* graph, Parameters* parameters = 0); 42 | 43 | G2oQGLViewer* viewer; ///< the viewer which visualizes the graph 44 | bool dumpScreenshots; 45 | }; 46 | 47 | } // end namespace 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /g2opy/g2o/apps/g2o_viewer/viewer_properties_widget.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // 4 | // This file is part of g2o. 5 | // 6 | // g2o is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // g2o is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with g2o. If not, see . 18 | 19 | #ifndef G2O_VIEWER_PROPERTIES_WIDGET_H 20 | #define G2O_VIEWER_PROPERTIES_WIDGET_H 21 | 22 | #include "g2o_viewer_api.h" 23 | #include "properties_widget.h" 24 | 25 | namespace g2o 26 | { 27 | class G2oQGLViewer; 28 | } 29 | 30 | class G2O_VIEWER_API ViewerPropertiesWidget : public PropertiesWidget 31 | { 32 | public: 33 | ViewerPropertiesWidget(QWidget * parent = 0, Qt::WindowFlags f = 0); 34 | virtual ~ViewerPropertiesWidget(); 35 | 36 | void setViewer(g2o::G2oQGLViewer* viewer); 37 | 38 | protected: 39 | g2o::G2oQGLViewer* _viewer; 40 | 41 | virtual void applyProperties(); 42 | virtual std::string humanReadablePropName(const std::string& probName) const; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /g2opy/g2o/core/g2o_core_api.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | * Description: import/export macros for creating DLLS with Microsoft 3 | * compiler. Any exported function needs to be declared with the 4 | * appropriate G2O_XXXX_API macro. Also, there must be separate macros 5 | * for each DLL (arrrrrgh!!!) 6 | * 7 | * 17 Jan 2012 8 | * Email: pupilli@cs.bris.ac.uk 9 | ****************************************************************************/ 10 | #ifndef G2O_CORE_API_H 11 | #define G2O_CORE_API_H 12 | 13 | #include "g2o/config.h" 14 | 15 | #ifdef _MSC_VER 16 | // We are using a Microsoft compiler: 17 | #ifdef G2O_SHARED_LIBS 18 | #ifdef core_EXPORTS 19 | #define G2O_CORE_API __declspec(dllexport) 20 | #else 21 | #define G2O_CORE_API __declspec(dllimport) 22 | #endif 23 | #else 24 | #define G2O_CORE_API 25 | #endif 26 | 27 | #else 28 | // Not Microsoft compiler so set empty definition: 29 | #define G2O_CORE_API 30 | #endif 31 | 32 | #endif // G2O_CORE_API_H 33 | -------------------------------------------------------------------------------- /g2opy/g2o/core/ownership.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | namespace g2o 5 | { 6 | template 7 | void release(T* obj) 8 | { 9 | (void)obj; 10 | #if G2O_DELETE_IMPLICITLY_OWNED_OBJECTS 11 | delete obj; 12 | #endif 13 | } 14 | } -------------------------------------------------------------------------------- /g2opy/g2o/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(data_fitting) 2 | 3 | ADD_SUBDIRECTORY(sphere) 4 | 5 | # The condition on cholmod is required here because the cholmod solver 6 | # is explicitly used in these examples. 7 | IF(CHOLMOD_FOUND) 8 | ADD_SUBDIRECTORY(target) 9 | ADD_SUBDIRECTORY(ba) 10 | ADD_SUBDIRECTORY(ba_anchored_inverse_depth) 11 | ENDIF(CHOLMOD_FOUND) 12 | 13 | # Examples which explicitly use CSparse 14 | IF(CSPARSE_FOUND) 15 | ADD_SUBDIRECTORY(tutorial_slam2d) 16 | ADD_SUBDIRECTORY(icp) 17 | ADD_SUBDIRECTORY(calibration_odom_laser) 18 | ADD_SUBDIRECTORY(simple_optimize) 19 | ADD_SUBDIRECTORY(plane_slam) 20 | ADD_SUBDIRECTORY(line_slam) 21 | ENDIF() 22 | 23 | IF(CSPARSE_FOUND OR CHOLMOD_FOUND) 24 | ADD_SUBDIRECTORY(sba) 25 | ADD_SUBDIRECTORY(bal) 26 | ENDIF() 27 | 28 | IF(Qt5_FOUND AND QGLVIEWER_FOUND AND CSPARSE_FOUND) 29 | ADD_SUBDIRECTORY(slam2d) 30 | ENDIF() 31 | 32 | ADD_SUBDIRECTORY(data_convert) 33 | ADD_SUBDIRECTORY(interactive_slam) 34 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/ba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_EXECUTABLE(ba_demo 2 | ba_demo.cpp 3 | ) 4 | 5 | INCLUDE_DIRECTORIES(${CHOLMOD_INCLUDE_DIR}) 6 | 7 | TARGET_LINK_LIBRARIES(ba_demo core solver_cholmod types_sba) 8 | 9 | 10 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/ba_anchored_inverse_depth/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_EXECUTABLE(ba_anchored_inverse_depth_demo 2 | ba_anchored_inverse_depth_demo.cpp 3 | ) 4 | 5 | INCLUDE_DIRECTORIES(${CHOLMOD_INCLUDE_DIR}) 6 | 7 | TARGET_LINK_LIBRARIES(ba_anchored_inverse_depth_demo core solver_cholmod types_sba) 8 | 9 | 10 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/bal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | IF(CHOLMOD_INCLUDE_DIR OR CSPARSE_INCLUDE_DIR) 2 | ADD_EXECUTABLE(bal_example bal_example.cpp) 3 | ENDIF() 4 | 5 | # Link CHOLMOD if available, CSparse otherwise 6 | IF(CHOLMOD_FOUND) 7 | INCLUDE_DIRECTORIES(${CHOLMOD_INCLUDE_DIR}) 8 | TARGET_LINK_LIBRARIES(bal_example solver_cholmod) 9 | ELSEIF(CSPARSE_FOUND) 10 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 11 | TARGET_LINK_LIBRARIES(bal_example solver_csparse) 12 | ENDIF() 13 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/calibration_odom_laser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 2 | 3 | ADD_LIBRARY(calibration_odom_laser_library ${G2O_LIB_TYPE} 4 | gm2dl_io.cpp gm2dl_io.h 5 | sclam_helpers.cpp sclam_helpers.h 6 | motion_information.h 7 | edge_se2_pure_calib.cpp edge_se2_pure_calib.h 8 | closed_form_calibration.cpp closed_form_calibration.h 9 | g2o_calibration_odom_laser_api.h 10 | ) 11 | SET_TARGET_PROPERTIES(calibration_odom_laser_library PROPERTIES OUTPUT_NAME ${LIB_PREFIX}calibration_odom_laser) 12 | TARGET_LINK_LIBRARIES(calibration_odom_laser_library core solver_csparse types_sclam2d types_data) 13 | 14 | ADD_EXECUTABLE(sclam_odom_laser 15 | sclam_odom_laser.cpp 16 | ) 17 | SET_TARGET_PROPERTIES(sclam_odom_laser PROPERTIES OUTPUT_NAME sclam_odom_laser${EXE_POSTFIX}) 18 | TARGET_LINK_LIBRARIES(sclam_odom_laser calibration_odom_laser_library) 19 | 20 | ADD_EXECUTABLE(sclam_pure_calibration 21 | sclam_pure_calibration.cpp 22 | ) 23 | SET_TARGET_PROPERTIES(sclam_pure_calibration PROPERTIES OUTPUT_NAME sclam_pure_calibration${EXE_POSTFIX}) 24 | TARGET_LINK_LIBRARIES(sclam_pure_calibration calibration_odom_laser_library) 25 | 26 | ADD_EXECUTABLE(sclam_laser_calib 27 | sclam_laser_calib.cpp 28 | ) 29 | SET_TARGET_PROPERTIES(sclam_laser_calib PROPERTIES OUTPUT_NAME sclam_laser_calib${EXE_POSTFIX}) 30 | TARGET_LINK_LIBRARIES(sclam_laser_calib calibration_odom_laser_library) 31 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/data_convert/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_EXECUTABLE(convert_sba_slam3d 2 | convert_sba_slam3d.cpp 3 | ) 4 | SET_TARGET_PROPERTIES(convert_sba_slam3d PROPERTIES OUTPUT_NAME convert_sba_slam3d${EXE_POSTFIX}) 5 | TARGET_LINK_LIBRARIES(convert_sba_slam3d core types_slam3d types_sba) 6 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/data_fitting/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 2 | 3 | IF(CSPARSE_INCLUDE_DIR) 4 | ADD_EXECUTABLE(circle_fit circle_fit.cpp) 5 | SET_TARGET_PROPERTIES(circle_fit PROPERTIES OUTPUT_NAME circle_fit${EXE_POSTFIX}) 6 | TARGET_LINK_LIBRARIES(circle_fit core solver_csparse) 7 | ENDIF() 8 | 9 | ADD_EXECUTABLE(curve_fit curve_fit.cpp) 10 | SET_TARGET_PROPERTIES(curve_fit PROPERTIES OUTPUT_NAME curve_fit${EXE_POSTFIX}) 11 | TARGET_LINK_LIBRARIES(curve_fit core) 12 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/icp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_EXECUTABLE(gicp_demo 2 | gicp_demo.cpp 3 | ) 4 | 5 | ADD_EXECUTABLE(gicp_sba_demo 6 | gicp_sba_demo.cpp 7 | ) 8 | 9 | SET_TARGET_PROPERTIES(gicp_sba_demo PROPERTIES OUTPUT_NAME gicp_sba_demo${EXE_POSTFIX}) 10 | 11 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 12 | 13 | TARGET_LINK_LIBRARIES(gicp_demo core types_sba types_slam3d types_icp ${OPENGL_LIBRARIES} solver_csparse) 14 | TARGET_LINK_LIBRARIES(gicp_sba_demo core types_sba types_slam3d types_icp ${OPENGL_LIBRARIES} solver_csparse) 15 | 16 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/icp/gicp-test1.dat: -------------------------------------------------------------------------------- 1 | # Simple GICP example 2 | # 3 | # Vertices at origin, second one is rotated 4 | VERTEX_SE3:QUAT 0 0 0 0 0 0 0 1 5 | VERTEX_SE3:QUAT 1 0 0 0 0.5 0 0 0.5 6 | # 7 | # Edges displaced by 1m on Z axis 8 | EDGE_V_V_GICP 1 0 0 0 1 0 0 1 0 0 2 0 0 1 9 | EDGE_V_V_GICP 1 0 0 1 1 0 0 1 0 1 2 0 0 1 10 | EDGE_V_V_GICP 1 0 1 0 1 0 0 1 1 0 2 0 0 1 11 | EDGE_V_V_GICP 1 0 1 1 1 0 0 1 1 1 2 0 0 1 -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(slam_parser) 2 | 3 | IF(CHOLMOD_FOUND) 4 | ADD_SUBDIRECTORY(g2o_interactive) 5 | ADD_SUBDIRECTORY(g2o_incremental) 6 | ENDIF(CHOLMOD_FOUND) 7 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/README.txt: -------------------------------------------------------------------------------- 1 | This directory implements an interface to g2o which reads the input data 2 | via stdin and outputs upon request the current estimate to stdout. 3 | 4 | In particular, the interface follows the grammar proposed for the RSS'11 5 | workshop "Automated SLAM Evaluation", see 6 | http://slameval.willowgarage.com/workshop/submissions/ 7 | 8 | Brief description: 9 | - slam_parser (LGPL v3) 10 | The parser for the SLAM protocol 11 | - g2o_interactive (LGPL v3) 12 | Run batch optimization every N nodes 13 | - g2o_incremental (GPL v3) 14 | Incrementally solve the optimzation, batch every 100 nodes 15 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/g2o_incremental/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(g2o_incremental_library ${G2O_LIB_TYPE} 2 | graph_optimizer_sparse_incremental.cpp graph_optimizer_sparse_incremental.h 3 | ) 4 | 5 | INCLUDE_DIRECTORIES(${CHOLMOD_INCLUDE_DIR}) 6 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../) 7 | 8 | SET_TARGET_PROPERTIES(g2o_incremental_library PROPERTIES OUTPUT_NAME ${LIB_PREFIX}incremental) 9 | TARGET_LINK_LIBRARIES(g2o_incremental_library g2o_interactive_library solver_cholmod ${CAMD_LIBRARY}) 10 | 11 | ADD_EXECUTABLE(g2o_incremental_application g2o_incremental.cpp) 12 | TARGET_LINK_LIBRARIES(g2o_incremental_application g2o_incremental_library) 13 | SET_TARGET_PROPERTIES(g2o_incremental_application PROPERTIES OUTPUT_NAME g2o_incremental${EXE_POSTFIX}) 14 | 15 | INSTALL(TARGETS g2o_incremental_library g2o_incremental_application 16 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 17 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 18 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 19 | ) 20 | 21 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 22 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/examples/interactive_slam/g2o_incremental) 23 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/g2o_incremental/README.txt: -------------------------------------------------------------------------------- 1 | g2o_incremental implements a variant of the iSAM algorithm. 2 | In contrast to iSAM the update of the Cholesky factor is done 3 | using rank updates as provided via the CHOLMOD library. 4 | 5 | “iSAM: Incremental Smoothing and Mapping” 6 | by M. Kaess, A. Ranganathan, and F. Dellaert. 7 | IEEE Trans. on Robotics, vol. 24, no. 6, Dec. 2008, pp. 1365-1378 8 | 9 | Furthermore, it implements a simple protocol to control the operation of the 10 | algorithm. See protocol.txt for more details or 11 | http://slameval.willowgarage.com/workshop/submissions/ for an evaluation system 12 | as well as data sets. 13 | 14 | In the standard configuration g2o_incremental solves after inserting 10 nodes. 15 | This behavior can be modified via a command line option. Furthermore, by 16 | specifying -g on the command line a gnuplot instance is created to visualize 17 | the graph. 18 | 19 | Please note that both the visualization via Gnuplot and the verbose output 20 | affect the timing results. 21 | 22 | g2o_incremental is licensed under GPLv3. 23 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/g2o_interactive/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(g2o_interactive_library ${G2O_LIB_TYPE} 2 | g2o_slam_interface.cpp g2o_slam_interface.h 3 | graph_optimizer_sparse_online.cpp graph_optimizer_sparse_online.h 4 | types_online.cpp 5 | ) 6 | 7 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../) 8 | INCLUDE_DIRECTORIES(${CHOLMOD_INCLUDE_DIR}) 9 | 10 | SET_TARGET_PROPERTIES(g2o_interactive_library PROPERTIES OUTPUT_NAME ${LIB_PREFIX}interactive) 11 | TARGET_LINK_LIBRARIES(g2o_interactive_library core types_slam2d types_slam3d solver_cholmod parser_library interface_library) 12 | 13 | ADD_EXECUTABLE(g2o_online_application g2o_online.cpp) 14 | TARGET_LINK_LIBRARIES(g2o_online_application g2o_interactive_library) 15 | SET_TARGET_PROPERTIES(g2o_online_application PROPERTIES OUTPUT_NAME g2o_online${EXE_POSTFIX}) 16 | 17 | #ADD_EXECUTABLE(generate_commands_application generate_commands.cpp) 18 | #TARGET_LINK_LIBRARIES(generate_commands_application g2o_interactive_library) 19 | #SET_TARGET_PROPERTIES(generate_commands_application PROPERTIES OUTPUT_NAME generate_commands) 20 | 21 | INSTALL(TARGETS g2o_interactive_library g2o_online_application 22 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 23 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 24 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 25 | ) 26 | 27 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 28 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/examples/interactive_slam/g2o_interactive) 29 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/slam_parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(parser) 2 | ADD_SUBDIRECTORY(interface) 3 | #ADD_SUBDIRECTORY(example) 4 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/slam_parser/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(example_library ${G2O_LIB_TYPE} 2 | example_slam_interface.cpp 3 | example_slam_interface.h 4 | ) 5 | 6 | SET_TARGET_PROPERTIES(example_library PROPERTIES OUTPUT_NAME ${LIB_PREFIX}example) 7 | 8 | TARGET_LINK_LIBRARIES(example_library parser_library interface_library) 9 | 10 | ADD_EXECUTABLE(test_slam_interface test_slam_interface.cpp) 11 | TARGET_LINK_LIBRARIES(test_slam_interface example_library) 12 | SET_TARGET_PROPERTIES(test_slam_interface PROPERTIES OUTPUT_NAME test_slam_interface${EXE_POSTFIX}) 13 | 14 | #INSTALL(TARGETS example_library 15 | #RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 16 | #LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 17 | #ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 18 | #) 19 | 20 | #FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 21 | #INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/slam_parser/example) 22 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/slam_parser/interface/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(interface_library_src 2 | abstract_slam_interface.h 3 | parser_interface.cpp 4 | parser_interface.h 5 | slam_context_interface.cpp 6 | slam_context_interface.h 7 | ) 8 | 9 | IF (MSVC) 10 | ADD_LIBRARY(interface_library STATIC 11 | ${interface_library_src} 12 | ) 13 | ELSE() 14 | ADD_LIBRARY(interface_library ${G2O_LIB_TYPE} 15 | ${interface_library_src} 16 | ) 17 | ENDIF() 18 | 19 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../) 20 | 21 | SET_TARGET_PROPERTIES(interface_library PROPERTIES OUTPUT_NAME ${LIB_PREFIX}interface) 22 | TARGET_LINK_LIBRARIES(interface_library parser_library) 23 | 24 | INSTALL(TARGETS interface_library 25 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 26 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 27 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 28 | ) 29 | 30 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") 31 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/slam_parser/interface) 32 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/slam_parser/parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(G2O_PARSER_SRC 2 | slam_context.h slam_context.cpp 3 | bison_parser.cpp bison_parser.h 4 | commands.h 5 | driver.h driver.cpp 6 | location.hh 7 | position.hh 8 | scanner.h flex_scanner.cpp 9 | stack.hh 10 | ) 11 | 12 | IF (MSVC) 13 | ADD_LIBRARY(parser_library STATIC 14 | ${G2O_PARSER_SRC} 15 | ) 16 | ELSE() 17 | ADD_LIBRARY(parser_library ${G2O_LIB_TYPE} 18 | ${G2O_PARSER_SRC} 19 | ) 20 | ENDIF() 21 | 22 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) 23 | 24 | SET_TARGET_PROPERTIES(parser_library PROPERTIES OUTPUT_NAME ${LIB_PREFIX}parser) 25 | 26 | #ADD_EXECUTABLE(test_slam_parser test_slam_parser.cpp) 27 | #TARGET_LINK_LIBRARIES(test_slam_parser parser_library) 28 | #SET_TARGET_PROPERTIES(test_slam_parser PROPERTIES OUTPUT_NAME test_slam_parser${EXE_POSTFIX}) 29 | 30 | INSTALL(TARGETS parser_library 31 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 32 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 33 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 34 | ) 35 | 36 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hh") 37 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/slam_parser/parser) 38 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/slam_parser/parser/grammar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # wrapper script to generate the parser by flex / bison 4 | # Copyright (C) 2011 R. Kuemmerle, G. Grisetti, H. Strasdat, W. Burgard 5 | 6 | flex -o flex_scanner.cpp -i scanner.l 7 | 8 | cp /usr/include/FlexLexer.h . 9 | 10 | bison -o bison_parser.cpp --defines=bison_parser.h parser.yy 11 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/interactive_slam/slam_parser/parser/scanner.h: -------------------------------------------------------------------------------- 1 | #ifndef SCANNER_H 2 | #define SCANNER_H 3 | 4 | #ifndef YY_DECL 5 | 6 | #define YY_DECL \ 7 | SlamParser::Parser::token_type \ 8 | SlamParser::Scanner::lex( \ 9 | SlamParser::Parser::semantic_type* yylval, \ 10 | SlamParser::Parser::location_type* yylloc \ 11 | ) 12 | #endif 13 | 14 | #ifndef __FLEX_LEXER_H 15 | #define yyFlexLexer SlamFlexLexer 16 | #include "FlexLexer.h" 17 | #undef yyFlexLexer 18 | #endif 19 | 20 | #include "bison_parser.h" 21 | 22 | namespace SlamParser { 23 | 24 | class Scanner : public SlamFlexLexer 25 | { 26 | public: 27 | /** Create a new scanner object. The streams arg_yyin and arg_yyout default 28 | * to cin and cout, but that assignment is only made when initializing in 29 | * yylex(). */ 30 | Scanner(std::istream* arg_yyin = 0, 31 | std::ostream* arg_yyout = 0); 32 | 33 | /** Required for virtual functions */ 34 | virtual ~Scanner(); 35 | 36 | /** This is the main lexing function. It is generated by flex according to 37 | * the macro declaration YY_DECL above. The generated bison parser then 38 | * calls this virtual function to fetch new tokens. */ 39 | virtual Parser::token_type lex( 40 | Parser::semantic_type* yylval, 41 | Parser::location_type* yylloc 42 | ); 43 | 44 | /** Enable debug output (via arg_yyout) if compiled into the scanner. */ 45 | void set_debug(bool b); 46 | }; 47 | 48 | } // end namespace 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/line_slam/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 2 | 3 | # ADD_EXECUTABLE(line_test line_test.cpp) 4 | # TARGET_LINK_LIBRARIES(line_test types_slam3d_addons types_slam3d) 5 | # SET_TARGET_PROPERTIES(line_test PROPERTIES OUTPUT_NAME line_test${EXE_POSTFIX}) 6 | 7 | ADD_EXECUTABLE(simulator_3d_line simulator_3d_line.cpp) 8 | TARGET_LINK_LIBRARIES(simulator_3d_line solver_csparse types_slam3d_addons) 9 | SET_TARGET_PROPERTIES(simulator_3d_line PROPERTIES OUTPUT_NAME simulator_3d_line${EXE_POSTFIX}) 10 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/plane_slam/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 2 | 3 | ADD_EXECUTABLE(simulator_3d_plane 4 | simulator_3d_plane.cpp 5 | ) 6 | TARGET_LINK_LIBRARIES(simulator_3d_plane solver_csparse types_slam3d_addons) 7 | SET_TARGET_PROPERTIES(simulator_3d_plane PROPERTIES OUTPUT_NAME simulator_3d_plane${EXE_POSTFIX}) 8 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/sba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | IF(CHOLMOD_INCLUDE_DIR OR CSPARSE_INCLUDE_DIR) 2 | ADD_EXECUTABLE(sba_demo sba_demo.cpp) 3 | TARGET_LINK_LIBRARIES(sba_demo core types_icp types_sba) 4 | SET_TARGET_PROPERTIES(sba_demo PROPERTIES OUTPUT_NAME sba_demo${EXE_POSTFIX}) 5 | ENDIF() 6 | 7 | # Link CHOLMOD if available, CSparse otherwise 8 | IF(CHOLMOD_FOUND) 9 | INCLUDE_DIRECTORIES(${CHOLMOD_INCLUDE_DIR}) 10 | TARGET_LINK_LIBRARIES(sba_demo solver_cholmod) 11 | ELSEIF(CSPARSE_FOUND) 12 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 13 | TARGET_LINK_LIBRARIES(sba_demo solver_csparse) 14 | ENDIF() 15 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/simple_optimize/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 2 | 3 | ADD_EXECUTABLE(simple_optimize 4 | simple_optimize.cpp 5 | ) 6 | 7 | SET_TARGET_PROPERTIES(simple_optimize PROPERTIES OUTPUT_NAME simple_optimize${EXE_POSTFIX}) 8 | 9 | TARGET_LINK_LIBRARIES(simple_optimize core solver_csparse) 10 | TARGET_LINK_LIBRARIES(simple_optimize types_slam2d) 11 | TARGET_LINK_LIBRARIES(simple_optimize types_slam3d) 12 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/slam2d/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # qt components used (also by qglviewer): Core Gui Xml OpenGL Widgets 2 | 3 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR} 4 | ${QGLVIEWER_INCLUDE_DIR} 5 | ${Qt5Core_INCLUDE_DIRS} 6 | ${Qt5Gui_INCLUDE_DIRS} 7 | ${Qt5Xml_INCLUDE_DIRS} 8 | ${Qt5Widgets_INCLUDE_DIRS} 9 | ${Qt5OpenGL_INCLUDE_DIRS} 10 | ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} 11 | ) 12 | 13 | QT5_WRAP_UI(UI_HEADERS base_main_window.ui) 14 | QT5_WRAP_CPP(UI_SOURCES main_window.h) 15 | 16 | ADD_EXECUTABLE(slam2d_g2o 17 | main_window.cpp 18 | slam2d_viewer.cpp 19 | slam2d_viewer.h 20 | slam2d_g2o.cpp 21 | draw_helpers.cpp 22 | ${UI_HEADERS} 23 | ${UI_SOURCES} 24 | ) 25 | 26 | SET_TARGET_PROPERTIES(slam2d_g2o PROPERTIES OUTPUT_NAME slam2d_g2o${EXE_POSTFIX}) 27 | 28 | IF(Qt5_POSITION_INDEPENDENT_CODE) 29 | SET_PROPERTY(TARGET slam2d_g2o PROPERTY COMPILE_FLAGS -fPIC) 30 | MESSAGE(STATUS "Generating position indpendent code for slam2d because Qt5 was built with -reduce-relocations") 31 | # Note: using 32 | # SET(CMAKE_POSITION_INDEPENDENT_CODE ON) 33 | # does not seem to work: This generates some libraries with -fPIE which is not enough for Qt... 34 | ENDIF() 35 | 36 | 37 | 38 | 39 | TARGET_LINK_LIBRARIES(slam2d_g2o core solver_csparse types_slam2d 40 | ${QGLVIEWER_LIBRARY} 41 | ${Qt5Core_LIBRARIES} 42 | ${Qt5Gui_LIBRARIES} 43 | ${Qt5Xml_LIBRARIES} 44 | ${Qt5Widgets_LIBRARIES} 45 | ${Qt5OpenGL_LIBRARIES} 46 | ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} 47 | ) 48 | 49 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/slam2d/main_window.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // 4 | // This file is part of g2o. 5 | // 6 | // g2o is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // g2o is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with g2o. If not, see . 18 | 19 | #ifndef G2O_MAIN_WINDOW_H 20 | #define G2O_MAIN_WINDOW_H 21 | 22 | #include "ui_base_main_window.h" 23 | 24 | namespace g2o { 25 | class OptimizationAlgorithm; 26 | } 27 | 28 | class MainWindow : public QMainWindow, public Ui::BaseMainWindow 29 | { 30 | Q_OBJECT 31 | public: 32 | MainWindow(QWidget * parent = 0, Qt::WindowFlags flags = 0); 33 | ~MainWindow(); 34 | 35 | g2o::OptimizationAlgorithm* solverGaussNewton; 36 | g2o::OptimizationAlgorithm* solverLevenberg; 37 | 38 | public slots: 39 | void on_actionLoad_triggered(bool); 40 | void on_actionSave_triggered(bool); 41 | void on_actionQuit_triggered(bool); 42 | void on_btnOptimize_clicked(); 43 | void on_btnInitialGuess_clicked(); 44 | 45 | protected: 46 | void fixGraph(); 47 | 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/slam2d/slam2d_viewer.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // 4 | // This file is part of g2o. 5 | // 6 | // g2o is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // g2o is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with g2o. If not, see . 18 | 19 | #ifndef G2O_QGL_GRAPH_VIEWER_H 20 | #define G2O_QGL_GRAPH_VIEWER_H 21 | 22 | #include "qglviewer.h" 23 | 24 | namespace g2o { 25 | 26 | class SparseOptimizer; 27 | 28 | class Slam2DViewer : public QGLViewer 29 | { 30 | public: 31 | Slam2DViewer(QWidget* parent=NULL, const QGLWidget* shareWidget=0, Qt::WindowFlags flags=0); 32 | ~Slam2DViewer(); 33 | virtual void draw(); 34 | void init(); 35 | 36 | public: 37 | SparseOptimizer* graph; 38 | bool drawCovariance; 39 | }; 40 | 41 | } // end namespace 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/sphere/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_EXECUTABLE(create_sphere 2 | create_sphere.cpp 3 | ) 4 | 5 | SET_TARGET_PROPERTIES(create_sphere PROPERTIES OUTPUT_NAME create_sphere${EXE_POSTFIX}) 6 | TARGET_LINK_LIBRARIES(create_sphere core types_slam3d) 7 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/target/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CHOLMOD_INCLUDE_DIR}) 2 | 3 | ADD_EXECUTABLE(static_target 4 | static_target.cpp 5 | ) 6 | TARGET_LINK_LIBRARIES(static_target core solver_cholmod) 7 | SET_TARGET_PROPERTIES(static_target PROPERTIES OUTPUT_NAME static_target${EXE_POSTFIX}) 8 | 9 | ADD_EXECUTABLE(constant_velocity_target 10 | constant_velocity_target.cpp 11 | ) 12 | 13 | SET_TARGET_PROPERTIES(constant_velocity_target PROPERTIES OUTPUT_NAME constant_velocity_target${EXE_POSTFIX}) 14 | 15 | TARGET_LINK_LIBRARIES(constant_velocity_target core solver_cholmod solver_pcg types_slam2d) 16 | 17 | 18 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/target/continuous_to_discrete.h: -------------------------------------------------------------------------------- 1 | #ifndef G2O_CONTINUOUS_TO_DISCRETE_H_ 2 | #define G2O_CONTINUOUS_TO_DISCRETE_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Form for fixed-size matrices 8 | template 9 | void continuousToDiscrete(MatrixType& Fd, MatrixType& Qd, 10 | const MatrixType& Fc, const MatrixType& Qc, double dt) 11 | { 12 | enum 13 | { 14 | NX = MatrixType::ColsAtCompileTime, 15 | NY = MatrixType::RowsAtCompileTime, 16 | NX2 = 2 * MatrixType::RowsAtCompileTime 17 | }; 18 | 19 | typedef Eigen::Matrix DoubleSizedMatrixType; 20 | DoubleSizedMatrixType bigA(NX2,NX2), bigB(NX2,NX2); 21 | 22 | // Construct the "big A matrix" 23 | bigA.template topLeftCorner()=-Fc*dt; 24 | bigA.template topRightCorner()= Qc * dt; 25 | bigA.template bottomLeftCorner().setZero(); 26 | bigA.template bottomRightCorner()=Fc.transpose() * dt; 27 | 28 | // bigB = expm(bigA) 29 | //Eigen::MatrixExponential me(bigA); 30 | //me.compute(bigB); 31 | bigB = bigA.exp(); 32 | 33 | // Extract the discrete time components 34 | Fd = bigB.template bottomRightCorner().transpose(); 35 | Qd = Fd * bigB.template topRightCorner(); 36 | } 37 | 38 | #endif // __CONTINUOUS_TO_DISCRETE_H__ 39 | -------------------------------------------------------------------------------- /g2opy/g2o/examples/tutorial_slam2d/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 2 | 3 | ADD_LIBRARY(tutorial_slam2d_library ${G2O_LIB_TYPE} 4 | edge_se2_pointxy.cpp se2.h vertex_point_xy.h 5 | edge_se2.cpp edge_se2_pointxy.h vertex_se2.cpp 6 | edge_se2.h rand.h vertex_point_xy.cpp vertex_se2.h 7 | parameter_se2_offset.h parameter_se2_offset.cpp 8 | types_tutorial_slam2d.h types_tutorial_slam2d.cpp 9 | simulator.h simulator.cpp 10 | g2o_tutorial_slam2d_api.h 11 | ) 12 | 13 | SET_TARGET_PROPERTIES(tutorial_slam2d_library PROPERTIES OUTPUT_NAME ${LIB_PREFIX}tutorial_slam2d) 14 | 15 | TARGET_LINK_LIBRARIES(tutorial_slam2d_library core solver_csparse) 16 | 17 | ADD_EXECUTABLE(tutorial_slam2d 18 | tutorial_slam2d.cpp 19 | ) 20 | 21 | SET_TARGET_PROPERTIES(tutorial_slam2d PROPERTIES OUTPUT_NAME tutorial_slam2d${EXE_POSTFIX}) 22 | 23 | TARGET_LINK_LIBRARIES(tutorial_slam2d tutorial_slam2d_library) 24 | -------------------------------------------------------------------------------- /g2opy/g2o/solvers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(pcg) 2 | ADD_SUBDIRECTORY(dense) 3 | ADD_SUBDIRECTORY(structure_only) 4 | 5 | IF(CSPARSE_FOUND) 6 | ADD_SUBDIRECTORY(csparse) 7 | ADD_SUBDIRECTORY(slam2d_linear) 8 | ENDIF() 9 | 10 | IF(CHOLMOD_FOUND) 11 | ADD_SUBDIRECTORY(cholmod) 12 | ENDIF(CHOLMOD_FOUND) 13 | 14 | # Sparse Module of Eigen is stable starting from 3.1 15 | IF (DEFINED EIGEN3_VERSION) 16 | IF(${EIGEN3_VERSION} VERSION_GREATER "3.1.0" OR ${EIGEN3_VERSION} VERSION_EQUAL "3.1.0") 17 | ADD_SUBDIRECTORY(eigen) 18 | ENDIF() 19 | ENDIF() 20 | -------------------------------------------------------------------------------- /g2opy/g2o/solvers/cholmod/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(solver_cholmod ${G2O_LIB_TYPE} 2 | solver_cholmod.cpp 3 | linear_solver_cholmod.h 4 | ) 5 | 6 | INCLUDE_DIRECTORIES(${CHOLMOD_INCLUDE_DIR}) 7 | 8 | SET_TARGET_PROPERTIES(solver_cholmod PROPERTIES OUTPUT_NAME ${LIB_PREFIX}solver_cholmod) 9 | 10 | ADD_DEFINITIONS(${BLAS_DEFINITIONS} ${LAPACK_DEFINITIONS}) 11 | TARGET_LINK_LIBRARIES(solver_cholmod ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} core) 12 | 13 | INSTALL(TARGETS solver_cholmod 14 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 15 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 16 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 17 | ) 18 | 19 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 20 | 21 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/solvers/cholmod) 22 | -------------------------------------------------------------------------------- /g2opy/g2o/solvers/csparse/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 2 | 3 | ADD_LIBRARY(csparse_extension ${G2O_LGPL_LIB_TYPE} 4 | csparse_helper.cpp csparse_helper.h 5 | g2o_csparse_extension_api.h 6 | ) 7 | SET_TARGET_PROPERTIES(csparse_extension PROPERTIES OUTPUT_NAME ${LIB_PREFIX}csparse_extension) 8 | 9 | IF(BUILD_CSPARSE) 10 | TARGET_LINK_LIBRARIES(csparse_extension csparse) 11 | ELSE() 12 | TARGET_LINK_LIBRARIES(csparse_extension ${CSPARSE_LIBRARY}) 13 | ENDIF() 14 | 15 | 16 | ADD_LIBRARY(solver_csparse ${G2O_LIB_TYPE} 17 | solver_csparse.cpp 18 | linear_solver_csparse.h 19 | g2o_csparse_api.h 20 | ) 21 | SET_TARGET_PROPERTIES(solver_csparse PROPERTIES OUTPUT_NAME ${LIB_PREFIX}solver_csparse) 22 | 23 | TARGET_LINK_LIBRARIES(solver_csparse csparse_extension core) 24 | 25 | 26 | INSTALL(TARGETS solver_csparse csparse_extension 27 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 28 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 29 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 30 | ) 31 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 32 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/solvers/csparse) 33 | -------------------------------------------------------------------------------- /g2opy/g2o/solvers/csparse/csparse_helper.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // 4 | // g2o is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published 6 | // by the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // g2o is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with this program. If not, see . 16 | 17 | #ifndef G2O_CSPARSE_HELPER_H 18 | #define G2O_CSPARSE_HELPER_H 19 | 20 | #ifndef NCOMPLEX 21 | #define NCOMPLEX 22 | #endif 23 | #include 24 | 25 | #include "g2o_csparse_extension_api.h" 26 | 27 | namespace g2o { 28 | 29 | namespace csparse_extension { 30 | 31 | /** 32 | * write the sparse matrix to a file loadable with ocatve 33 | */ 34 | G2O_CSPARSE_EXTENSION_API bool writeCs2Octave(const char* filename, const cs* A, bool upperTriangular = true); 35 | 36 | // our extensions to csparse 37 | G2O_CSPARSE_EXTENSION_API csn* cs_chol_workspace (const cs *A, const css *S, int* cin, double* xin); 38 | G2O_CSPARSE_EXTENSION_API int cs_cholsolsymb(const cs *A, double *b, const css* S, double* workspace, int* work); 39 | 40 | } // end namespace 41 | } // end namespace 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /g2opy/g2o/solvers/csparse/g2o_csparse_extension_api.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2012 Rainer Kuemmerle 3 | // 4 | // g2o is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published 6 | // by the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // g2o is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with this program. If not, see . 16 | 17 | #ifndef G2O_CSPARSE_EXTENSION_API_H 18 | #define G2O_CSPARSE_EXTENSION_API_H 19 | 20 | #include "g2o/config.h" 21 | 22 | #ifdef _MSC_VER 23 | // We are using a Microsoft compiler: 24 | #ifdef G2O_LGPL_SHARED_LIBS 25 | #ifdef csparse_extension_EXPORTS 26 | #define G2O_CSPARSE_EXTENSION_API __declspec(dllexport) 27 | #else 28 | #define G2O_CSPARSE_EXTENSION_API __declspec(dllimport) 29 | #endif 30 | #else 31 | #define G2O_CSPARSE_EXTENSION_API 32 | #endif 33 | 34 | #else 35 | // Not Microsoft compiler so set empty definition: 36 | #define G2O_CSPARSE_EXTENSION_API 37 | #endif 38 | 39 | #endif // G2O_CSPARSE_API_H 40 | -------------------------------------------------------------------------------- /g2opy/g2o/solvers/dense/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(solver_dense ${G2O_LIB_TYPE} 2 | solver_dense.cpp linear_solver_dense.h 3 | ) 4 | 5 | SET_TARGET_PROPERTIES(solver_dense PROPERTIES OUTPUT_NAME ${LIB_PREFIX}solver_dense) 6 | 7 | TARGET_LINK_LIBRARIES(solver_dense core) 8 | 9 | INSTALL(TARGETS solver_dense 10 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 11 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 12 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 13 | ) 14 | 15 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 16 | 17 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/solvers/dense) 18 | -------------------------------------------------------------------------------- /g2opy/g2o/solvers/eigen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(solver_eigen ${G2O_LIB_TYPE} 2 | solver_eigen.cpp 3 | linear_solver_eigen.h 4 | ) 5 | SET_TARGET_PROPERTIES(solver_eigen PROPERTIES OUTPUT_NAME ${LIB_PREFIX}solver_eigen) 6 | TARGET_LINK_LIBRARIES(solver_eigen core) 7 | 8 | INSTALL(TARGETS solver_eigen 9 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 10 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 11 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 12 | ) 13 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 14 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/solvers/eigen) 15 | -------------------------------------------------------------------------------- /g2opy/g2o/solvers/pcg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(solver_pcg ${G2O_LIB_TYPE} 2 | solver_pcg.cpp 3 | linear_solver_pcg.h 4 | linear_solver_pcg.hpp 5 | ) 6 | 7 | SET_TARGET_PROPERTIES(solver_pcg PROPERTIES OUTPUT_NAME ${LIB_PREFIX}solver_pcg) 8 | 9 | TARGET_LINK_LIBRARIES(solver_pcg core) 10 | 11 | INSTALL(TARGETS solver_pcg 12 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 13 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 14 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 15 | ) 16 | 17 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 18 | 19 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/solvers/pcg) 20 | -------------------------------------------------------------------------------- /g2opy/g2o/solvers/slam2d_linear/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(solver_slam2d_linear ${G2O_LIB_TYPE} 2 | slam2d_linear.cpp 3 | solver_slam2d_linear.h solver_slam2d_linear.cpp 4 | g2o_slam2d_linear_api.h 5 | ) 6 | 7 | INCLUDE_DIRECTORIES(${CSPARSE_INCLUDE_DIR}) 8 | 9 | SET_TARGET_PROPERTIES(solver_slam2d_linear PROPERTIES OUTPUT_NAME ${LIB_PREFIX}solver_slam2d_linear) 10 | TARGET_LINK_LIBRARIES(solver_slam2d_linear solver_csparse types_slam2d) 11 | 12 | INSTALL(TARGETS solver_slam2d_linear 13 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 14 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 15 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 16 | ) 17 | 18 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 19 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/solvers/slam2d_linear) 20 | -------------------------------------------------------------------------------- /g2opy/g2o/solvers/structure_only/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(solver_structure_only ${G2O_LIB_TYPE} 2 | structure_only.cpp 3 | structure_only_solver.h 4 | ) 5 | 6 | SET_TARGET_PROPERTIES(solver_structure_only PROPERTIES OUTPUT_NAME ${LIB_PREFIX}solver_structure_only) 7 | TARGET_LINK_LIBRARIES(solver_structure_only core) 8 | 9 | INSTALL(TARGETS solver_structure_only 10 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 11 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 12 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 13 | ) 14 | 15 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 16 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/solvers/structure_only) 17 | -------------------------------------------------------------------------------- /g2opy/g2o/stuff/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(stuff ${G2O_LIB_TYPE} 2 | filesys_tools.h string_tools.h 3 | color_macros.h macros.h timeutil.cpp 4 | command_args.cpp misc.h sparse_helper.cpp timeutil.h 5 | command_args.h os_specific.c sparse_helper.h 6 | filesys_tools.cpp os_specific.h string_tools.cpp 7 | property.cpp property.h 8 | sampler.cpp sampler.h unscented.h 9 | tictoc.cpp tictoc.h 10 | g2o_stuff_api.h 11 | ) 12 | 13 | SET_TARGET_PROPERTIES(stuff PROPERTIES OUTPUT_NAME ${LIB_PREFIX}stuff) 14 | 15 | INSTALL(TARGETS stuff 16 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 17 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 18 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 19 | ) 20 | 21 | # build our OpenGL helper library 22 | IF(OPENGL_FOUND AND G2O_HAVE_OPENGL) 23 | ADD_LIBRARY(opengl_helper ${G2O_LIB_TYPE} 24 | opengl_primitives.cpp opengl_primitives.h 25 | ) 26 | INSTALL(TARGETS opengl_helper 27 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 28 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 29 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 30 | ) 31 | TARGET_LINK_LIBRARIES(opengl_helper ${OPENGL_LIBRARIES}) 32 | SET_TARGET_PROPERTIES(opengl_helper PROPERTIES OUTPUT_NAME ${LIB_PREFIX}opengl_helper) 33 | ENDIF() 34 | 35 | IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND NOT ANDROID) 36 | TARGET_LINK_LIBRARIES(stuff rt) 37 | ENDIF() 38 | 39 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 40 | 41 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/stuff) 42 | -------------------------------------------------------------------------------- /g2opy/g2o/types/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Pre-canned types 2 | ADD_SUBDIRECTORY(data) 3 | ADD_SUBDIRECTORY(slam2d) 4 | ADD_SUBDIRECTORY(slam3d) 5 | ADD_SUBDIRECTORY(sba) 6 | ADD_SUBDIRECTORY(sim3) 7 | ADD_SUBDIRECTORY(icp) 8 | ADD_SUBDIRECTORY(sclam2d) 9 | 10 | ADD_SUBDIRECTORY(slam2d_addons) 11 | ADD_SUBDIRECTORY(slam3d_addons) 12 | 13 | OPTION(G2O_BUILD_DEPRECATED_TYPES "Compile the deprecated types" OFF) 14 | IF(G2O_BUILD_DEPRECATED_TYPES) 15 | ADD_SUBDIRECTORY(deprecated) 16 | ENDIF() 17 | -------------------------------------------------------------------------------- /g2opy/g2o/types/data/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(types_data ${G2O_LIB_TYPE} 2 | types_data.cpp 3 | robot_data.cpp robot_data.h 4 | vertex_tag.cpp vertex_tag.h 5 | vertex_ellipse.cpp vertex_ellipse.h 6 | laser_parameters.cpp laser_parameters.h 7 | raw_laser.cpp raw_laser.h 8 | robot_laser.cpp robot_laser.h 9 | data_queue.cpp data_queue.h 10 | g2o_types_data_api.h 11 | ) 12 | 13 | SET_TARGET_PROPERTIES(types_data PROPERTIES OUTPUT_NAME ${LIB_PREFIX}types_data) 14 | 15 | TARGET_LINK_LIBRARIES(types_data core types_slam2d) 16 | IF(G2O_HAVE_OPENGL) 17 | TARGET_LINK_LIBRARIES(types_data freeglut_minimal opengl_helper) 18 | ENDIF() 19 | 20 | INSTALL(TARGETS types_data 21 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 22 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 23 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 24 | ) 25 | 26 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 27 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/types/data) 28 | -------------------------------------------------------------------------------- /g2opy/g2o/types/data/types_data.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_TYPES_DATA_H 28 | #define G2O_TYPES_DATA_H 29 | 30 | #include "robot_laser.h" 31 | #include "vertex_tag.h" 32 | #include "vertex_ellipse.h" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /g2opy/g2o/types/deprecated/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(slam3d) 2 | -------------------------------------------------------------------------------- /g2opy/g2o/types/deprecated/slam3d/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(deprecated_types_slam3d ${G2O_LIB_TYPE} 2 | se3quat_gradients.cpp 3 | se3quat_gradients.h 4 | vertex_se3_quat.cpp 5 | vertex_se3_quat.h 6 | edge_se3_quat.cpp 7 | edge_se3_quat.h 8 | vertex_pointxyz.cpp 9 | vertex_pointxyz.h 10 | parameter_se3_offset.cpp 11 | parameter_se3_offset.h 12 | edge_se3_offset.cpp 13 | edge_se3_offset.h 14 | edge_se3_prior.cpp 15 | edge_se3_prior.h 16 | edge_se3_pointxyz.cpp 17 | edge_se3_pointxyz.h 18 | parameter_camera.cpp 19 | parameter_camera.h 20 | edge_se3_pointxyz_disparity.cpp 21 | edge_se3_pointxyz_disparity.h 22 | edge_se3_pointxyz_depth.cpp 23 | edge_se3_pointxyz_depth.h 24 | types_slam3d.cpp 25 | types_slam3d.h 26 | g2o_deprecated_types_slam3d_api.h 27 | ) 28 | 29 | SET_TARGET_PROPERTIES(deprecated_types_slam3d PROPERTIES OUTPUT_NAME ${LIB_PREFIX}deprecated_types_slam3d) 30 | TARGET_LINK_LIBRARIES(deprecated_types_slam3d ${OPENGL_gl_LIBRARY} core types_slam3d) 31 | 32 | INSTALL(TARGETS deprecated_types_slam3d 33 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 34 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 35 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 36 | ) 37 | 38 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 39 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/types/deprecated/slam3d) 40 | -------------------------------------------------------------------------------- /g2opy/g2o/types/icp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(types_icp ${G2O_LIB_TYPE} 2 | types_icp.cpp types_icp.h 3 | g2o_types_icp_api.h 4 | ) 5 | 6 | SET_TARGET_PROPERTIES(types_icp PROPERTIES OUTPUT_NAME ${LIB_PREFIX}types_icp) 7 | 8 | TARGET_LINK_LIBRARIES(types_icp types_sba types_slam3d) 9 | 10 | INSTALL(TARGETS types_icp 11 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 12 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 13 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 14 | ) 15 | 16 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 17 | 18 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/types/icp) 19 | -------------------------------------------------------------------------------- /g2opy/g2o/types/sba/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(types_sba ${G2O_LIB_TYPE} 2 | types_sba.h types_six_dof_expmap.h 3 | types_sba.cpp types_six_dof_expmap.cpp 4 | g2o_types_sba_api.h 5 | ) 6 | 7 | 8 | include_directories(${PROJECT_SOURCE_DIR}) 9 | include_directories(${EIGEN3_INCLUDE_DIR}) 10 | include_directories(${CHOLMOD_INCLUDE_DIR}) 11 | include_directories(${CSPARSE_INCLUDE_DIR}) 12 | 13 | # (astange) Have to include the path to your Python installation to find the "Python.h" file needed by pybind11. 14 | # This may just be a local issue for me, but this resolves it 15 | # https://cmake.org/cmake/help/latest/module/FindPython.html 16 | find_package (Python COMPONENTS Interpreter Development) 17 | include_directories(${Python_INCLUDE_DIRS}) 18 | 19 | # pybind11 (version 2.2.1) 20 | LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/EXTERNAL/pybind11/tools) 21 | include_directories(${PROJECT_SOURCE_DIR}/EXTERNAL/pybind11/include) 22 | include(pybind11Tools) 23 | 24 | 25 | SET_TARGET_PROPERTIES(types_sba PROPERTIES OUTPUT_NAME ${LIB_PREFIX}types_sba) 26 | 27 | TARGET_LINK_LIBRARIES(types_sba core types_slam3d) 28 | 29 | INSTALL(TARGETS types_sba 30 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 31 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 32 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 33 | ) 34 | 35 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 36 | 37 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/types/sba) 38 | -------------------------------------------------------------------------------- /g2opy/g2o/types/sclam2d/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(types_sclam2d ${G2O_LIB_TYPE} 2 | edge_se2_sensor_calib.cpp edge_se2_sensor_calib.h 3 | vertex_odom_differential_params.cpp vertex_odom_differential_params.h 4 | edge_se2_odom_differential_calib.cpp edge_se2_odom_differential_calib.h 5 | odometry_measurement.cpp odometry_measurement.h 6 | types_sclam2d.cpp types_sclam2d.h 7 | g2o_types_sclam2d_api.h 8 | ) 9 | 10 | SET_TARGET_PROPERTIES(types_sclam2d PROPERTIES OUTPUT_NAME ${LIB_PREFIX}types_sclam2d) 11 | 12 | TARGET_LINK_LIBRARIES(types_sclam2d types_slam2d core) 13 | IF(G2O_HAVE_OPENGL) 14 | TARGET_LINK_LIBRARIES(types_sclam2d ${OPENGL_gl_LIBRARY}) 15 | ENDIF() 16 | 17 | INSTALL(TARGETS types_sclam2d 18 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 19 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 20 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 21 | ) 22 | 23 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 24 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/types/sclam2d) 25 | -------------------------------------------------------------------------------- /g2opy/g2o/types/sclam2d/types_sclam2d.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // All rights reserved. 4 | // 5 | // Redistribution and use in source and binary forms, with or without 6 | // modification, are permitted provided that the following conditions are 7 | // met: 8 | // 9 | // * Redistributions of source code must retain the above copyright notice, 10 | // this list of conditions and the following disclaimer. 11 | // * Redistributions in binary form must reproduce the above copyright 12 | // notice, this list of conditions and the following disclaimer in the 13 | // documentation and/or other materials provided with the distribution. 14 | // 15 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 16 | // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 | // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 21 | // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | #ifndef G2O_TYPES_SCLAM_H 28 | #define G2O_TYPES_SCLAM_H 29 | 30 | #include "edge_se2_sensor_calib.h" 31 | #include "edge_se2_odom_differential_calib.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /g2opy/g2o/types/sim3/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(types_sim3 ${G2O_LIB_TYPE} 2 | types_seven_dof_expmap.cpp 3 | types_seven_dof_expmap.h 4 | ) 5 | 6 | 7 | include_directories(${PROJECT_SOURCE_DIR}) 8 | include_directories(${EIGEN3_INCLUDE_DIR}) 9 | include_directories(${CHOLMOD_INCLUDE_DIR}) 10 | include_directories(${CSPARSE_INCLUDE_DIR}) 11 | 12 | # (astange) Have to include the "include" path to your Python installation to find the "Python.h" file needed for pybind11. 13 | # My setup is screwy, so may just be a local issue for me 14 | # https://cmake.org/cmake/help/latest/module/FindPython.html 15 | find_package (Python COMPONENTS Interpreter Development) 16 | include_directories(${Python_INCLUDE_DIRS}) 17 | 18 | # pybind11 (version 2.2.1) 19 | LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/EXTERNAL/pybind11/tools) 20 | include_directories(${PROJECT_SOURCE_DIR}/EXTERNAL/pybind11/include) 21 | include(pybind11Tools) 22 | 23 | 24 | 25 | SET_TARGET_PROPERTIES(types_sim3 PROPERTIES OUTPUT_NAME ${LIB_PREFIX}types_sim3) 26 | 27 | TARGET_LINK_LIBRARIES(types_sim3 types_sba) 28 | 29 | INSTALL(TARGETS types_sim3 30 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 31 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 32 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 33 | ) 34 | 35 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 36 | 37 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/types/sim3) 38 | 39 | -------------------------------------------------------------------------------- /g2opy/g2o/types/slam2d/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(types_slam2d ${G2O_LIB_TYPE} 2 | se2.h 3 | edge_se2_pointxy_bearing.h edge_se2_prior.h 4 | edge_se2.cpp edge_se2_pointxy_calib.cpp types_slam2d.cpp 5 | edge_se2.h edge_se2_pointxy_calib.h vertex_point_xy.cpp 6 | edge_se2_pointxy.cpp vertex_point_xy.h 7 | edge_se2_pointxy.h vertex_se2.cpp 8 | edge_se2_pointxy_bearing.cpp edge_se2_prior.cpp vertex_se2.h 9 | parameter_se2_offset.cpp parameter_se2_offset.h 10 | edge_se2_offset.cpp edge_se2_offset.h 11 | edge_se2_pointxy_offset.cpp edge_se2_pointxy_offset.h 12 | edge_se2_xyprior.cpp edge_se2_xyprior.h 13 | edge_pointxy.cpp edge_pointxy.h 14 | edge_se2_twopointsxy.cpp edge_se2_twopointsxy.h 15 | edge_se2_lotsofxy.cpp edge_se2_lotsofxy.h 16 | g2o_types_slam2d_api.h 17 | ) 18 | 19 | SET_TARGET_PROPERTIES(types_slam2d PROPERTIES OUTPUT_NAME ${LIB_PREFIX}types_slam2d) 20 | 21 | TARGET_LINK_LIBRARIES(types_slam2d core) 22 | IF(G2O_HAVE_OPENGL) 23 | TARGET_LINK_LIBRARIES(types_slam2d opengl_helper ${OPENGL_gl_LIBRARY} ) 24 | ENDIF() 25 | 26 | INSTALL(TARGETS types_slam2d 27 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 28 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 29 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 30 | ) 31 | 32 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 33 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/types/slam2d) 34 | -------------------------------------------------------------------------------- /g2opy/g2o/types/slam2d_addons/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(types_slam2d_addons ${G2O_LIB_TYPE} 2 | line_2d.h 3 | types_slam2d_addons.cpp types_slam2d_addons.h 4 | vertex_segment2d.cpp vertex_segment2d.h 5 | edge_se2_segment2d.cpp edge_se2_segment2d.h 6 | edge_se2_segment2d_line.cpp edge_se2_segment2d_line.h 7 | edge_se2_segment2d_pointLine.cpp edge_se2_segment2d_pointLine.h 8 | vertex_line2d.cpp vertex_line2d.h 9 | edge_se2_line2d.cpp edge_se2_line2d.h 10 | edge_line2d_pointxy.cpp edge_line2d_pointxy.h 11 | edge_line2d.cpp edge_line2d.h 12 | g2o_types_slam2d_addons_api.h 13 | ) 14 | 15 | SET_TARGET_PROPERTIES(types_slam2d_addons PROPERTIES OUTPUT_NAME ${LIB_PREFIX}types_slam2d_addons) 16 | 17 | TARGET_LINK_LIBRARIES(types_slam2d_addons types_slam2d core) 18 | IF(G2O_HAVE_OPENGL) 19 | TARGET_LINK_LIBRARIES(types_slam2d_addons ${OPENGL_gl_LIBRARY}) 20 | ENDIF() 21 | 22 | INSTALL(TARGETS types_slam2d_addons 23 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 24 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 25 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 26 | ) 27 | 28 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 29 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/types/slam2d_addons) 30 | -------------------------------------------------------------------------------- /g2opy/g2o/types/slam3d/types_slam3d.h: -------------------------------------------------------------------------------- 1 | // g2o - General Graph Optimization 2 | // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 3 | // 4 | // g2o is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU Lesser General Public License as published 6 | // by the Free Software Foundation, either version 3 of the License, or 7 | // (at your option) any later version. 8 | // 9 | // g2o is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public License 15 | // along with this program. If not, see . 16 | 17 | #ifndef G2O_TYPES_SLAM3D_ 18 | #define G2O_TYPES_SLAM3D_ 19 | 20 | #include "g2o/config.h" 21 | #include "g2o/core/base_vertex.h" 22 | #include "g2o/core/base_binary_edge.h" 23 | #include "g2o/core/hyper_graph_action.h" 24 | 25 | #define THREE_D_TYPES_ANALYTIC_JACOBIAN 26 | 27 | #include "vertex_se3.h" 28 | #include "edge_se3.h" 29 | #include "vertex_pointxyz.h" 30 | 31 | #include "parameter_se3_offset.h" 32 | #include "edge_se3_pointxyz.h" 33 | #include "edge_se3_offset.h" 34 | 35 | #include "parameter_camera.h" 36 | #include "parameter_stereo_camera.h" 37 | #include "edge_se3_pointxyz_disparity.h" 38 | #include "edge_se3_pointxyz_depth.h" 39 | #include "edge_se3_prior.h" 40 | 41 | #include "edge_pointxyz.h" 42 | 43 | #include "edge_se3_lotsofxyz.h" 44 | #endif 45 | -------------------------------------------------------------------------------- /g2opy/g2o/types/slam3d_addons/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_LIBRARY(types_slam3d_addons ${G2O_LIB_TYPE} 2 | vertex_se3_euler.cpp 3 | vertex_se3_euler.h 4 | edge_se3_euler.cpp 5 | edge_se3_euler.h 6 | vertex_plane.cpp 7 | vertex_plane.h 8 | edge_se3_plane_calib.cpp 9 | edge_se3_plane_calib.h 10 | line3d.cpp line3d.h 11 | vertex_line3d.cpp vertex_line3d.h 12 | edge_se3_line.cpp edge_se3_line.h 13 | edge_plane.cpp edge_plane.h 14 | edge_se3_calib.cpp edge_se3_calib.h 15 | types_slam3d_addons.cpp 16 | types_slam3d_addons.h 17 | ) 18 | 19 | 20 | SET_TARGET_PROPERTIES(types_slam3d_addons PROPERTIES OUTPUT_NAME ${LIB_PREFIX}types_slam3d_addons) 21 | 22 | TARGET_LINK_LIBRARIES(types_slam3d_addons types_slam3d core) 23 | IF(G2O_HAVE_OPENGL) 24 | TARGET_LINK_LIBRARIES(types_slam3d_addons ${OPENGL_gl_LIBRARY} ) 25 | ENDIF() 26 | 27 | INSTALL(TARGETS types_slam3d_addons 28 | RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin 29 | LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 30 | ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib 31 | ) 32 | 33 | FILE(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp") 34 | INSTALL(FILES ${headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/g2o/types/slam3d_addons) 35 | -------------------------------------------------------------------------------- /g2opy/install.sh: -------------------------------------------------------------------------------- 1 | make -j8 2 | cd .. 3 | python setup.py install 4 | cd build 5 | -------------------------------------------------------------------------------- /g2opy/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${PROJECT_SOURCE_DIR}) 2 | 3 | include_directories(${EIGEN3_INCLUDE_DIR}) 4 | include_directories(${CHOLMOD_INCLUDE_DIR}) 5 | include_directories(${CSPARSE_INCLUDE_DIR}) 6 | 7 | 8 | # pybind11 (version 2.2.1) 9 | LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/EXTERNAL/pybind11/tools) 10 | include_directories(${PROJECT_SOURCE_DIR}/EXTERNAL/pybind11/include) 11 | include(pybind11Tools) 12 | 13 | 14 | pybind11_add_module(g2o g2o.cpp) 15 | target_link_libraries(g2o PRIVATE 16 | core 17 | solver_cholmod 18 | solver_csparse 19 | solver_eigen 20 | solver_dense 21 | solver_pcg 22 | solver_slam2d_linear 23 | solver_structure_only 24 | types_data 25 | types_icp 26 | types_sba 27 | types_sclam2d 28 | types_sim3 29 | types_slam2d 30 | types_slam2d_addons 31 | types_slam3d 32 | types_slam3d_addons 33 | contrib 34 | ) -------------------------------------------------------------------------------- /g2opy/python/contrib/contrib.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "sba_addons/types_stereo_sba.h" 4 | #include "estimate_propagator/smooth_estimate_propagator.h" 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareContrib(py::module & m) { 14 | 15 | // sba_addons 16 | declareTypesStereoSBA(m); 17 | 18 | py::module contrib = m.def_submodule("contrib", "Contrib part of the library'"); 19 | 20 | // estimate propagator 21 | declareTypesEstimatePropagator(contrib); 22 | 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /g2opy/python/contrib/estimate_propagator/smooth_estimate_propagator.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "contrib/estimate_propagator/SmoothEstimatePropagator.hpp" 4 | 5 | 6 | namespace py = pybind11; 7 | using namespace pybind11::literals; 8 | 9 | 10 | namespace g2o { 11 | 12 | void declareTypesEstimatePropagator(py::module & m) { 13 | 14 | py::class_(m, "SmoothEstimatePropagator") 15 | .def(py::init(), 16 | "g"_a, 17 | "maxDistance"_a=std::numeric_limits::max(), 18 | "maxEdgeCost"_a=std::numeric_limits::max(), 19 | py::keep_alive<1, 2>()) 20 | .def("propagate", &SmoothEstimatePropagator::propagate, 21 | "v"_a, 22 | py::keep_alive<1, 2>()) // (OptimizableGraph::Vertex*) -> void 23 | 24 | 25 | ; 26 | 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /g2opy/python/contrib/sba_addons/types_stereo_sba.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "contrib/sba_addons/types_stereo_sba.hpp" 4 | 5 | 6 | namespace py = pybind11; 7 | using namespace pybind11::literals; 8 | 9 | 10 | namespace g2o { 11 | 12 | void declareTypesStereoSBA(py::module & m) { 13 | 14 | py::class_>(m, "EdgeProjectP2MCRight") 15 | .def(py::init<>()) 16 | .def("compute_error", &EdgeProjectP2MCRight::computeError) // () -> void 17 | .def("linearize_oplus", &EdgeProjectP2MCRight::linearizeOplus) 18 | ; 19 | 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /g2opy/python/core/base_binary_edge.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | 8 | namespace py = pybind11; 9 | using namespace pybind11::literals; 10 | 11 | 12 | namespace g2o { 13 | 14 | template 15 | void templatedBaseBinaryEdge(py::module & m, const std::string & suffix) { 16 | using CLS = BaseBinaryEdge; 17 | 18 | py::class_>(m, ("BaseBinaryEdge" + suffix).c_str()) 19 | //.def(py::init<>()) // lead to "error: invalid new-expression of abstract class type ..." 20 | .def("create_from", &CLS::createFrom) // -> OptimizableGraph::Vertex* 21 | .def("create_to", &CLS::createTo) // -> OptimizableGraph::Vertex* 22 | .def("create_vertex", &CLS::createVertex, "i"_a) // -> OptimizableGraph::Vertex* 23 | 24 | .def("resize", &CLS::resize) 25 | .def("all_vertices_fixed", &CLS::allVerticesFixed) 26 | .def("linearize_oplus", (void (CLS::*) (JacobianWorkspace&)) &CLS::linearizeOplus) 27 | .def("linearize_oplus", (void (CLS::*) ()) &CLS::linearizeOplus) 28 | .def("jacobian_oplus_xi", &CLS::jacobianOplusXi) // -> JacobianXiOplusType& 29 | .def("jacobian_oplus_xj", &CLS::jacobianOplusXj) // -> JacobianXjOplusType& 30 | .def("construct_quadratic_form", &CLS::constructQuadraticForm) 31 | .def("map_hessian_memory", &CLS::mapHessianMemory, 32 | "d"_a, "i"_a, "j"_a, "row_mayor"_a) 33 | 34 | ; 35 | } 36 | 37 | 38 | 39 | 40 | void declareBaseBinaryEdge(py::module & m) { 41 | // common types 42 | } 43 | 44 | 45 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/core/base_unary_edge.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | 8 | namespace py = pybind11; 9 | using namespace pybind11::literals; 10 | 11 | 12 | namespace g2o { 13 | 14 | template 15 | void templatedBaseUnaryEdge(py::module & m, const std::string & suffix) { 16 | using CLS = BaseUnaryEdge; 17 | 18 | py::class_>(m, ("BaseUnaryEdge" + suffix).c_str()) 19 | .def("resize", &CLS::resize, "size"_a) // size_t -> 20 | .def("all_vertices_fixed", &CLS::allVerticesFixed) // -> bool 21 | .def("create_vertex", &CLS::createVertex, "i"_a) // int -> OptimizableGraph::Vertex* 22 | .def("construct_quadratic_form", &CLS::constructQuadraticForm) 23 | .def("linearize_oplus", (void (CLS::*) (JacobianWorkspace&)) &CLS::linearizeOplus) 24 | .def("linearize_oplus", (void (CLS::*) ()) &CLS::linearizeOplus) 25 | .def("initial_estimate", &CLS::initialEstimate) 26 | ; // (const OptimizableGraph::VertexSet&, OptimizableGraph::Vertex*) -> 27 | } 28 | 29 | 30 | 31 | 32 | 33 | void declareBaseUnaryEdge(py::module & m) { 34 | // common types 35 | } 36 | 37 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/core/hyper_graph_action.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | 6 | namespace py = pybind11; 7 | using namespace pybind11::literals; 8 | 9 | 10 | namespace g2o { 11 | 12 | void delcareHyperGraphAction(py::module& m) { 13 | py::class_(m, "HyperGraphAction"); 14 | 15 | // class G2O_CORE_API HyperGraphElementAction{ 16 | // class G2O_CORE_API HyperGraphElementActionCollection: public HyperGraphElementAction{ 17 | // class G2O_CORE_API HyperGraphActionLibrary{ 18 | // class G2O_CORE_API WriteGnuplotAction: public HyperGraphElementAction{ 19 | // class G2O_CORE_API DrawAction : public HyperGraphElementAction{ 20 | // class RegisterActionProxy 21 | // void G2O_CORE_API applyAction 22 | } 23 | 24 | 25 | } -------------------------------------------------------------------------------- /g2opy/python/core/jacobian_workspace.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | 6 | namespace py = pybind11; 7 | using namespace pybind11::literals; 8 | 9 | 10 | namespace g2o { 11 | 12 | void declareJacobianWorkspace(py::module & m) { 13 | 14 | py::class_(m, "JacobianWorkspace") 15 | .def(py::init<>()) 16 | .def("allocate", &JacobianWorkspace::allocate) 17 | 18 | .def("update_size", (void (JacobianWorkspace::*) (const HyperGraph::Edge*)) 19 | &JacobianWorkspace::updateSize, 20 | "e"_a) 21 | .def("update_size", (void (JacobianWorkspace::*) (const OptimizableGraph&)) 22 | &JacobianWorkspace::updateSize, 23 | "graph"_a) 24 | .def("update_size", (void (JacobianWorkspace::*) (int, int)) 25 | &JacobianWorkspace::updateSize, 26 | "num_vertices"_a, "dimension"_a) 27 | 28 | .def("workspace_for_vertex", &JacobianWorkspace::workspaceForVertex, 29 | "vertex_index"_a) // int -> double* 30 | ; 31 | 32 | } 33 | 34 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/core/linear_solver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | 9 | 10 | namespace py = pybind11; 11 | using namespace pybind11::literals; 12 | 13 | 14 | namespace g2o { 15 | 16 | template 17 | void templatedLinearSolver(py::module& m, const std::string& suffix) { 18 | py::class_>(m, ("LinearSolver"+suffix).c_str()) 19 | //.def("solve_blocks", &LinearSolver::solveBlocks) 20 | //.def("solve_pattern", &LinearSolver::solvePattern) 21 | //.def("write_debug", &LinearSolver::writeDebug) 22 | //.def("set_write_debug", &LinearSolver::setWriteDebug) 23 | ; 24 | } 25 | 26 | template 27 | void templatedLinearSolverCCS(py::module& m, const std::string& suffix) { 28 | templatedLinearSolver(m, suffix); 29 | 30 | py::class_, LinearSolver>(m, ("LinearSolverCCS"+suffix).c_str()) 31 | //.def(py::init<>()) 32 | ; 33 | } 34 | 35 | 36 | 37 | 38 | void declareLinearSolver(py::module & m) { 39 | // common types 40 | 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /g2opy/python/core/parameter.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | 6 | namespace py = pybind11; 7 | using namespace pybind11::literals; 8 | 9 | 10 | namespace g2o { 11 | 12 | void declareParameter(py::module & m) { 13 | 14 | py::class_(m, "Parameter") 15 | //.def(py::init<>()) 16 | .def("id", &Parameter::id) 17 | .def("set_id", &Parameter::setId, "id"_a) 18 | .def("element_type", &Parameter::elementType) 19 | ; 20 | 21 | } 22 | 23 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/core/parameter_container.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareSparseOptmizer(py::module & m) { 14 | 15 | py::class_>(m, "SparseOptmizer") 16 | 17 | ; 18 | 19 | m.def(); 20 | 21 | } 22 | 23 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/core/solver.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | 6 | namespace py = pybind11; 7 | using namespace pybind11::literals; 8 | 9 | 10 | namespace g2o { 11 | 12 | void declareSolver(py::module & m) { 13 | 14 | // abstract class 15 | py::class_(m, "Solver") 16 | .def("x", (double* (Solver::*) ()) &Solver::x) 17 | .def("b", (double* (Solver::*) ()) &Solver::b) 18 | .def("vector_size", &Solver::vectorSize) 19 | .def("optimizer", &Solver::optimizer) 20 | .def("set_optimizer", &Solver::setOptimizer) 21 | .def("levenberg", &Solver::levenberg) 22 | .def("set_levenberg", &Solver::setLevenberg) 23 | .def("supports_schur", &Solver::supportsSchur) 24 | .def("additional_vector_space", &Solver::additionalVectorSpace) 25 | .def("set_additional_vector_space", &Solver::setAdditionalVectorSpace) 26 | ; 27 | 28 | } 29 | 30 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/core/sparse_block_matrix.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | 6 | namespace py = pybind11; 7 | using namespace pybind11::literals; 8 | 9 | 10 | namespace g2o { 11 | 12 | namespace { 13 | template 14 | void templatedSparseBlockMatrix(py::module& m, const std::string& suffix) { 15 | using CLS = SparseBlockMatrix; 16 | 17 | py::class_(m, ("SparseBlockMatrix" + suffix).c_str()) 18 | .def(py::init<>()) 19 | .def("clear", &CLS::clear, "dealloc"_a=false) 20 | .def("cols", &CLS::cols) 21 | .def("rows", &CLS::rows) 22 | .def("block", (const MatrixType* (CLS::*) (int, int) const) &CLS::block, 23 | "r"_a, "c"_a) 24 | 25 | // TODO 26 | 27 | ; 28 | } 29 | } 30 | 31 | 32 | 33 | void delcareSparseBlockMatrix(py::module& m) { 34 | 35 | templatedSparseBlockMatrix(m, "X"); 36 | 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /g2opy/python/core/sparse_optimizer_terminate_action.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | 6 | namespace py = pybind11; 7 | using namespace pybind11::literals; 8 | 9 | 10 | namespace g2o { 11 | 12 | void delcareSparseOptimizerTerminateAction(py::module& m) { 13 | 14 | py::class_(m, "SparseOptimizerTerminateAction") 15 | .def(py::init<>()) 16 | .def("__call__", &SparseOptimizerTerminateAction::operator()) 17 | .def("gain_threshold", &SparseOptimizerTerminateAction::gainThreshold) 18 | .def("set_gain_threshold", &SparseOptimizerTerminateAction::setGainThreshold) 19 | .def("max_iterations", &SparseOptimizerTerminateAction::maxIterations) 20 | .def("set_max_iterations", &SparseOptimizerTerminateAction::setMaxIterations) 21 | ; 22 | 23 | 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /g2opy/python/examples/simple_optimize.py: -------------------------------------------------------------------------------- 1 | # https://github.com/RainerKuemmerle/g2o/blob/master/g2o/examples/simple_optimize/simple_optimize.cpp 2 | 3 | import numpy as np 4 | import g2o 5 | import os 6 | 7 | import argparse 8 | 9 | parser = argparse.ArgumentParser() 10 | parser.add_argument('-n', '--max_iterations', type=int, default=10, help='perform n iterations') 11 | parser.add_argument('-i', '--input', type=str, default='sphere2500.g2o', help='input file') 12 | parser.add_argument('-o', '--output', type=str, default='', help='save resulting graph as file') 13 | args = parser.parse_args() 14 | 15 | 16 | 17 | def main(): 18 | #solver = g2o.BlockSolverX(g2o.LinearSolverCholmodX()) 19 | solver = g2o.BlockSolverSE3(g2o.LinearSolverEigenSE3()) 20 | solver = g2o.OptimizationAlgorithmLevenberg(solver) 21 | 22 | optimizer = g2o.SparseOptimizer() 23 | optimizer.set_verbose(True) 24 | optimizer.set_algorithm(solver) 25 | 26 | optimizer.load(args.input) 27 | print('num vertices:', len(optimizer.vertices())) 28 | print('num edges:', len(optimizer.edges()), end='\n\n') 29 | 30 | optimizer.initialize_optimization() 31 | optimizer.optimize(args.max_iterations) 32 | 33 | if len(args.output) > 0: 34 | optimizer.save(args.output) 35 | 36 | 37 | if __name__ == '__main__': 38 | assert os.path.isfile(args.input), ( 39 | 'Please provide a existing .g2o file') 40 | 41 | main() -------------------------------------------------------------------------------- /g2opy/python/types/sclam2d/edge_se2_odom_differential_calib.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareEdgeSE2OdomDifferentialCalib(py::module& m) { 14 | 15 | py::class_>(m, "EdgeSE2OdomDifferentialCalib") 16 | .def(py::init<>()) 17 | .def("compute_error", &EdgeSE2OdomDifferentialCalib::computeError) 18 | ; 19 | 20 | // class G2O_TYPES_SCLAM2D_API EdgeSE2OdomDifferentialCalibDrawAction: public DrawAction 21 | 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /g2opy/python/types/sclam2d/edge_se2_sensor_calib.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareEdgeSE2SensorCalib(py::module& m) { 14 | 15 | py::class_>(m, "EdgeSE2SensorCalib") 16 | .def(py::init<>()) 17 | .def("compute_error", &EdgeSE2SensorCalib::computeError) 18 | .def("set_measurement", &EdgeSE2SensorCalib::setMeasurement) 19 | .def("initial_estimate_possible", &EdgeSE2SensorCalib::initialEstimatePossible) 20 | .def("initial_estimate", &EdgeSE2SensorCalib::initialEstimate) 21 | ; 22 | 23 | // class EdgeSE2SensorCalibDrawAction: public DrawAction 24 | 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /g2opy/python/types/sclam2d/types_sclam2d.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "odometry_measurement.h" 8 | #include "vertex_odom_differential_params.h" 9 | #include "edge_se2_sensor_calib.h" 10 | #include "edge_se2_odom_differential_calib.h" 11 | 12 | 13 | 14 | 15 | namespace g2o { 16 | 17 | G2O_USE_TYPE_GROUP(slam2d); 18 | 19 | G2O_REGISTER_TYPE_GROUP(sclam); 20 | G2O_REGISTER_TYPE(VERTEX_ODOM_DIFFERENTIAL, VertexOdomDifferentialParams); 21 | G2O_REGISTER_TYPE(EDGE_SE2_CALIB, EdgeSE2SensorCalib); 22 | G2O_REGISTER_TYPE(EDGE_SE2_ODOM_DIFFERENTIAL_CALIB, EdgeSE2OdomDifferentialCalib); 23 | 24 | 25 | 26 | void declareTypesSclam2d(py::module & m) { 27 | 28 | declareOdometryMeasurement(m); 29 | declareVertexOdomDifferentialParams(m); 30 | declareEdgeSE2SensorCalib(m); 31 | declareEdgeSE2OdomDifferentialCalib(m); 32 | 33 | 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /g2opy/python/types/sclam2d/vertex_odom_differential_params.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareVertexOdomDifferentialParams(py::module & m) { 14 | 15 | py::class_>(m, "VertexOdomDifferentialParams") 16 | .def(py::init<>()) 17 | .def("set_to_origin_impl", &VertexOdomDifferentialParams::setToOriginImpl) 18 | .def("oplus_impl", &VertexOdomDifferentialParams::oplusImpl) 19 | ; 20 | 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /g2opy/python/types/sim3/sim3.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "python/core/base_vertex.h" 8 | #include "python/core/base_edge.h" 9 | 10 | 11 | 12 | namespace py = pybind11; 13 | using namespace pybind11::literals; 14 | 15 | 16 | namespace g2o { 17 | 18 | void declareSim3(py::module & m) { 19 | 20 | py::class_(m, "Sim3") 21 | .def(py::init<>()) 22 | .def(py::init()) 23 | .def(py::init()) 24 | .def(py::init()) 25 | 26 | .def("map", &Sim3::map) 27 | .def("log", &Sim3::log) 28 | .def("inverse", &Sim3::inverse) 29 | 30 | .def("__getitem__", (double& (Sim3::*) (int)) &Sim3::operator[]) 31 | .def(py::self * py::self) 32 | .def(py::self *= py::self) 33 | 34 | .def("normalize_rotation", &Sim3::normalizeRotation) 35 | 36 | .def("translation", (Eigen::Vector3d& (Sim3::*) ()) &Sim3::translation) 37 | .def("rotation", (Eigen::Quaterniond& (Sim3::*) ()) &Sim3::rotation) 38 | .def("scale", (double& (Sim3::*) ()) &Sim3::scale) 39 | ; 40 | 41 | 42 | templatedBaseVertex<7, Sim3>(m, "_7_Sim3"); 43 | templatedBaseEdge<7, Sim3>(m, "_7_Sim3"); 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /g2opy/python/types/slam2d/edge_pointxy.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #include "python/core/base_binary_edge.h" 7 | 8 | 9 | 10 | namespace py = pybind11; 11 | using namespace pybind11::literals; 12 | 13 | 14 | namespace g2o { 15 | 16 | void declareEdgePointXY(py::module& m) { 17 | 18 | templatedBaseBinaryEdge<2, Vector2D, VertexPointXY, VertexPointXY>(m, "_2_Vector2D_VertexPointXY_VertexPointXY"); 19 | py::class_>(m, "EdgePointXY") 20 | .def(py::init<>()) 21 | .def("compute_error", &EdgePointXY::computeError) 22 | .def("set_measurement", &EdgePointXY::setMeasurement) 23 | .def("set_measurement_data", &EdgePointXY::setMeasurementData) 24 | .def("get_measurement_data", &EdgePointXY::getMeasurementData) 25 | .def("measurement_dimension", &EdgePointXY::measurementDimension) 26 | .def("set_measurement_from_state", &EdgePointXY::setMeasurementFromState) 27 | .def("initial_estimate_possible", &EdgePointXY::initialEstimatePossible) 28 | #ifndef NUMERIC_JACOBIAN_TWO_D_TYPES 29 | .def("linearize_oplus", &EdgePointXY::linearizeOplus) 30 | #endif 31 | ; 32 | 33 | } 34 | 35 | 36 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/types/slam2d/parameter_se2_offset.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareParameterSE2Offset(py::module & m) { 14 | 15 | py::class_(m, "ParameterSE2Offset") 16 | .def(py::init<>()) 17 | .def("set_offset", &ParameterSE2Offset::setOffset) 18 | .def("offset", &ParameterSE2Offset::offset) 19 | .def("offset_matrix", &ParameterSE2Offset::offsetMatrix) 20 | .def("inverse_offset_matrix", &ParameterSE2Offset::inverseOffsetMatrix) 21 | ; 22 | 23 | 24 | // class G2O_TYPES_SLAM2D_API CacheSE2Offset: public Cache 25 | 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /g2opy/python/types/slam2d/se2.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include "python/core/base_vertex.h" 8 | #include "python/core/base_edge.h" 9 | 10 | 11 | 12 | namespace py = pybind11; 13 | using namespace pybind11::literals; 14 | 15 | 16 | namespace g2o { 17 | 18 | void declareSE2(py::module & m) { 19 | 20 | py::class_(m, "SE2") 21 | .def(py::init<>()) 22 | .def(py::init()) 23 | .def(py::init()) 24 | .def(py::init()) 25 | 26 | .def("translation", &SE2::translation) 27 | .def("rotation", &SE2::rotation) 28 | 29 | .def(py::self * py::self) 30 | .def(py::self * Vector2D()) 31 | .def(py::self *= py::self) 32 | 33 | .def("inverse", &SE2::inverse) 34 | .def("__getitem__", &SE2::operator[]) 35 | .def("from_vector", &SE2::fromVector) 36 | .def("to_vector", &SE2::toVector) 37 | .def("vector", &SE2::toVector) 38 | .def("to_isometry", &SE2::toIsometry) 39 | .def("Isometry2d", &SE2::toIsometry) 40 | ; 41 | 42 | 43 | templatedBaseVertex<3, SE2>(m, "_3_SE2"); 44 | templatedBaseEdge<3, SE2>(m, "_3_SE2"); 45 | templatedBaseMultiEdge<3, SE2>(m, "_3_SE2"); 46 | 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /g2opy/python/types/slam2d/types_slam2d.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "parameter_se2_offset.h" 8 | 9 | #include "se2.h" 10 | #include "vertex_point_xy.h" 11 | #include "vertex_se2.h" 12 | 13 | #include "edge_pointxy.h" 14 | #include "edge_se2.h" 15 | #include "edge_se2_pointxy.h" 16 | 17 | 18 | 19 | 20 | namespace g2o { 21 | 22 | G2O_REGISTER_TYPE_GROUP(slam2d); 23 | 24 | G2O_REGISTER_TYPE(VERTEX_SE2, VertexSE2); 25 | G2O_REGISTER_TYPE(VERTEX_XY, VertexPointXY); 26 | G2O_REGISTER_TYPE(PARAMS_SE2OFFSET, ParameterSE2Offset); 27 | G2O_REGISTER_TYPE(CACHE_SE2_OFFSET, CacheSE2Offset); 28 | G2O_REGISTER_TYPE(EDGE_PRIOR_SE2, EdgeSE2Prior); 29 | G2O_REGISTER_TYPE(EDGE_PRIOR_SE2_XY, EdgeSE2XYPrior); 30 | G2O_REGISTER_TYPE(EDGE_SE2, EdgeSE2); 31 | G2O_REGISTER_TYPE(EDGE_SE2_XY, EdgeSE2PointXY); 32 | G2O_REGISTER_TYPE(EDGE_BEARING_SE2_XY, EdgeSE2PointXYBearing); 33 | G2O_REGISTER_TYPE(EDGE_SE2_XY_CALIB, EdgeSE2PointXYCalib); 34 | G2O_REGISTER_TYPE(EDGE_SE2_OFFSET, EdgeSE2Offset); 35 | G2O_REGISTER_TYPE(EDGE_SE2_POINTXY_OFFSET, EdgeSE2PointXYOffset); 36 | G2O_REGISTER_TYPE(EDGE_POINTXY, EdgePointXY); 37 | G2O_REGISTER_TYPE(EDGE_SE2_TWOPOINTSXY, EdgeSE2TwoPointsXY); 38 | G2O_REGISTER_TYPE(EDGE_SE2_LOTSOFXY, EdgeSE2LotsOfXY); 39 | 40 | 41 | 42 | void declareTypesSlam2d(py::module & m) { 43 | 44 | declareParameterSE2Offset(m); 45 | 46 | declareSE2(m); 47 | declareVertexPointXY(m); 48 | declareVertexSE2(m); 49 | 50 | declareEdgePointXY(m); 51 | declareEdgeSE2(m); 52 | declareEdgeSE2PointXY(m); 53 | 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /g2opy/python/types/slam2d/vertex_point_xy.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareVertexPointXY(py::module & m) { 14 | 15 | py::class_>(m, "VertexPointXY") 16 | .def(py::init<>()) 17 | .def("set_to_origin_impl", &VertexPointXY::setToOriginImpl) 18 | .def("oplus_impl", &VertexPointXY::oplusImpl) 19 | .def("set_estimate_data_impl", &VertexPointXY::setEstimateDataImpl) 20 | .def("get_estimate_data", &VertexPointXY::getEstimateData) 21 | .def("estimate_dimension", &VertexPointXY::estimateDimension) 22 | .def("set_minimal_estimate_data_impl", &VertexPointXY::setMinimalEstimateDataImpl) 23 | .def("get_minimal_estimate_data", &VertexPointXY::getMinimalEstimateData) 24 | .def("minimal_estimate_dimension", &VertexPointXY::minimalEstimateDimension) 25 | ; 26 | 27 | 28 | //class G2O_TYPES_SLAM2D_API VertexPointXYWriteGnuplotAction: public WriteGnuplotAction 29 | //class G2O_TYPES_SLAM2D_API VertexPointXYDrawAction: public DrawAction 30 | 31 | } 32 | 33 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/types/slam2d/vertex_se2.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareVertexSE2(py::module & m) { 14 | 15 | py::class_>(m, "VertexSE2") 16 | .def(py::init<>()) 17 | .def("set_to_origin_impl", &VertexSE2::setToOriginImpl) 18 | .def("oplus_impl", &VertexSE2::oplusImpl) 19 | .def("set_estimate_data_impl", &VertexSE2::setEstimateDataImpl) 20 | .def("get_estimate_data", &VertexSE2::getEstimateData) 21 | .def("estimate_dimension", &VertexSE2::estimateDimension) 22 | .def("set_minimal_estimate_data_impl", &VertexSE2::setMinimalEstimateDataImpl) 23 | .def("get_minimal_estimate_data", &VertexSE2::getMinimalEstimateData) 24 | .def("minimal_estimate_dimension", &VertexSE2::minimalEstimateDimension) 25 | ; 26 | 27 | 28 | //class G2O_TYPES_SLAM2D_API VertexSE2WriteGnuplotAction: public WriteGnuplotAction 29 | //class G2O_TYPES_SLAM2D_API VertexSE2DrawAction: public DrawAction 30 | 31 | } 32 | 33 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/types/slam3d/edge_pointxyz.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareEdgePointXYZ(py::module & m) { 14 | 15 | templatedBaseBinaryEdge<3, Vector3D, VertexPointXYZ, VertexPointXYZ>(m, "_3_Vector3D_VertexPointXYZ_VertexPointXYZ"); 16 | py::class_>(m, "EdgePointXYZ") 17 | .def(py::init<>()) 18 | 19 | .def("compute_error", &EdgePointXYZ::computeError) 20 | .def("set_measurement", &EdgePointXYZ::setMeasurement) 21 | .def("set_measurement_data", &EdgePointXYZ::setMeasurementData) 22 | .def("get_measurement_data", &EdgePointXYZ::getMeasurementData) 23 | .def("measurement_dimension", &EdgePointXYZ::measurementDimension) 24 | .def("set_measurement_from_state", &EdgePointXYZ::setMeasurementFromState) 25 | .def("initial_estimate_possible", &EdgePointXYZ::initialEstimatePossible) 26 | #ifndef NUMERIC_JACOBIAN_THREE_D_TYPES 27 | .def("linearize_oplus", &EdgePointXYZ::linearizeOplus) 28 | #endif 29 | ; 30 | 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /g2opy/python/types/slam3d/types_slam3d.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "parameter.h" 8 | #include "se3quat.h" 9 | #include "vertex_se3.h" 10 | #include "vertex_pointxyz.h" 11 | 12 | #include "edge_pointxyz.h" 13 | #include "edge_se3.h" 14 | #include "edge_se3_pointxyz.h" 15 | 16 | 17 | 18 | namespace g2o { 19 | 20 | 21 | // register types 22 | // slam3d 23 | G2O_REGISTER_TYPE_GROUP(slam3d); 24 | G2O_REGISTER_TYPE(VERTEX_SE3:QUAT, VertexSE3); 25 | G2O_REGISTER_TYPE(EDGE_SE3:QUAT, EdgeSE3); 26 | G2O_REGISTER_TYPE(VERTEX_TRACKXYZ, VertexPointXYZ); 27 | 28 | G2O_REGISTER_TYPE(PARAMS_SE3OFFSET, ParameterSE3Offset); 29 | G2O_REGISTER_TYPE(EDGE_SE3_TRACKXYZ, EdgeSE3PointXYZ); 30 | G2O_REGISTER_TYPE(EDGE_SE3_PRIOR, EdgeSE3Prior); 31 | G2O_REGISTER_TYPE(CACHE_SE3_OFFSET, CacheSE3Offset); 32 | G2O_REGISTER_TYPE(EDGE_SE3_OFFSET, EdgeSE3Offset); 33 | 34 | G2O_REGISTER_TYPE(PARAMS_CAMERACALIB, ParameterCamera); 35 | G2O_REGISTER_TYPE(PARAMS_STEREOCAMERACALIB, ParameterStereoCamera); 36 | G2O_REGISTER_TYPE(CACHE_CAMERA, CacheCamera); 37 | G2O_REGISTER_TYPE(EDGE_PROJECT_DISPARITY, EdgeSE3PointXYZDisparity); 38 | G2O_REGISTER_TYPE(EDGE_PROJECT_DEPTH, EdgeSE3PointXYZDepth); 39 | 40 | G2O_REGISTER_TYPE(EDGE_POINTXYZ, EdgePointXYZ); 41 | 42 | G2O_REGISTER_TYPE(EDGE_SE3_LOTSOF_XYZ, EdgeSE3LotsOfXYZ); 43 | 44 | 45 | void declareTypesSlam3d(py::module & m) { 46 | 47 | declareSalm3dParameter(m); 48 | 49 | declareSE3Quat(m); 50 | declareVertexSE3(m); 51 | declareVertexPointXYZ(m); 52 | 53 | declareEdgePointXYZ(m); 54 | declareEdgeSE3(m); 55 | declareEdgeSE3PointXYZ(m); 56 | 57 | 58 | } 59 | 60 | } -------------------------------------------------------------------------------- /g2opy/python/types/slam3d/vertex_pointxyz.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareVertexPointXYZ(py::module & m) { 14 | 15 | py::class_>(m, "VertexPointXYZ") 16 | .def(py::init<>()) 17 | 18 | .def("set_to_origin_impl", &VertexPointXYZ::setToOriginImpl) 19 | .def("set_estimate_data_impl", &VertexPointXYZ::setEstimateDataImpl) 20 | .def("get_estimate_data", &VertexPointXYZ::getEstimateData) 21 | .def("estimate_dimension", &VertexPointXYZ::estimateDimension) 22 | .def("set_minimal_estimate_data_impl", &VertexPointXYZ::setMinimalEstimateDataImpl) 23 | .def("get_minimal_estimate_data", &VertexPointXYZ::getMinimalEstimateData) 24 | .def("minimal_estimate_dimension", &VertexPointXYZ::minimalEstimateDimension) 25 | .def("oplus_impl", &VertexPointXYZ::oplusImpl) 26 | ; 27 | 28 | 29 | 30 | // class G2O_TYPES_SLAM3D_API VertexPointXYZWriteGnuplotAction: public WriteGnuplotAction 31 | // class VertexPointXYZDrawAction: public DrawAction 32 | 33 | } 34 | 35 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/types/slam3d/vertex_se3.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace py = pybind11; 8 | using namespace pybind11::literals; 9 | 10 | 11 | namespace g2o { 12 | 13 | void declareVertexSE3(py::module & m) { 14 | 15 | py::class_>(m, "VertexSE3") 16 | .def(py::init<>()) 17 | 18 | .def("set_to_origin_impl", &VertexSE3::setToOriginImpl) 19 | .def("set_estimate_data_impl", &VertexSE3::setEstimateDataImpl) 20 | .def("get_estimate_data", &VertexSE3::getEstimateData) 21 | .def("estimate_dimension", &VertexSE3::estimateDimension) 22 | .def("set_minimal_estimate_data_impl", &VertexSE3::setMinimalEstimateDataImpl) 23 | .def("get_minimal_estimate_data", &VertexSE3::getMinimalEstimateData) 24 | .def("minimal_estimate_dimension", &VertexSE3::minimalEstimateDimension) 25 | .def("oplus_impl", &VertexSE3::oplusImpl) 26 | ; 27 | 28 | 29 | /* 30 | py::class_(m, "VertexSE3WriteGnuplotAction") 31 | .def(py::init<>()) 32 | .def("__call__", &VertexSE3WriteGnuplotAction::operator()) 33 | ; 34 | 35 | // #ifdef G2O_HAVE_OPENGL 36 | py::class_(m, "VertexSE3DrawAction") 37 | .def(py::init<>()) 38 | .def("__call__", &VertexSE3DrawAction::operator()) 39 | ; 40 | // #endif 41 | */ 42 | 43 | } 44 | 45 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/python/types/types.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "slam2d/types_slam2d.h" 4 | #include "slam3d/types_slam3d.h" 5 | 6 | #include "sba/types_six_dof_expmap.h" 7 | #include "sba/types_sba.h" 8 | #include "sba/sbacam.h" 9 | 10 | #include "sim3/sim3.h" 11 | #include "sim3/types_seven_dof_expmap.h" 12 | 13 | #include "icp/types_icp.h" 14 | 15 | #include "sclam2d/types_sclam2d.h" 16 | 17 | 18 | 19 | namespace py = pybind11; 20 | using namespace pybind11::literals; 21 | 22 | 23 | namespace g2o { 24 | 25 | void declareTypes(py::module & m) { 26 | 27 | // slam2d 28 | declareTypesSlam2d(m); 29 | 30 | // slam3d 31 | declareTypesSlam3d(m); 32 | 33 | // sba 34 | declareTypesSBA(m); 35 | declareTypesSixDofExpmap(m); 36 | declareSBACam(m); 37 | 38 | declareD3VO(m); 39 | 40 | // sim3 41 | declareSim3(m); 42 | declareTypesSevenDofExpmap(m); 43 | 44 | // icp 45 | declareTypesICP(m); 46 | 47 | // sclam2d 48 | declareTypesSclam2d(m); 49 | 50 | } 51 | 52 | } // end namespace g2o -------------------------------------------------------------------------------- /g2opy/script/install-deps-linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ev 4 | 5 | sudo apt-get update -qq 6 | sudo apt-get install -qq qtdeclarative5-dev qt5-qmake libqglviewer-dev libeigen3-dev libsuitesparse-dev 7 | -------------------------------------------------------------------------------- /g2opy/script/install-deps-osx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -ev 4 | 5 | brew update 6 | 7 | if brew outdated | grep -qx cmake; then 8 | brew upgrade cmake; 9 | fi 10 | 11 | brew install eigen 12 | -------------------------------------------------------------------------------- /g2opy/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | from setuptools.command.install import install 3 | from distutils.sysconfig import get_python_lib 4 | import glob 5 | import shutil 6 | 7 | 8 | __library_file__ = './lib/g2o*.so' 9 | __version__ = '0.0.1' 10 | 11 | 12 | 13 | class CopyLibFile(install): 14 | """" 15 | Directly copy library file to python's site-packages directory. 16 | """ 17 | 18 | def run(self): 19 | install_dir = get_python_lib() 20 | lib_file = glob.glob(__library_file__) 21 | assert len(lib_file) == 1 22 | 23 | print('copying {} -> {}'.format(lib_file[0], install_dir)) 24 | shutil.copy(lib_file[0], install_dir) 25 | 26 | 27 | 28 | 29 | setup( 30 | name='g2opy', 31 | version=__version__, 32 | description='Python binding of C++ graph optimization framework g2o.', 33 | url='https://github.com/uoip/g2opy', 34 | license='BSD', 35 | cmdclass=dict( 36 | install=CopyLibFile 37 | ), 38 | keywords='g2o, SLAM, BA, ICP, optimization, python, binding', 39 | long_description="""This is a Python binding for c++ library g2o 40 | (https://github.com/RainerKuemmerle/g2o). 41 | 42 | g2o is an open-source C++ framework for optimizing graph-based nonlinear 43 | error functions. g2o has been designed to be easily extensible to a wide 44 | range of problems and a new problem typically can be specified in a few 45 | lines of code. The current implementation provides solutions to several 46 | variants of SLAM and BA.""", 47 | py_modules=[] 48 | ) 49 | -------------------------------------------------------------------------------- /kitti-odom-eval-master/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Huangying Zhan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /kitti-odom-eval-master/eval_odom.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) Huangying Zhan 2019. All rights reserved. 2 | 3 | import argparse 4 | 5 | from kitti_odometry import KittiEvalOdom 6 | 7 | parser = argparse.ArgumentParser(description='KITTI evaluation') 8 | parser.add_argument('--result', type=str, required=True, 9 | help="Result directory") 10 | parser.add_argument('--align', type=str, 11 | choices=['scale', 'scale_7dof', '7dof', '6dof'], 12 | default=None, 13 | help="alignment type") 14 | parser.add_argument('--seqs', 15 | nargs="+", 16 | type=int, 17 | help="sequences to be evaluated", 18 | default=None) 19 | args = parser.parse_args() 20 | 21 | eval_tool = KittiEvalOdom() 22 | gt_dir = "/Users/andrewstange/Desktop/CMU/Fall_2022/16-833/Project/D3VO/kitti_odom_gt/poses" #"dataset/kitti_odom/gt_poses/" 23 | result_dir = args.result 24 | 25 | continue_flag = input("Evaluate result in {}? [y/n]".format(result_dir)) 26 | if continue_flag == "y": 27 | eval_tool.eval( 28 | gt_dir, 29 | result_dir, 30 | alignment=args.align, 31 | seqs=args.seqs, 32 | ) 33 | else: 34 | print("Double check the path!") 35 | -------------------------------------------------------------------------------- /kitti-odom-eval-master/misc/result_summary.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/kitti-odom-eval-master/misc/result_summary.jpeg -------------------------------------------------------------------------------- /kitti-odom-eval-master/misc/run_eg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/kitti-odom-eval-master/misc/run_eg.jpeg -------------------------------------------------------------------------------- /kitti-odom-eval-master/misc/sub_seq_err.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/kitti-odom-eval-master/misc/sub_seq_err.jpeg -------------------------------------------------------------------------------- /kitti-odom-eval-master/misc/traj_eg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/kitti-odom-eval-master/misc/traj_eg.jpeg -------------------------------------------------------------------------------- /monodepth2/assets/copyright_notice.txt: -------------------------------------------------------------------------------- 1 | The image test_image.jpg is a modified (cropped) version of the original image which can be found at: 2 | https://www.flickr.com/photos/31176607@N05/44108158051/in/faves-41364765@N06/ 3 | 4 | This image was licensed under the creative commons 2.0 CC BY 2.0 licence. 5 | https://creativecommons.org/licenses/by/2.0/ 6 | -------------------------------------------------------------------------------- /monodepth2/assets/teaser.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/monodepth2/assets/teaser.gif -------------------------------------------------------------------------------- /monodepth2/assets/test_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/monodepth2/assets/test_image.jpg -------------------------------------------------------------------------------- /monodepth2/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | from .kitti_dataset import KITTIRAWDataset, KITTIOdomDataset, KITTIDepthDataset 2 | -------------------------------------------------------------------------------- /monodepth2/datasets/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/monodepth2/datasets/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /monodepth2/datasets/__pycache__/kitti_dataset.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/monodepth2/datasets/__pycache__/kitti_dataset.cpython-38.pyc -------------------------------------------------------------------------------- /monodepth2/datasets/__pycache__/mono_dataset.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/monodepth2/datasets/__pycache__/mono_dataset.cpython-38.pyc -------------------------------------------------------------------------------- /monodepth2/experiments/mono+stereo_experiments.sh: -------------------------------------------------------------------------------- 1 | # Our standard mono+stereo model 2 | python ../train.py --model_name MS_640x192 \ 3 | --use_stereo --frame_ids 0 -1 1 4 | 5 | # Our low resolution mono+stereo model 6 | python ../train.py --model_name MS_416x128 \ 7 | --use_stereo --frame_ids 0 -1 1 \ 8 | --height 128 --width 416 9 | 10 | # Our high resolution mono+stereo model 11 | python ../train.py --model_name MS_1024x320 \ 12 | --use_stereo --frame_ids 0 -1 1 \ 13 | --height 320 --width 1024 \ 14 | --load_weights_folder ~/tmp/MS_640x192/models/weights_9 \ 15 | --num_epochs 5 --learning_rate 1e-5 16 | 17 | # Our standard mono+stereo model w/o pretraining 18 | python ../train.py --model_name MS_640x192_no_pt \ 19 | --use_stereo --frame_ids 0 -1 1 \ 20 | --weights_init scratch \ 21 | --num_epochs 30 22 | 23 | # Baseline mono+stereo model, i.e. ours with our contributions turned off 24 | python ../train.py --model_name MS_640x192_baseline \ 25 | --use_stereo --frame_ids 0 -1 1 \ 26 | --v1_multiscale --disable_automasking --avg_reprojection 27 | 28 | # Mono+stereo without full-res multiscale 29 | python ../train.py --model_name MS_640x192_no_full_res_ms \ 30 | --use_stereo --frame_ids 0 -1 1 \ 31 | --v1_multiscale 32 | 33 | # Mono+stereo without automasking 34 | python ../train.py --model_name MS_640x192_no_automasking \ 35 | --use_stereo --frame_ids 0 -1 1 \ 36 | --disable_automasking 37 | 38 | # Mono+stereo without min reproj 39 | python ../train.py --model_name MS_640x192_no_min_reproj \ 40 | --use_stereo --frame_ids 0 -1 1 \ 41 | --avg_reprojection 42 | -------------------------------------------------------------------------------- /monodepth2/experiments/mono_experiments.sh: -------------------------------------------------------------------------------- 1 | # Our standard mono model 2 | python ../train.py --model_name M_640x192 3 | 4 | # Our low resolution mono model 5 | python ../train.py --model_name M_416x128 \ 6 | --height 128 --width 416 7 | 8 | # Our high resolution mono model 9 | python ../train.py --model_name M_1024x320 \ 10 | --height 320 --width 1024 \ 11 | --load_weights_folder ~/tmp/M_640x192/models/weights_9 \ 12 | --num_epochs 5 --learning_rate 1e-5 13 | 14 | # Our standard mono model w/o pretraining 15 | python ../train.py --model_name M_640x192_no_pt \ 16 | --weights_init scratch \ 17 | --num_epochs 30 18 | 19 | # Baseline mono model, i.e. ours with our contributions turned off 20 | python ../train.py --model_name M_640x192_baseline \ 21 | --v1_multiscale --disable_automasking --avg_reprojection 22 | 23 | # Mono without full-res multiscale 24 | python ../train.py --model_name M_640x192_no_full_res_ms \ 25 | --v1_multiscale 26 | 27 | # Mono without automasking 28 | python ../train.py --model_name M_640x192_no_automasking \ 29 | --disable_automasking 30 | 31 | # Mono without min reproj 32 | python ../train.py --model_name M_640x192_no_min_reproj \ 33 | --avg_reprojection 34 | 35 | # Mono with Zhou's masking scheme instead of ours 36 | python ../train.py --model_name M_640x192_zhou_masking \ 37 | --disable_automasking --zhou_mask 38 | -------------------------------------------------------------------------------- /monodepth2/experiments/odom_experiments.sh: -------------------------------------------------------------------------------- 1 | # A different kitti dataset is required for odometry training and evaluation. 2 | # This can be downloaded from http://www.cvlibs.net/datasets/kitti/eval_odometry.php 3 | # We assume this has been extraced to the folder ../kitti_data_odom 4 | 5 | # Standard mono odometry model. 6 | python ../train.py --model_name M_odom \ 7 | --split odom --dataset kitti_odom --data_path ../kitti_data_odom 8 | 9 | # Mono odometry model without Imagenet pretraining 10 | python ../train.py --model_name M_odom_no_pt \ 11 | --split odom --dataset kitti_odom --data_path ../kitti_data_odom \ 12 | --weights_init scratch --num_epochs 30 13 | 14 | # Mono + stereo odometry model 15 | python ../train.py --model_name MS_odom \ 16 | --split odom --dataset kitti_odom --data_path ../kitti_data_odom \ 17 | --use_stereo 18 | 19 | # Mono + stereo odometry model without Imagenet pretraining 20 | python ../train.py --model_name MS_odom_no_pt \ 21 | --split odom --dataset kitti_odom --data_path ../kitti_data_odom \ 22 | --use_stereo \ 23 | --weights_init scratch --num_epochs 30 24 | -------------------------------------------------------------------------------- /monodepth2/experiments/stereo_experiments.sh: -------------------------------------------------------------------------------- 1 | # Our standard stereo model 2 | python ../train.py --model_name S_640x192 \ 3 | --use_stereo --frame_ids 0 --split eigen_full 4 | 5 | # Our low resolution stereo model 6 | python ../train.py --model_name S_416x128 \ 7 | --use_stereo --frame_ids 0 --split eigen_full \ 8 | --height 128 --width 416 9 | 10 | # Our high resolution stereo model 11 | python ../train.py --model_name S_1024x320 \ 12 | --use_stereo --frame_ids 0 --split eigen_full \ 13 | --height 320 --width 1024 \ 14 | --load_weights_folder ~/tmp/S_640x192/models/weights_9 \ 15 | --models_to_load encoder depth \ 16 | --num_epochs 5 --learning_rate 1e-5 17 | 18 | # Our standard stereo model w/o pretraining 19 | python ../train.py --model_name S_640x192_no_pt \ 20 | --use_stereo --frame_ids 0 --split eigen_full \ 21 | --weights_init scratch \ 22 | --num_epochs 30 23 | 24 | # Baseline stereo model, i.e. ours with our contributions turned off 25 | python ../train.py --model_name S_640x192_baseline \ 26 | --use_stereo --frame_ids 0 --split eigen_full \ 27 | --v1_multiscale --disable_automasking 28 | -------------------------------------------------------------------------------- /monodepth2/networks/__init__.py: -------------------------------------------------------------------------------- 1 | from .resnet_encoder import ResnetEncoder 2 | from .depth_decoder import DepthDecoder 3 | from .pose_decoder import PoseDecoder 4 | from .pose_cnn import PoseCNN 5 | -------------------------------------------------------------------------------- /monodepth2/splits/benchmark/eigen_to_benchmark_ids.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/as821/D3VO/339f295132e8dcdf21b5d1deaa48fad171a7e92e/monodepth2/splits/benchmark/eigen_to_benchmark_ids.npy -------------------------------------------------------------------------------- /monodepth2/train.py: -------------------------------------------------------------------------------- 1 | # Copyright Niantic 2019. Patent Pending. All rights reserved. 2 | # 3 | # This software is licensed under the terms of the Monodepth2 licence 4 | # which allows for non-commercial use only, the full terms of which are made 5 | # available in the LICENSE file. 6 | 7 | from __future__ import absolute_import, division, print_function 8 | 9 | from trainer import Trainer 10 | from options import MonodepthOptions 11 | 12 | options = MonodepthOptions() 13 | opts = options.parse() 14 | 15 | 16 | if __name__ == "__main__": 17 | trainer = Trainer(opts) 18 | trainer.train() 19 | -------------------------------------------------------------------------------- /src/numpy_to_pose.py: -------------------------------------------------------------------------------- 1 | # Simple script to convert poses in a .npy file into the .txt format expected by eval_odom.py 2 | 3 | import sys 4 | import numpy as np 5 | 6 | 7 | 8 | def numpy_to_kitti(pose): 9 | """Given a numpy 4x4 array, convert it into the KITTI .txt string format""" 10 | assert pose.shape == (4, 4) 11 | out = "" 12 | for i in range(3): # exclude last row of homogenous matrix 13 | for j in range(pose.shape[1]): 14 | out += f"{pose[i, j]} " 15 | if out[-1] == " ": 16 | out = out[:-1] 17 | return out 18 | 19 | 20 | 21 | if __name__ == "__main__": 22 | if len(sys.argv) != 3: 23 | print("error: expecting 2 commandline arguments: source .npy and destination .txt files") 24 | 25 | pred_poses_np = np.load(sys.argv[1]) 26 | kitti = [numpy_to_kitti(p) for p in pred_poses_np] 27 | 28 | with open(sys.argv[2], "w") as fd: 29 | for line in kitti: 30 | fd.write(f"{line}\n") 31 | print("Complete.") 32 | 33 | 34 | --------------------------------------------------------------------------------