当前位置:   article > 正文

ubuntu 20.04/22.04 apt非源码安装ros1 noetic_sudo apt install ros-noetic-autolabor

sudo apt install ros-noetic-autolabor

教程 https://zhuanlan.zhihu.com/p/679914618?utm_id=0

安装前环境

无论什么系统,我都会创建一个conda环境再安装ros, 避免ros安装的py包与系统混在一起。

ubuntu20.04安装ros1 noetic

很简单,wget http://fishros.com/install -O fishros && . fishros
根据提示输入数字选择即可。

ubuntu22.04安装ros1 noetic

添加源

echo "deb [trusted=yes arch=amd64] http://deb.repo.autolabor.com.cn jammy main" | sudo tee /etc/apt/sources.list.d/autolabor.list
sudo apt update
  • 1
  • 2

安装sudo apt install ros-noetic-autolabor

我遇到无法连接到 cn.archive.ubuntu.com的问题,通过修改源解决:

  • 编辑文件/etc/apt/sources.list
  • 将所有的cn.archive.ubuntu.com替换为mirrors.aliyun.com
  • 然后sudo apt update
  • 然后修复安装sudo apt install ros-noetic-autolabor --fix-missing

安装后配置

安装成功:

正在设置 libglvnd-dev:amd64 (1.4.0-1) ...
正在设置 libqt5webkit5-dev:amd64 (5.212.0~alpha4-15ubuntu1) ...
正在设置 libglew-dev:amd64 (2.2.0-4) ...
正在设置 tk-dev:amd64 (8.6.11+1build2) ...
正在设置 libpango1.0-dev:amd64 (1.50.6+ds-2ubuntu1) ...
正在设置 qttools5-dev:amd64 (5.15.3-1) ...
正在设置 libegl1-mesa-dev:amd64 (23.2.1-1ubuntu3.1~22.04.2) ...
正在设置 qttools5-private-dev:amd64 (5.15.3-1) ...
正在设置 libgtk-3-dev:amd64 (3.24.33-1ubuntu2.1) ...
正在设置 libvtk9-dev (9.1.0+really9.1.0+dfsg2-3build1) ...
正在设置 libvtk9-qt-dev:amd64 (9.1.0+really9.1.0+dfsg2-3build1) ...
正在设置 libpcl-dev (1.12.1+dfsg-3build1) ...
正在设置 ros-noetic-autolabor (1.0) ...
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting catkin_tools
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/26/8c/51b1ab2933f193bb8195b67926f3b40523218ddf56de6cea4fae05d0f7a1/catkin_tools-0.9.4-py3-none-any.whl (225 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 225.4/225.4 KB 680.8 kB/s eta 0:00:00
Collecting osrf-pycommon>0.1.1
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/e6/39/b5ff4cc46f5e87016eb3df981132adf26bdb30327dee6e5b752307e7add8/osrf_pycommon-2.0.2-py3-none-any.whl (36 kB)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from catkin_tools) (59.6.0)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from catkin_tools) (5.4.1)
Requirement already satisfied: catkin-pkg>=0.3.0 in /usr/lib/python3/dist-packages (from catkin_tools) (0.4.24)
Installing collected packages: osrf-pycommon, catkin_tools
  WARNING: The script catkin is installed in '/home/USER/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed catkin_tools-0.9.4 osrf-pycommon-2.0.2
ros-noetic-autolabor installed.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

根据最后的提示,需要添加PATH:export PATH=~/.local/bin:$PATH

另外, 我使用catkin build时提示

  • 找不到No module named 'catkin_pkg',可能是因为我安装和使用的时候都处于conda环境中。解决的话:pip install catkin_pkg
  • 找不到empy, 同样pip install

验证安装

打开一个新的控制台 ,执行roscore

再打开另一个新的控制台rosrun rviz rviz

如果看到 rviz 已经成功启动了,意味着已经安装成功,

  • ros 会被安装在 /opt/ros/noetic 目录下,并且会在~/.bashrc 中添加 source /opt/ros/noetic/setup.bash 的引用
  • 这个版本包含了完整的 ros desktop full, navgation 以及对 gazibo 的支持,比较全,无需像官方的一个个包单独安装。

创建工作空间

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
  • 1
  • 2

初始化工作空间

catkin init
  • 1

创建一个Package

cd src
  • 1

使用 catkin create 创建一个名为my_package 的包,依赖于roscpp , std_msgs

catkin create pkg my_package roscpp std_msgs
  • 1

编译工作空间

cd ~/catkin_ws
catkin build

应无error:
Finished  <<< catkin_tools_prebuild                [ 0.6 seconds ]                                                        
Starting  >>> my_package                                                                                                  
Starting  >>> roscpp                                                                                                      
Starting  >>> std_msgs                                                                                                    
Finished  <<< my_package                           [ 0.9 seconds ]                                                        
Finished  <<< roscpp                               [ 0.9 seconds ]                                                        
Finished  <<< std_msgs                             [ 0.9 seconds ]                                                        
[build] Summary: All 4 packages succeeded!                                                                                
[build]   Ignored:   None.                                                                                                
[build]   Warnings:  1 packages succeeded with warnings.                                                                  
[build]   Abandoned: None.                                                                                                
[build]   Failed:    None.                                                                                                
[build] Runtime: 1.6 seconds total.                                                                                       
[build] Note: Workspace packages have changed, please re-source setup files to use them.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

单独编译包

cd ~/catkin_ws/src/my_package

catkin build --this
  • 1
  • 2
  • 3

卸载

sudo apt remove ros-noetic-autolabor

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/1011243
推荐阅读
相关标签
  

闽ICP备14008679号