升级!!Ubuntu20.04 noetic
Ubuntu20.04 noetic
ubuntu版本:20.04
webots版本:2021a
ros版本:noetic
为了能和读者进一步讨论问题,建立了一个微信群,方便给大家解答问题,也可以一起讨论问题。
加群链接
前言
想得到python3的完美支持,笔者下定决心直接更新系统,少走弯路
1.安装ros noetic
安装步骤:
- 添加 sources.list(设置你的电脑可以从 packages.ros.org 接收软件.)
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
- 添加KEYS
$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
- 安装ROS
更新库为最新:
$ sudo apt update
- 安装桌面完整版 : 包含ROS、rqt、rviz、机器人通用库、2D/3D 模拟器、导航以及2D/3D感知
$ sudo apt install ros-noetic-desktop-full
PS:安装时遇到依赖问题
下列软件包有未满足的依赖关系:
ros-kinetic-desktop-full : 依赖: ros-kinetic-desktop 但是它将不会被安装
依赖: ros-kinetic-perception 但是它将不会被安装
依赖: ros-kinetic-simulators 但是它将不会被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。
解决过程:
- 使用
sudo apt install aptitude
安装aptitude工具- 在软件和更新->可从互联网下载中,全部打上钩,然后
sudo apt update
- 尝试安装
sudo aptitude install ros-kinetic-desktop-full
- 再次安装
sudo apt-get install ros-kinetic-desktop-full
- 环境配置
$ echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
至此,已经在Ubuntu20.04中安装了ROS noetic
2.安装配置webots
在ubuntu20.04安装webots步骤和使用Melodic写的教程ROS联合webots实战案例(一)安装配置webots类似,不过有一个点需要补充更新
srv数量从melodic的103个增加为106个。
2.1 安装对应版本webots_ros
$ sudo apt install ros-noetic-webots-ros
从webots_ros_noetic下载源代码。
2.2 配置WEBOTS_HOME环境
$ sudo gedit ~/.bashrc
在文件内的最后添加如下指令(笔者安装了webots-ros但是并没有自动帮我配置,所以需要自己配置一下)
export WEBOTS_HOME=/usr/local/webots/
2.3 测试
- 在catkin_ws下编译工作空间
$ catkin_make
- 跑官方例程pioneer3at机器人
$ roslaunch webots_ros pioneer3at.launch
成功跑通
2.安装amcl,gmapping导航包
2.1 安装amcl
$ sudo apt-get update
$ sudo apt-get install ros-noetic-amcl
2.1 安装gmapping
$ sudo apt-get update
$ sudo apt-get install ros-noetic-gmapping
2.2 安装move_base
$ sudo apt-get install ros-noetic-move-base
2.3 安装teb_local_planner
$ sudo apt-get install ros-noetic-move-base
3.安装cartographer
安装方法和melodic有所不同,根据https://google-cartographer.readthedocs.io/en/latest/来安装
3.1 下载源码
$ git clone https://github.com/googlecartographer/cartographer.git
$ git clone https://github.com/ceres-solver/ceres-solver.git
$ git clone https://github.com/abseil/abseil-cpp.git
$ git clone https://github.com/google/protobuf.git
3.2 安装依赖
$ sudo apt-get update
sudo apt-get install -y \
clang \
cmake \
g++ \
git \
google-mock \
libboost-all-dev \
libeigen3-dev \
libgflags-dev \
libgoogle-glog-dev \
liblua5.2-dev \
libprotobuf-dev \
libsuitesparse-dev \
libwebp-dev \
ninja-build \
protobuf-compiler \
python3-sphinx \
ros-noetic-tf2-eigen \
libatlas-base-dev \
libsuitesparse-dev \
liblapack-dev \
3.3 安装abseil
$ cd abseil-cpp
$ mkdir build
$ cd build
$ cmake -G Ninja -CMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/usr/local/stow/absl ..
$ ninja
$ sudo ninja install
$ cd /usr/local/stow
$ sudo stow absl
3.4 安装ceres-solver
$ cd ceres-solver
$ mkdir build
$ cd build
$ cmake .. -G Ninja -DCXX11=ON
$ ninja
$ sudo ninja install
3.5 安装cartograoger
$ cd cartographer
$ mkdir build
$ cd build
$ cmake ..
$ make -j8
$ sudo make install
3.6 安装cartographer_ros
$ cd ~/catkin_ws/src
$ git clone https://github.com/cartographer-project/cartographer_ros.git
然后到catkin_ws下运行catkin_make即可。
笔者出现的问题(以解决):编译 cartographer_ros 出现 CMake Error: The following variables are used in this project, but they are set to NOTFOUND…
cartographer 也能跑通
4.安装moveit
$ sudo apt-get install ros-noetic-moveit
$ sudo apt-get install ros-noetic-moveit-visual-tools
5.src目录
src
- cartographer_ros
- moveit
- universal_robot
- ur_e_webots
- volcano_moveit
- volcano_robotsim
- webots_ros
结语
本文也是基于笔者的学习和使用经验总结的,主观性较强,如果有哪些不对的地方或者不明白的地方,欢迎评论区留言交流~
✌Bye