本次使用的是Ubuntu16.04,因此安装ROS Kinetic;如果是18.04版本,则安装Melodic
官网如下:
ROS/Installation - ROS Wiki
安装教程同样可以参考bilibili古月居发布的教程。
之后,还需要安装额外的ROS包:
sudo apt-get install ros-XXX-cv-bridge ros-XXX-tf ros-XXX-message-filters ros-XXX-image-transport
这里XXX换成你安装的ROS 发行版,本次是Kinetic。
eigen3.2.9是系统自带版本,本次需要卸载并安装3.3.9;ceres-solver安装1.14.0版本。
2.2Eigen3.3.9安装
//移除旧版本Eigen3
sudo rm -rf /usr/include/eigen3 /usr/lib/cmake/eigen3 /usr/share/doc/libeigen3-dev /usr/share/pkgconfig/eigen3.pc /var/lib/dpkg/info/libeigen3-dev.list /var/lib/dpkg/info/libeigen3-dev.md5sums
//安装新版本Eigen
//官网下载对应版本Eigen,并解压
cd eigen-3.3.9
mkdir build
cd build
cmake ..
make
sudo make install
//由于默认安装位置为/usr/local文件夹内,但是使用时,有部分库会直接默认在/usr/include里面,这里需要移动Eigen的位置
sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include/ //Eigen复制出来
sudo cp -r /usr/local/include/eigen3 /usr/include
sudo cp -r /usr/local/include/Eigen/ /usr/include
注意:安装路径可能会稍有不同,需灵活变通。
//如果之前安装了ceres需要先卸载ceres
sudo rm -r /usr/local/lib/cmake/Ceres
sudo rm -rf /usr/local/include/ceres /usr/local/lib/libceres.a
//安装相关依赖项
sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3.1.2 libgflags-dev
sudo apt-get install libgoogle-glog-dev libgtest-dev
//如果找不到 cxsparse 或者其他的lib,需要添加下面的源
sudo gedit /etc/apt/sources.list
deb http://cz.archive.ubuntu.com/ubuntu trusty main universe #粘贴进去
sudo apt-get update
/然后在重复安装依赖步骤
//编译安装
//官网下载ceres-solver-1.14.0,并解压
cd ceres-solver-1.14.0
mkdir ceres-bin && cd ceres-bin
cmake
make -j4
sudo make install
//之后ceres将会安装到/usr/local/lib/cmake/ceres文件夹中
sudo chmod -R a+w /usr/local/lib/cmake/ceres/CeresConfig.cmake
进入/usr/local/lib/cmake/ceres,点击CeresConfig.cmake,此时应该是可编辑状态。
进入后,将一下代码复制其中,一定注意位置。
set(CERES_EIGEN_VERSION 3.3.9)
set(EIGEN_INCLUDE_DIRS "/usr/local/include/eigen3")
位置:
set(CERES_EIGEN_VERSION 3.3.9)
set(EIGEN_INCLUDE_DIRS "/usr/local/include/eigen3")
if (EIGEN_FOUND)
if (NOT EIGEN_VERSION VERSION_EQUAL CERES_EIGEN_VERSION)
# CMake's VERSION check in FIND_PACKAGE() will accept any version >= the
# specified version. However, only version = is supported. Improve
# usability by explaining why we don't accept non-exact version matching.
ceres_report_not_found("Found Eigen dependency, but the version of Eigen "
"found (${EIGEN_VERSION}) does not exactly match the version of Eigen "
"Ceres was compiled with (${CERES_EIGEN_VERSION}). This can cause subtle "
"bugs by triggering violations of the One Definition Rule. See the "
"Wikipedia article http://en.wikipedia.org/wiki/One_Definition_Rule "
"for more details"
)
endif ()
本次官网下载并采用的是cmake 3.21.0,gcc 11.2.0
注意:sudo apt install cmake安装的是3.5.0
本次并没有实验3.5.0是否可以成功编译,因此只写出来以供参考
git clone https://github.com/Livox-SDK/Livox-SDK.git //如果无法下载,多试几次
cd Livox-SDK //如果没有这个文件则新建一个该命名的空白文件夹
cd build && cmake ..
make
sudo make install
git clone https://github.com/Livox-SDK/livox_ros_driver.git
//新建ws_livox/src,之后将下载的文件解压后放在src里
cd ws_livox
catkin_make
更新当前的ROS package环境
source ./devel/setup.sh
cd ~/catkin_ws/src //提示没有文件夹就新建文件夹
git clone https://github.com/hku-mars/r2live.git
cd ../
catkin_make
source ~/catkin_ws/devel/setup.bash
https://blog.csdn.net/qq_17424119/article/details/103636765
https://blog.csdn.net/u012700322/article/details/119142128
https://blog.csdn.net/learning_tortosie/article/details/118144287