使用velodyne16线激光雷达跑LeGO-LOAM

安装第三方库

  1. gtsam库
  2. 参考ROS安装(国内源)
  3. velodyne驱动 Github
  4. velodyne驱动 ros:
sudo apt-get install ros-kinetic-velodyne
1. 安装错误
  1. 安装ros发生以下错误
 python3-lxml : 依赖: python3 (< 3.6) but 3.6.7-1~18.04 is to be installed
 python3-gdbm : 依赖: python3 (< 3.6) but 3.6.7-1~18.04 is to be installed
 pulseaudio-utils : 依赖: libpulse0 (= 1:8.0-0ubuntu3.3) but 1:11.1-1ubuntu7.9 is to be installed
 qtdeclarative5-dev-tools : 依赖: qtdeclarative-abi-5-5-0 which is a virtual package, provided by:
                                    - libqt5qml5 (5.5.1-2ubuntu6), but 5.9.5-0ubuntu1.1 is to be installed

 python3-apt : 依赖: python3 (< 3.6) but 3.6.7-1~18.04 is to be installed
 rhythmbox : 依赖: python3 (< 3.6) but 3.6.7-1~18.04 is to be installed
 libdouble-conversion1 : 破坏: libdouble-conversion1v5 but 2.0.1-3ubuntu2 is installed
2. 解决办法:换源

参考E:无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系

sudo gedit /etc/apt/source.list
# 清华大学源
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
##测试版
#deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# 源码
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
##测试版
#deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multivers

更新一下

sudo apt-get -f install
sudo apt-get update

如果发生apt-get upgrade或sudo apt-get update错误:

wget -q -O - http://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo apt-get upgrade
sudo apt-get install ros-kinetic-velodyne

注意:kinetic换成你自己的版本比如indigo

安装激光雷达驱动

参考【SLAM】之Velodyne VLP16 激光雷达使用

rosdep init
rosdep update
//这里我已经安装gtsam库了,就跳过了
//rosdep install --from-paths src --ignore-src --rosdistro YOURDISTRO -y
//第一次一定要带 -j1
catkin_make -j1
source devel/setup.bash

在官网下载VLP-16.xml,放在桌面

//转换成yaml格式
rosrun velodyne_pointcloud gen_calibration.py ~/Desktop/VLP-16.xml
roslaunch velodyne_pointcloud VLP16_points.launch calib:="~/Desktop/VLP16.yaml"

//然后在rviz中点Add,增加PointCloud2,再在PointCloud2下点topic输入/velodyne_points。这样就可以实时显示获取的3D点云图。
rosrun rviz rviz -f velodyne

//只保存/velodyne_points这个topic的数据(可以用rostopic list -v开看当前可用的topic),保存在当前目录的out.bag
rosbag record -O out /velodyne_points

安装IMU和LeGO-LOAM

参考ROS与传感器教程-LPMS IMU传感器使用

sudo apt-get install libpugixml-dev libbluetooth-dev
wget https://bitbucket.org/lpresearch/openmat/downloads/LpSensor-1.3.5-Linux-arm64.tar.gz
tar -zxvf LpSensor-1.3.5-Linux-arm64.tar.gz
sudo dpkg -i LpSensor-1.3.5-Linux-arm64/liblpsensor-1.3.5-Linux.deb
rosrun lpms_imu lpms_imu_node _sensor_model:="LPMSB2-9BA395" _port:="00:04:3E:9B:A3:95" /imu:=/imu/data

下载timesync github和lpms_imu github,放到LeGO-LOAM github的ros工作目录下,一起编译

//启动激光雷达节点
roslaunch velodyne_pointcloud VLP16_points.launch calib:="~/Desktop/VLP16.yaml"
//开始跑slam,会自动打开rviz
roslaunch lego_loam run.launch

或者跑本地数据:

roslaunch lego_loam run.launch
rosbag play *.bag --clock --topic /velodyne_points /imu/data

*.bag包在这里下载

安装roboware

roboware github

//卸载:
sudo dpkg -r package_name
//注意,卸载时候是package_file.deb对应的package name,若不知道package name,可以通过
dpkg -l查找,若要查找对应的package,可以加通配符,如查找包含fox的package
dpkg -l fox即可

//查到以后,可以运行
dpkg -r package_name卸载

安装anaconda

参考anaconda文档
参考conda官方指导
参考anaconda python 版本对应关系

anaconda在这里下载对应的版本

//创建一个python3.5的虚拟环境
conda create -n env_name python=3.5
//激活虚拟环境
source activate env_name
//反激活虚拟环境
source deactivate
//查看已有虚拟环境
conda info -e
//克隆已有虚拟环境
conda create --name new_env_name --clone copied_env_name
//移除已有虚拟环境
conda remove --name env_name --all
//查找包名,不用 --full-name即为模糊查找
conda search --full-name 查找的包名
//列出安装的包
conda list
//在指定虚拟环境安装指定版本的包
conda install --name env_name package_name=1.0.0
//安装包列表
conda install --yes --file requirements.txt

requirements.txt文件示例:

torch==0.4.1
torchnet==0.0.4
torchvision==0.2.1
easydict==1.9
tqdm==4.29.0
reprint==0.5.2
plyfile==0.7
tensorflow-gpu==1.4.0
pyyaml==3.13
ipdb==0.11
matplotlib==3.0.2
h5py==2.9.0
scikit-image==0.14.2
cffi==1.11.5
argparse
pickle

接下来可以安装一些python库,愉快地二次开发了

你可能感兴趣的:(笔记,c++,ubuntu,自动驾驶)