ubuntu20 配置 kalibr,问题解决

之前在ubuntu16上配置过kalibr,现在升级到ubuntu20,环境有变化,也趟了一些坑,记录下来。也希望能帮助到各位。

1. Ros安装参考官网

noetic/Installation/Ubuntu - ROS Wiki

重点问题:rosdep update失败。

(1)换手机热点,多试几次。

(2)VPN

(3)我是参考rosdep update错误失败一直timeout解决方法-物联沃-IOTWORD物联网这位大佬的方法成功的,多谢。做以下记录:

a. 把相关文件下载到本地:

方法1:

git clone https://github.com/ros/rosdistro.git /home/nice/robot

方法2:

链接:https://pan.baidu.com/s/1ZjMcvqOvLRa_iTdXis8ufg 
提取码:01e2

b. 改rosdep update获取文件的网址换为本地地址:

(1) sudo gedit /usr/lib/python3/dist-packages/rosdep2/rep3.py

文件中的 REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml' 替换成 REP3_TARGETS_URL = 'file:///home/nice/robot/releases/targets.yaml'(此处nice改为你的用户名因为此处的具体地址为你下载到本地的文件的地址。) 

(2)sudo gedit /usr/lib/python3/dist-packages/rosdistro/__init__.py

 文件中的 DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'替换成 DEFAULT_INDEX_URL = 'file:///home/nice/robot/index-v4.yaml'(此处nice改为你的用户名因为此处的具体地址为你下载到本地的文件的地址。)

(3)修改/etc/ros/rosdep/sources.list.d/20-default.list中的网址为本地地址

sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list 

 输入回车后会弹出20-default.list文件将原来文件中的所有 raw.githubusercontent.com开头的网址替换成对应文件在本地的路径(可将下面代码更换20-default.list中的代码注意:代码中的nice全部更换为你的用户名)

# os-specific listings first
yaml file:///home/nice/robot/rosdep/osx-homebrew.yaml osx
 
# generic
yaml file:///home/nice/robot/rosdep/base.yaml
yaml file:///home/nice/robot/rosdep/python.yaml
yaml file:///home/nice/robot/rosdep/ruby.yaml
gbpdistro file:///home/nice/robot/releases/fuerte.yaml fuerte
 
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

到这一步,大概率就可以解决了。

另外该问题也参考了解决ROS系统 rosdep update超时问题的新方法_rosdep proxy-CSDN博客

的操作。不过没有成功,按照上述办法最后才成功。注意两种办法不要混淆,尤其是增加URL的地方,如果上文的本地链接方法,就需要把这篇博客提到的这种语句删掉,否则会找不到本地文件

url="https://ghproxy.com/"+url

2.  kalibr环境的安装

参考文档很多,不列举了。无非就是安装依赖库,下载源码编译。

2.1 安装环境

sudo apt update
sudo apt-get install python3-setuptools python3-rosinstall ipython3 libeigen3-dev libboost-all-dev doxygen libopencv-dev ros-noetic-vision-opencv ros-noetic-image-transport-plugins ros-noetic-cmake-modules python3-software-properties software-properties-common libpoco-dev python3-matplotlib python3-scipy python3-git python3-pip libtbb-dev libblas-dev liblapack-dev libv4l-dev python3-catkin-tools python3-igraph libsuitesparse-dev
pip3 install wxPython

2.2 下载编译

mkdir ~/kalibr_ws/src
cd ~/kalibr_ws/src
git clone --recursive https://github.com/ori-drs/kalibr

cd ~/kalibr_ws
source /opt/ros/noetic/setup.bash
catkin init
catkin config --extend /opt/ros/noetic
catkin config --merge-devel # Necessary for catkin_tools >= 0.4.
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release

catkin build -DCMAKE_BUILD_TYPE=Release -j4

2.3 说重点问题

(1)boost-python库不匹配的问题:

CMake Error at /usr/local/lib/cmake/Boost-1.80.0/BoostConfig.cmake:141 (find_package):
  Could not find a configuration file for package "boost_python" that exactly
  matches requested version "1.80.0".

  The following configuration files were considered but not accepted:

    /usr/lib/x86_64-linux-gnu/cmake/boost_python-1.71.0/boost_python-config.cmake, version: 1.71.0
    /lib/x86_64-linux-gnu/cmake/boost_python-1.71.0/boost_python-config.cmake, version: 1.71.0

Call Stack (most recent call first):
  /usr/local/lib/cmake/Boost-1.80.0/BoostConfig.cmake:262 (boost_find_component)
  /usr/share/cmake-3.16/Modules/FindBoost.cmake:443 (find_package)
  /home/guangpu/Desktop/kalibr_workspace/src/kalibr/Schweizer-Messer/python_module/cmake/add_python_export_library.cmake:91 (find_package)
  CMakeLists.txt:38 (add_python_export_library)

(2) error: ‘_1’ was not declared in this scope

参考这个博客,感谢博主。Kalibr编译make报错:error: ‘_1’ was not declared in this scope_error: ‘_1’ was not declared in this scope 133 | b-CSDN博客

方法如下:

找到报错的文件,我的是home/***/kalibr_workspace/src/kalibr/aslam_nonparametric_estimation/bsplines_python/src/BSplinePython.cpp

开头加一个 #include <functional>
然后-1改成std::placeholders::_1。

有两处都需要改,41行和48行,两个_1都需要改掉。

(3)使用kalibr_create_target_pdf生成图卡时报错ModuleNotFoundError: No module named 'pyx'

方法如下:

sudo apt-get install python3-pyx

 然后执行

rosrun kalibr kalibr_create_target_pdf --type apriltag --nx 6 --ny 6 --tsize 0.02 --tspace 0.25

  • 19
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值