安装ROS Melodic
1 Installation
1.1 Configure your Ubuntu repositories
http://www.360doc.com/content/18/0417/15/54525756_746389833.shtml
2.2 Setup your sources.list
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
2.3 Set up your keys
sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
如果出现“您希望继续执行吗? [Y/n] y 中止。”
再次执行,需要输入 [Y/n]时,输入 yes| 回车即可。
2.4 Installation
首先
sudo apt update
这里遇到了问题:
命中:1 http://archive.ubuntu.com/ubuntu bionic InRelease
命中:2 http://cn.archive.ubuntu.com/ubuntu bionic InRelease
命中:3 http://security.ubuntu.com/ubuntu bionic-security InRelease
命中:5 http://archive.canonical.com/ubuntu bionic InRelease
命中:6 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease
获取:4 http://packages.ros.org/ros/ubuntu bionic InRelease [4,680 B]
命中:7 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease
错误:4 http://packages.ros.org/ros/ubuntu bionic InRelease
下列签名无效: EXPKEYSIG F42ED6FBAB17C654 Open Robotics info@osrfoundation.org
命中:8 https://download.sublimetext.com apt/stable/ InRelease
已下载 4,680 B,耗时 22秒 (208 B/s)
正在读取软件包列表… 完成
正在分析软件包的依赖关系树
正在读取状态信息… 完成
有 531 个软件包可以升级。请执行 ‘apt list --upgradable’ 来查看它们。
W: 校验数字签名时出错。此仓库未被更新,所以仍然使用此前的索引文件。GPG 错误:http://packages.ros.org/ros/ubuntu bionic InRelease: 下列签名无效: EXPKEYSIG F42ED6FBAB17C654 Open Robotics info@osrfoundation.org
W: 无法下载 http://packages.ros.org/ros/ubuntu/dists/bionic/InRelease 下列签名无效: EXPKEYSIG F42ED6FBAB17C654 Open Robotics info@osrfoundation.org
W: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。
解决办法:
xxxx@xxx:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
Executing: /tmp/apt-key-gpghome.bc8KU2TwXU/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
gpg: 密钥 F42ED6FBAB17C654:“Open Robotics info@osrfoundation.org”1 个新的签名
gpg: 合计被处理的数量:1
gpg: 新的签名:1
Desktop-Full Install: (Recommended) : ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators and 2D/3D perception
然后运行:
sudo apt install ros-melodic-desktop-full
1.5 Environment setup
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
1.6 Dependencies for building packages
到目前为止,我们已经安装了运行核心 ROS 包所需的东西。有许多工具和库,能够帮助我们创建和管理ROS工作区。如:rosinstall,一个可以帮助我们下载ROS包的源代码的命令行工具
安装这些工具和依赖:
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
Before you can use many ROS tools, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS. If you have not yet installed rosdep, do so as follows.
sudo apt install python-rosdep
With the following, you can initialize rosdep.
sudo rosdep init
这里遇到了问题:
pkg_resources.DistributionNotFound: The 'rospkg>=1.3.0' distribution was not found and is required by rosdep
解决办法:
sudo pip install rosdep
然后运行
rosdep update
第二次安装时,这里遇到问题,解决办法
虽然这个办法能成功,但是我还是试了几次才成功
1.7 测试ros安装成功
安装kalibr
1. Install the build and run dependencies:
sudo apt-get install python-setuptools python-rosinstall ipython libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-melodic-vision-opencv ros-melodic-image-transport-plugins ros-melodic-cmake-modules python-software-properties software-properties-common libpoco-dev python-matplotlib python-scipy python-git python-pip ipython libtbb-dev libblas-dev liblapack-dev python-catkin-tools libv4l-dev
这里遇到了问题:
没有可用的软件包 python-software-properties,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,
或者只能在其他发布源中找到
然而下列软件包会取代它:
software-properties-common
E: 软件包 python-software-properties 没有可安装候选
解决办法:
然后把python-software-properties
删除后再运行:
sudo apt-get install python-setuptools python-rosinstall ipython libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-melodic-vision-opencv ros-melodic-image-transport-plugins ros-melodic-cmake-modules software-properties-common libpoco-dev python-matplotlib python-scipy python-git python-pip ipython libtbb-dev libblas-dev liblapack-dev python-catkin-tools libv4l-dev
再安装igraph
sudo pip install python-igraph --upgrade
这里遇到问题:
Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-POF3SC/python-igraph/
解决办法:
我首先到pypi去下载适配的轮子。根据我的python版本以及系统,我选择了
python_igraph-0.9.6-cp36-cp36m-manylinux2010_x86_64.whl
。
然后在利用pip install python_igraph-0.9.6-cp36-cp36m-manylinux2010_x86_64.whl
进行安装时,仍然报错。原因在于manylinux2010_x86_64
和manylinux1_x86_64
区别是manylinux2010 要求 pip >= 19.0。然后升级以下pip就可以顺利安装了。
manylinux tag | Client-side pip version required |
---|---|
manylinux2014 | pip >= 19.3 |
manylinux2010 | pip >= 19.0 |
manylinux1 | pip >= 8.1.0 |
这样就完成了依赖的安装。
2. Create a catkin workspace
mkdir -p ~/kalibr_workspace/src
cd ~/kalibr_workspace
source /opt/ros/melodic/setup.bash
catkin init
catkin config --extend /opt/ros/indigo
catkin config --merge-devel # Necessary for catkin_tools >= 0.4.
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release
3.Clone the source repo into your catkin workspace src folder
cd ~/kalibr_workspace/src
git clone https://github.com/ethz-asl/Kalibr.git
4. Build the code using the Release configuration. depending on the available memory, you might need to reduce the build threads (e.g. add -j2 to catkin_make)
cd ~/kalibr_workspace
catkin build -DCMAKE_BUILD_TYPE=Release -j4
5.Once the build is finished you have to source the catkin workspace setup to use Kalibr
source ~/kalibr_workspace/devel/setup.bash
注意:
在每次打开新的终端时,都需要上述source以下。
将上述source命令,通过
gedit ~/.bashrc
打开文件,然后在.bashrc
中将上述source命令添加进去,保存。然后
source ~/.bashrc
测试Kalibr
首先在官方github上下载测试数据。
下载Sample datasets中的Multiple camera calibration和IMU-camera calibration都可以。
Multiple camera calibration
文件下载后解压后,文件包含:
april_6x6.yaml
README
static.bag
在README文件中有:
kalibr_calibrate_cameras --target april_6x6.yaml --bag static.bag --models pinhole-equi pinhole-equi omni-radtan omni-radtan --topics /cam0/image_raw /cam1/image_raw /cam2/image_raw /cam3/image_raw
打开终端,移动到上述数据所在的文件夹内。
上面我们已经在.bashrc
文件中添加了脚本路径,因此可以直接运行上述README中的命令行即可。
运行后的结果:
这些图片保存在report-cam-static.pdf文件中。
标定的结果文件还包括:
report-cam-static.pdf
report-cam-static.txt
camchain-static.yaml
IMU-camera calibration
同上,在终端中运行:
kalibr_calibrate_imu_camera --target april_6x6.yaml --cam camchain.yaml --imu imu_adis16448.yaml --bag dynamic.bag --bag-from-to 5 45
其他问题
首次运行的时候,报错ImportError: No module named igraph
。
但是上述明明已经安装了igraph
。根据报错定位找到了相应的代码,发现在ObsDp.py
代码是python2.0代码。
因此,需要安装对应的igraph
,即
sudo apt-get install python2.7-igraph
最后
参考链接
以上记录了首次安装kalibr的流程,由于环境的差异,在安装的过程中遇到的问题也不一样。
首先根据官方的教程进行安装,以上流程也主要从官方教程中搬运过来的,遇到问题再搜索就行了。