Sophus: 非模板版本安装 Sophus Installation for old version

Share:
# Overview - API: https://strasdat.github.io/Sophus/index.html - Github: https://github.com/strasdat/Sophus - [stevenlovegrove/Sophus](https://github.com/stevenlovegrove/Sophus) - Sophus with ROS: http://wiki.ros.org/sophus # Installation ```sh git clone https://github.com/strasdat/Sophus.git git checkout a621ff ``` Note: > In order to go back to the non-templated/double-only version "git checkout a621ff a621ff: non template version or ```sh git clone https://github.com/yubaoliu/Sophus.git git checkout non-template ``` non-template** branch is I created where some building errors are fixed. - Build and Install ```sh mkdir build cd build cmake .. or cmake-gui .. make ``` - cmake-gui .. - make install ![image-20200525105546602](https://cdn.jsdelivr.net/gh/yubaoliu/assets@image/image-20200525105546602.png) # Cmake ```sh cmake_minimum_required( VERSION 3.0 ) project( SophusExample ) find_package( Sophus REQUIRED ) include_directories( ${Sophus_INCLUDE_DIRS} ) add_executable( useSophus useSophus.cpp ) target_link_libraries( useSophus ${Sophus_LIBRARIES} ) ``` Note: please set ``Sophus_DIR=[install path]`` Please manualy set Sophus_INCLUDE_DIRS and Sophus_LIBRARIES variable if not found. For example: ```sh set(Sophus_INCLUDE_DIRS ...) set(Sophus_LIBRARIES ...) ``` # Example - Refer: https://github.com/gaoxiang12/slambook/blob/master/ch4/useSophus/useSophus.cpp # Sophus with ROS - http://wiki.ros.org/sophus ```sh sudo apt-get install ros-kinetic-sophus ``` # Possible Errors ```sh so2.cpp:33:26:error: lvalue required as left operand of assignment unit_complex_.real() = 1.; ``` Solution: Modify so2.cpp: Change from ```cpp SO2::SO2() { unit_complex_.real() = 1.; unit_complex_.imag() = 0.; } ``` to ```cpp SO2::SO2() { unit_complex_.real(1.); unit_complex_.imag(0.); } ```

No comments