本文主要是介绍ubuntu 22.04 apt非源码安装ros1 noetic,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
教程 https://zhuanlan.zhihu.com/p/679914618?utm_id=0
文章目录
- 安装
- 安装后配置
- 验证安装
- 卸载
安装
添加源:
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
安装: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_toolsDownloading 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.1Downloading 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_toolsWARNING: 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.
根据最后的提示,需要添加PATH:export PATH=~/.local/bin:$PATH
另外我使用catkin build
时提示找不到No module named 'catkin_pkg'
,可能是因为我安装和使用的时候都处于conda环境中。解决的话:pip install catkin_pkg
验证安装
打开一个新的控制台 ,执行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/
初始化工作空间
catkin init
创建一个Package
cd src
使用 catkin create 创建一个名为my_package 的包,依赖于roscpp , std_msgs
catkin create pkg my_package roscpp std_msgs
编译工作空间
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.
单独编译包
cd ~/catkin_ws/src/my_packagecatkin build --this
卸载
sudo apt remove ros-noetic-autolabor
这篇关于ubuntu 22.04 apt非源码安装ros1 noetic的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!