赞
踩
教程 https://zhuanlan.zhihu.com/p/679914618?utm_id=0
无论什么系统,我都会创建一个conda环境再安装ros, 避免ros安装的py包与系统混在一起。
很简单,wget http://fishros.com/install -O fishros && . fishros
根据提示输入数字选择即可。
添加源:
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_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.
根据最后的提示,需要添加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 已经成功启动了,意味着已经安装成功,
创建工作空间
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_package
catkin build --this
sudo apt remove ros-noetic-autolabor
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。